mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-09-11 14:35:30 +03:00
fix: use modules from makeFlakeOutputs, pass dream2nixConfig to modules specialArgs
This commit is contained in:
parent
74128bba5d
commit
fad33143f9
@ -1,10 +1,11 @@
|
||||
{dlib, ...}: {
|
||||
discoverers.default = {subsystem, ...}: {
|
||||
discoverers.dummy = rec {
|
||||
name = "dummy";
|
||||
subsystem = "hello";
|
||||
discover = {tree}: [
|
||||
(dlib.construct.discoveredProject {
|
||||
inherit subsystem;
|
||||
inherit subsystem name;
|
||||
inherit (tree) relPath;
|
||||
name = "hello";
|
||||
translators = ["dummy"];
|
||||
subsystemInfo = {};
|
||||
})
|
||||
|
@ -50,22 +50,11 @@ in let
|
||||
inherit framework;
|
||||
};
|
||||
|
||||
evaledModules = lib.evalModules {
|
||||
modules =
|
||||
[./modules/top-level.nix]
|
||||
++ (config.modules or []);
|
||||
|
||||
# TODO: remove specialArgs once all functionality is moved to /src/modules
|
||||
specialArgs = {
|
||||
inherit
|
||||
callPackageDream
|
||||
dlib
|
||||
;
|
||||
};
|
||||
framework = import ./modules/framework.nix {
|
||||
inherit lib dlib callPackageDream;
|
||||
dream2nixConfig = config;
|
||||
};
|
||||
|
||||
framework = evaledModules.config;
|
||||
|
||||
/*
|
||||
The nixos module system seems to break pkgs.callPackage.
|
||||
Therefore we always need to pass all of pkgs with callPackageDream.
|
||||
@ -648,9 +637,10 @@ in let
|
||||
makeOutputs = {
|
||||
source ? throw "pass a 'source' to 'makeOutputs'",
|
||||
discoveredProjects ?
|
||||
framework.functions.discoverers.discoverProjects {
|
||||
l.debug.traceValSeqN 2
|
||||
(framework.functions.discoverers.discoverProjects {
|
||||
inherit projects settings source;
|
||||
},
|
||||
}),
|
||||
pname ? null,
|
||||
projects ? {},
|
||||
settings ? [],
|
||||
|
11
src/lib.nix
11
src/lib.nix
@ -89,10 +89,16 @@
|
||||
config = loadConfig (args.config or {});
|
||||
dlib = import ./lib {inherit lib config;};
|
||||
|
||||
framework = import ./modules/framework.nix {
|
||||
inherit lib dlib;
|
||||
dream2nixConfig = config;
|
||||
callPackageDream = func: args: func args;
|
||||
};
|
||||
|
||||
initD2N = initDream2nix config;
|
||||
dream2nixFor = l.mapAttrs (_: pkgs: initD2N pkgs) allPkgs;
|
||||
|
||||
discoveredProjects = dlib.discoverers.discoverProjects {
|
||||
discoveredProjects = framework.functions.discoverers.discoverProjects {
|
||||
inherit projects settings;
|
||||
tree = dlib.prepareSourceTree {inherit source;};
|
||||
};
|
||||
@ -147,7 +153,6 @@
|
||||
allPkgs = makeNixpkgs pkgs systems;
|
||||
|
||||
config = loadConfig (args.config or {});
|
||||
dlib = import ./lib {inherit lib config;};
|
||||
|
||||
initD2N = initDream2nix config;
|
||||
dream2nixFor = l.mapAttrs (_: pkgs: initD2N pkgs) allPkgs;
|
||||
@ -182,7 +187,7 @@
|
||||
flakifiedOutputsList;
|
||||
in
|
||||
flakeOutputs;
|
||||
in rec {
|
||||
in {
|
||||
inherit init makeFlakeOutputs makeFlakeOutputsForIndexes;
|
||||
dlib = import ./lib {
|
||||
inherit lib;
|
||||
|
@ -20,7 +20,7 @@ in {
|
||||
description = "Subsystem of the discoverer.";
|
||||
};
|
||||
discover = lib.mkOption {
|
||||
type = t.functionTo t.attrs;
|
||||
type = t.functionTo (t.listOf t.attrs);
|
||||
default = _: {};
|
||||
};
|
||||
};
|
||||
|
22
src/modules/framework.nix
Normal file
22
src/modules/framework.nix
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
dream2nixConfig,
|
||||
callPackageDream,
|
||||
dlib,
|
||||
lib,
|
||||
}: let
|
||||
evaledModules = lib.evalModules {
|
||||
modules = [./top-level.nix] ++ (dream2nixConfig.modules or []);
|
||||
|
||||
# TODO: remove specialArgs once all functionality is moved to /src/modules
|
||||
specialArgs = {
|
||||
inherit
|
||||
dream2nixConfig
|
||||
callPackageDream
|
||||
dlib
|
||||
;
|
||||
};
|
||||
};
|
||||
|
||||
framework = evaledModules.config;
|
||||
in
|
||||
framework
|
@ -1,5 +1,6 @@
|
||||
{
|
||||
config,
|
||||
dream2nixConfig,
|
||||
dlib,
|
||||
lib,
|
||||
...
|
||||
@ -46,7 +47,7 @@
|
||||
|
||||
getDreamLockPath = project: rootProject:
|
||||
dlib.sanitizeRelativePath
|
||||
"${config.packagesDir}/${rootProject.name}/${project.relPath or ""}/dream-lock.json";
|
||||
"${dream2nixConfig.packagesDir}/${rootProject.name}/${project.relPath or ""}/dream-lock.json";
|
||||
|
||||
applyProjectSettings = projects: settingsList: let
|
||||
settingsListForProject = project:
|
||||
|
Loading…
Reference in New Issue
Block a user