feat(nixos): pass flakeConfig to nixosSystem specialArgs
This commit is contained in:
parent
88318c2e39
commit
c9636b0bfa
2 changed files with 14 additions and 6 deletions
|
@ -8,20 +8,29 @@ let
|
|||
inherit (lib.trivial) pipe;
|
||||
inherit (lib.attrsets) filterAttrs mapAttrs';
|
||||
inherit (lib.strings) removePrefix hasPrefix;
|
||||
cfg = config.flake;
|
||||
prefix = "nixos/";
|
||||
hosts = config.flake.hostSpec.hosts or { };
|
||||
hosts = cfg.hostSpec.hosts or { };
|
||||
mkSystem =
|
||||
name: value:
|
||||
let
|
||||
hostName = removePrefix prefix name;
|
||||
hostConfig = value;
|
||||
flakeConfig = config;
|
||||
in
|
||||
{
|
||||
name = hostName;
|
||||
value = lib.nixosSystem {
|
||||
specialArgs = { inherit inputs hostName hostConfig; };
|
||||
specialArgs = {
|
||||
inherit
|
||||
inputs
|
||||
hostName
|
||||
hostConfig
|
||||
flakeConfig
|
||||
;
|
||||
};
|
||||
modules = [
|
||||
config.flake.profiles.nixos.common
|
||||
cfg.profiles.nixos.common
|
||||
(value.extraCfg or { })
|
||||
] ++ (value.profiles or [ ]);
|
||||
};
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.modules) mkMerge;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
inherit (lib.attrsets) concatMapAttrs;
|
||||
in
|
||||
{
|
||||
flake.lib = {
|
||||
flattenAttrs = attrset: mkMerge (mapAttrsToList (_: v: v) attrset);
|
||||
flattenAttrs = attrset: concatMapAttrs (_: v: v) attrset;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue