2023-02-11 16:38:53 +03:00
|
|
|
{ self, lib, inputs, ... }: {
|
2023-02-15 19:40:55 +03:00
|
|
|
perSystem = { config, self', inputs', pkgs, system, ... }: let
|
2023-02-11 16:38:53 +03:00
|
|
|
|
2023-03-05 10:15:38 +03:00
|
|
|
# A module imported into every package setting up the eval cache
|
2023-02-15 07:26:44 +03:00
|
|
|
evalCacheSetup = {config,...}: {
|
2023-03-04 09:59:12 +03:00
|
|
|
eval-cache.cacheFileRel = "/nix/modules/drvs/${config.public.name}/cache-${system}.json";
|
2023-02-15 07:26:44 +03:00
|
|
|
eval-cache.repoRoot = self;
|
2023-02-15 07:39:05 +03:00
|
|
|
eval-cache.enable = true;
|
2023-02-15 07:26:44 +03:00
|
|
|
};
|
|
|
|
|
2023-03-05 10:15:38 +03:00
|
|
|
# evalautes the package behind a given module
|
2023-02-11 16:38:53 +03:00
|
|
|
makeDrv = module: let
|
|
|
|
evaled = lib.evalModules {
|
2023-02-15 07:26:44 +03:00
|
|
|
modules = [
|
2023-03-04 09:59:12 +03:00
|
|
|
inputs.drv-parts.modules.drv-parts.core
|
2023-02-27 20:00:25 +03:00
|
|
|
inputs.drv-parts.modules.drv-parts.docs
|
2023-02-15 07:26:44 +03:00
|
|
|
module
|
2023-03-05 10:15:38 +03:00
|
|
|
../drv-parts/eval-cache
|
2023-02-15 07:26:44 +03:00
|
|
|
evalCacheSetup
|
|
|
|
];
|
2023-02-11 16:38:53 +03:00
|
|
|
specialArgs.dependencySets = {
|
2023-03-12 17:45:11 +03:00
|
|
|
nixpkgs = inputs'.nixpkgsV1.legacyPackages;
|
2023-02-11 16:38:53 +03:00
|
|
|
};
|
|
|
|
specialArgs.drv-parts = inputs.drv-parts;
|
|
|
|
};
|
|
|
|
in
|
2023-03-04 09:59:12 +03:00
|
|
|
evaled // evaled.config.public;
|
2023-02-11 16:38:53 +03:00
|
|
|
|
|
|
|
in {
|
2023-03-05 10:15:38 +03:00
|
|
|
# map all modules in ../drvs to a package output in the flake.
|
2023-02-11 16:38:53 +03:00
|
|
|
packages = lib.mapAttrs (_: drvModule: makeDrv drvModule) self.modules.drvs;
|
|
|
|
};
|
|
|
|
}
|