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,
|
|
|
|
inputs,
|
|
|
|
...
|
2023-04-18 14:41:43 +03:00
|
|
|
}: {
|
|
|
|
perSystem = {
|
|
|
|
system,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
2023-04-18 16:34:55 +03:00
|
|
|
}:
|
|
|
|
if system != "x86_64-linux"
|
|
|
|
then {}
|
|
|
|
else let
|
|
|
|
# A module imported into every package setting up the eval cache
|
|
|
|
setup = {config, ...}: {
|
|
|
|
lock.lockFileRel = "/v1/nix/modules/drvs/${config.name}/lock-${system}.json";
|
|
|
|
lock.repoRoot = self;
|
|
|
|
eval-cache.cacheFileRel = "/v1/nix/modules/drvs/${config.name}/cache-${system}.json";
|
|
|
|
eval-cache.repoRoot = self;
|
|
|
|
eval-cache.enable = true;
|
|
|
|
};
|
2023-03-22 18:30:58 +03:00
|
|
|
|
2023-04-18 16:34:55 +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
|
|
|
|
../drv-parts/lock
|
|
|
|
setup
|
|
|
|
];
|
|
|
|
specialArgs.packageSets = {
|
|
|
|
nixpkgs = inputs.nixpkgsV1.legacyPackages.${system};
|
|
|
|
};
|
|
|
|
specialArgs.drv-parts = inputs.drv-parts;
|
|
|
|
specialArgs.dream2nix = self;
|
2023-04-18 14:41:43 +03:00
|
|
|
};
|
2023-04-18 16:34:55 +03:00
|
|
|
in
|
|
|
|
evaled.config.public;
|
|
|
|
in {
|
|
|
|
# map all modules in ../drvs to a package output in the flake.
|
|
|
|
packages = lib.mapAttrs (_: drvModule: makeDrv drvModule) self.modules.drvs;
|
|
|
|
};
|
2023-02-11 16:38:53 +03:00
|
|
|
}
|