fix(nix): remove flattenAttrs
unfortunately modules don't like to be merged
This commit is contained in:
parent
9abcb6c85b
commit
1dc3f4bf44
3 changed files with 4 additions and 33 deletions
|
@ -6,7 +6,6 @@
|
|||
}:
|
||||
let
|
||||
inherit (lib) nixosSystem;
|
||||
inherit (cfg.lib) flattenAttrs;
|
||||
inherit (lib.attrsets) mapAttrs;
|
||||
cfg = config.flake;
|
||||
hosts = cfg.manifest.hosts or { };
|
||||
|
@ -22,7 +21,7 @@ let
|
|||
hostName = name;
|
||||
};
|
||||
modules = [
|
||||
(flattenAttrs cfg.modules.nixos)
|
||||
cfg.modules.nixos.default
|
||||
(value.extraCfg or { })
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,36 +1,10 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
cfg = config.flake;
|
||||
inherit (lib.attrsets) mapAttrs concatMapAttrs;
|
||||
inherit (lib.attrsets) mapAttrs;
|
||||
in
|
||||
{
|
||||
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.
|
||||
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
{ inputs, config, ... }:
|
||||
let
|
||||
inherit (cfg.lib) forAllUsers' flattenAttrs;
|
||||
inherit (cfg.lib) forAllUsers';
|
||||
cfg = config.flake;
|
||||
hm = inputs.home-manager;
|
||||
globalCfg = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
extraSpecialArgs = { inherit (cfg) manifest; };
|
||||
sharedModules = [
|
||||
(flattenAttrs (cfg.modules.homeManager or { }))
|
||||
];
|
||||
sharedModules = [ cfg.modules.homeManager.default ];
|
||||
users = forAllUsers' (name: _: cfg.homes.${name});
|
||||
};
|
||||
in
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue