mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-24 23:14:12 +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`
|
||||
{
|
||||
self,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
system = "x86_64-linux";
|
||||
# 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;
|
||||
};
|
||||
|
||||
# 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;
|
||||
}: {
|
||||
perSystem = {
|
||||
system,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: 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;
|
||||
};
|
||||
in
|
||||
evaled.config.public;
|
||||
|
||||
packages = lib.mapAttrs (_: drvModule: makeDrv drvModule) self.modules.drvs;
|
||||
in {
|
||||
# map all modules in ../drvs to a package output in the flake.
|
||||
flake.packages.${system} = packages;
|
||||
# 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;
|
||||
};
|
||||
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