2023-03-13 07:20:09 +03:00
|
|
|
# evaluate packages from `/**/modules/drvs` and export them via `flake.packages`
|
2023-03-12 18:27:22 +03:00
|
|
|
{
|
|
|
|
self,
|
|
|
|
lib,
|
|
|
|
inputs,
|
|
|
|
...
|
2023-03-13 06:44:06 +03:00
|
|
|
}: let
|
|
|
|
system = "x86_64-linux";
|
|
|
|
# A module imported into every package setting up the eval cache
|
2023-03-14 20:33:06 +03:00
|
|
|
setup = {config, ...}: {
|
2023-03-22 07:50:03 +03:00
|
|
|
lock.lockFileRel = "/v1/nix/modules/drvs/${config.name}/lock-${system}.json";
|
2023-03-14 20:33:06 +03:00
|
|
|
lock.repoRoot = self;
|
2023-03-22 07:50:03 +03:00
|
|
|
eval-cache.cacheFileRel = "/v1/nix/modules/drvs/${config.name}/cache-${system}.json";
|
2023-03-13 06:44:06 +03:00
|
|
|
eval-cache.repoRoot = self;
|
|
|
|
eval-cache.enable = true;
|
|
|
|
};
|
2023-02-15 07:26:44 +03:00
|
|
|
|
2023-03-13 06:44:06 +03:00
|
|
|
# evalautes the package behind a given module
|
|
|
|
makeDrv = module: let
|
|
|
|
evaled = lib.evalModules {
|
|
|
|
modules = [
|
|
|
|
inputs.drv-parts.modules.drv-parts.core
|
|
|
|
inputs.drv-parts.modules.drv-parts.docs
|
|
|
|
module
|
|
|
|
../drv-parts/eval-cache
|
2023-03-22 07:50:03 +03:00
|
|
|
../drv-parts/lock
|
2023-03-14 20:33:06 +03:00
|
|
|
setup
|
2023-03-13 06:44:06 +03:00
|
|
|
];
|
|
|
|
specialArgs.dependencySets = {
|
|
|
|
nixpkgs = inputs.nixpkgsV1.legacyPackages.${system};
|
2023-02-11 16:38:53 +03:00
|
|
|
};
|
2023-03-13 06:44:06 +03:00
|
|
|
specialArgs.drv-parts = inputs.drv-parts;
|
|
|
|
};
|
|
|
|
in
|
2023-03-22 07:50:03 +03:00
|
|
|
evaled.config.public;
|
2023-03-22 18:30:58 +03:00
|
|
|
|
|
|
|
packages = lib.mapAttrs (_: drvModule: makeDrv drvModule) self.modules.drvs;
|
|
|
|
|
|
|
|
packagesFiltered =
|
|
|
|
builtins.intersectAttrs
|
|
|
|
{
|
|
|
|
ansible = true;
|
|
|
|
pillow = true;
|
|
|
|
}
|
|
|
|
packages;
|
2023-03-13 06:44:06 +03:00
|
|
|
in {
|
|
|
|
# map all modules in ../drvs to a package output in the flake.
|
2023-03-22 18:30:58 +03:00
|
|
|
flake.packages.${system} = packagesFiltered;
|
2023-02-11 16:38:53 +03:00
|
|
|
}
|