mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-23 06:21:30 +03:00
example-repo: use dream2nix.lib.evalModules
This commit is contained in:
parent
e57f78ac0d
commit
ddbd3a159b
@ -9,21 +9,15 @@
|
||||
nixpkgs = import dream2nix.inputs.nixpkgs {};
|
||||
lib = nixpkgs.lib;
|
||||
|
||||
_callModule = module:
|
||||
nixpkgs.lib.evalModules {
|
||||
specialArgs.dream2nix = dream2nix;
|
||||
specialArgs.packageSets.nixpkgs = nixpkgs;
|
||||
modules = [module ./settings.nix dream2nix.modules.dream2nix.core];
|
||||
};
|
||||
|
||||
# like callPackage for modules
|
||||
callModule = module: (_callModule module).config.public;
|
||||
|
||||
packageModuleNames = builtins.attrNames (builtins.readDir ./packages);
|
||||
|
||||
packages =
|
||||
lib.genAttrs packageModuleNames
|
||||
(moduleName: callModule "${./packages}/${moduleName}");
|
||||
(moduleName:
|
||||
dream2nix.lib.evalModules {
|
||||
modules = ["${./packages}/${moduleName}"];
|
||||
packageSets.nixpkgs = nixpkgs;
|
||||
});
|
||||
in
|
||||
# all packages defined inside ./packages/
|
||||
packages
|
||||
|
@ -38,9 +38,9 @@
|
||||
|
||||
# evaluates the package behind a given module
|
||||
makeDrv = modules: let
|
||||
evaled = lib.evalModules {
|
||||
evaled = self.lib.evalModules {
|
||||
modules = modules ++ [self.modules.dream2nix.core];
|
||||
specialArgs.packageSets = {
|
||||
packageSets = {
|
||||
nixpkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
writers = config.writers;
|
||||
};
|
||||
|
@ -13,11 +13,12 @@
|
||||
# If set, returns the result coming form nixpgs.lib.evalModules as is,
|
||||
# otherwise it returns the derivation only (.config.public).
|
||||
raw ? false,
|
||||
specialArgs ? {},
|
||||
...
|
||||
}: let
|
||||
forawardedArgs = builtins.removeAttrs args [
|
||||
"packageSets"
|
||||
"return"
|
||||
"raw"
|
||||
];
|
||||
|
||||
evaluated =
|
||||
@ -31,13 +32,11 @@
|
||||
self.modules.dream2nix.core
|
||||
];
|
||||
specialArgs =
|
||||
args.specialArgs
|
||||
or {}
|
||||
specialArgs
|
||||
// {
|
||||
inherit packageSets;
|
||||
dream2nix.modules.dream2nix = self.modules.dream2nix;
|
||||
dream2nix.lib.evalModules = self.lib.evalModules;
|
||||
drv-parts = inputs.dream2nix;
|
||||
};
|
||||
}
|
||||
);
|
Loading…
Reference in New Issue
Block a user