feat(lib): add admin user using custom lib function
This commit is contained in:
parent
da6fa1b9df
commit
5d24a11990
2 changed files with 71 additions and 1 deletions
|
@ -1,8 +1,16 @@
|
|||
{ lib, inputs, ... }:
|
||||
{
|
||||
lib,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) path lazyAttrsOf raw;
|
||||
inherit (inputs.flake-parts.lib) mkSubmoduleOptions;
|
||||
inherit (cfg.lib.attrsets) firstAttrNameMatching;
|
||||
cfg = config.flake;
|
||||
username = firstAttrNameMatching (_: v: v.primary or false) cfg.manifest.users;
|
||||
in
|
||||
{
|
||||
options.flake = mkSubmoduleOptions {
|
||||
|
@ -14,5 +22,13 @@ in
|
|||
type = path;
|
||||
default = "";
|
||||
};
|
||||
admin = mkOption {
|
||||
type = lazyAttrsOf raw;
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
|
||||
config.flake.admin = cfg.manifest.users.${username} // {
|
||||
inherit username;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue