mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-26 16:03:38 +03:00
chore(flake-parts): use perSystem in packages...
don't hard-core x86_64-linux
This commit is contained in:
parent
2bf52af96a
commit
6d4076f118
@ -1,42 +1,46 @@
|
|||||||
# evaluate packages from `/**/modules/drvs` and export them via `flake.packages`
|
# evaluate packages from `/**/modules/drvs` and export them via `flake.packages`
|
||||||
{
|
{
|
||||||
self,
|
self,
|
||||||
lib,
|
|
||||||
inputs,
|
inputs,
|
||||||
...
|
...
|
||||||
}: let
|
}: {
|
||||||
system = "x86_64-linux";
|
perSystem = {
|
||||||
# A module imported into every package setting up the eval cache
|
system,
|
||||||
setup = {config, ...}: {
|
config,
|
||||||
lock.lockFileRel = "/v1/nix/modules/drvs/${config.name}/lock-${system}.json";
|
lib,
|
||||||
lock.repoRoot = self;
|
pkgs,
|
||||||
eval-cache.cacheFileRel = "/v1/nix/modules/drvs/${config.name}/cache-${system}.json";
|
...
|
||||||
eval-cache.repoRoot = self;
|
}: let
|
||||||
eval-cache.enable = true;
|
# A module imported into every package setting up the eval cache
|
||||||
};
|
setup = {config, ...}: {
|
||||||
|
lock.lockFileRel = "/v1/nix/modules/drvs/${config.name}/lock-${system}.json";
|
||||||
# evalautes the package behind a given module
|
lock.repoRoot = self;
|
||||||
makeDrv = module: let
|
eval-cache.cacheFileRel = "/v1/nix/modules/drvs/${config.name}/cache-${system}.json";
|
||||||
evaled = lib.evalModules {
|
eval-cache.repoRoot = self;
|
||||||
modules = [
|
eval-cache.enable = true;
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
in
|
|
||||||
evaled.config.public;
|
|
||||||
|
|
||||||
packages = lib.mapAttrs (_: drvModule: makeDrv drvModule) self.modules.drvs;
|
# evalautes the package behind a given module
|
||||||
in {
|
makeDrv = module: let
|
||||||
# map all modules in ../drvs to a package output in the flake.
|
evaled = lib.evalModules {
|
||||||
flake.packages.${system} = packages;
|
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;
|
||||||
|
};
|
||||||
|
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;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user