fix(nix): remove flattenAttrs
unfortunately modules don't like to be merged
This commit is contained in:
parent
9781042821
commit
db23edd468
3 changed files with 4 additions and 33 deletions
|
@ -6,7 +6,6 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) nixosSystem;
|
inherit (lib) nixosSystem;
|
||||||
inherit (cfg.lib) flattenAttrs;
|
|
||||||
inherit (lib.attrsets) mapAttrs;
|
inherit (lib.attrsets) mapAttrs;
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
hosts = cfg.manifest.hosts or { };
|
hosts = cfg.manifest.hosts or { };
|
||||||
|
@ -22,7 +21,7 @@ let
|
||||||
hostName = name;
|
hostName = name;
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
(flattenAttrs cfg.modules.nixos)
|
cfg.modules.nixos.default
|
||||||
(value.extraCfg or { })
|
(value.extraCfg or { })
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,10 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
inherit (lib.attrsets) mapAttrs concatMapAttrs;
|
inherit (lib.attrsets) mapAttrs;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.lib = {
|
flake.lib = {
|
||||||
/**
|
|
||||||
Remove the top level attributes from an attribute set and return the merged attributes.
|
|
||||||
|
|
||||||
# Inputs
|
|
||||||
|
|
||||||
`attrset`
|
|
||||||
|
|
||||||
: An attribute set to flatten.
|
|
||||||
|
|
||||||
# Type
|
|
||||||
|
|
||||||
```
|
|
||||||
flattenAttrs :: AttrSet -> AttrSet
|
|
||||||
```
|
|
||||||
|
|
||||||
# Examples
|
|
||||||
:::{.example}
|
|
||||||
## `flattenAttrs` usage example
|
|
||||||
|
|
||||||
```nix
|
|
||||||
flattenAttrs { x = { a = 1; b = 2; }; y = { c = 3; d = 4; }; }
|
|
||||||
=> { a = 1; b = 2; c = 3; d = 4; }
|
|
||||||
```
|
|
||||||
*/
|
|
||||||
flattenAttrs = attrset: concatMapAttrs (_: v: v) attrset;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Return an attribute set for use with a option that needs to be used for all users.
|
Return an attribute set for use with a option that needs to be used for all users.
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
{ inputs, config, ... }:
|
{ inputs, config, ... }:
|
||||||
let
|
let
|
||||||
inherit (cfg.lib) forAllUsers' flattenAttrs;
|
inherit (cfg.lib) forAllUsers';
|
||||||
cfg = config.flake;
|
cfg = config.flake;
|
||||||
hm = inputs.home-manager;
|
hm = inputs.home-manager;
|
||||||
globalCfg = {
|
globalCfg = {
|
||||||
useGlobalPkgs = true;
|
useGlobalPkgs = true;
|
||||||
useUserPackages = true;
|
useUserPackages = true;
|
||||||
extraSpecialArgs = { inherit (cfg) manifest; };
|
extraSpecialArgs = { inherit (cfg) manifest; };
|
||||||
sharedModules = [
|
sharedModules = [ cfg.modules.homeManager.default ];
|
||||||
(flattenAttrs (cfg.modules.homeManager or { }))
|
|
||||||
];
|
|
||||||
users = forAllUsers' (name: _: cfg.homes.${name});
|
users = forAllUsers' (name: _: cfg.homes.${name});
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue