mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git
synced 2025-01-09 09:21:04 +00:00
flake: abort on missing configPathsNeeded with message
This commit is contained in:
parent
600d8f427d
commit
4cbe63ac64
12
flake.nix
12
flake.nix
|
@ -41,10 +41,12 @@
|
||||||
++
|
++
|
||||||
# add SP modules, but contrain available config attributes for each
|
# add SP modules, but contrain available config attributes for each
|
||||||
# (TODO revise evaluation performance of the code below)
|
# (TODO revise evaluation performance of the code below)
|
||||||
map
|
nixpkgs.lib.attrsets.mapAttrsToList
|
||||||
(sp-module: args@{ config, pkgs, ... }:
|
(name: sp-module: args@{ config, pkgs, ... }:
|
||||||
let
|
let
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
|
configPathsNeeded = sp-module.configPathsNeeded or
|
||||||
|
(abort "allowed config paths not set for module \"${name}\"");
|
||||||
constrainConfigArgs = args'@{ pkgs, ... }: args' // {
|
constrainConfigArgs = args'@{ pkgs, ... }: args' // {
|
||||||
config =
|
config =
|
||||||
# TODO use lib.attrsets.mergeAttrsList from nixpkgs 23.05
|
# TODO use lib.attrsets.mergeAttrsList from nixpkgs 23.05
|
||||||
|
@ -52,7 +54,9 @@
|
||||||
(map
|
(map
|
||||||
(p: lib.attrsets.setAttrByPath p
|
(p: lib.attrsets.setAttrByPath p
|
||||||
(lib.attrsets.getAttrFromPath p config))
|
(lib.attrsets.getAttrFromPath p config))
|
||||||
sp-module.configPathsNeeded));
|
configPathsNeeded
|
||||||
|
)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
constrainImportsArgsRecursive = lib.attrsets.mapAttrsRecursive
|
constrainImportsArgsRecursive = lib.attrsets.mapAttrsRecursive
|
||||||
(p: v:
|
(p: v:
|
||||||
|
@ -76,7 +80,7 @@
|
||||||
constrainImportsArgsRecursive
|
constrainImportsArgsRecursive
|
||||||
(sp-module.nixosModules.default (constrainConfigArgs args))
|
(sp-module.nixosModules.default (constrainConfigArgs args))
|
||||||
)
|
)
|
||||||
(nixpkgs.lib.attrsets.attrValues sp-modules);
|
sp-modules;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
|
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
|
||||||
|
|
Loading…
Reference in a new issue