example-repo: use dream2nix.lib.evalModules

This commit is contained in:
DavHau 2023-09-03 03:09:12 +02:00
parent e57f78ac0d
commit ddbd3a159b
3 changed files with 10 additions and 17 deletions

View File

@ -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

View File

@ -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;
};

View File

@ -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;
};
}
);