dream2nix/v1/nix/modules/flake-parts/packages.nix
2023-03-13 12:46:11 +07:00

30 lines
858 B
Nix

{ self, lib, inputs, ... }: {
perSystem = { config, self', inputs', pkgs, system, ... }: let
evalCacheSetup = {config,...}: {
eval-cache.cacheFileRel = "/nix/modules/drvs/${config.pname}/cache-${system}.json";
eval-cache.repoRoot = self;
eval-cache.enable = true;
};
makeDrv = module: let
evaled = lib.evalModules {
modules = [
inputs.drv-parts.modules.drv-parts.docs
module
evalCacheSetup
];
specialArgs.dependencySets = {
nixpkgs = inputs'.nixpkgsPython.legacyPackages;
nixpkgsStable = inputs'.nixpkgsStable.legacyPackages;
};
specialArgs.drv-parts = inputs.drv-parts;
};
in
evaled // evaled.config.final.package;
in {
packages = lib.mapAttrs (_: drvModule: makeDrv drvModule) self.modules.drvs;
};
}