Last active
January 27, 2025 20:59
-
-
Save isabelroses/7c69dc97d07431292898fec34ffa781b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# try it yourself with: | |
# nix eval --file eval.nix config.users.users.alice --show-trace | |
import <nixpkgs/nixos> { | |
configuration = | |
{ | |
lib, | |
pkgs, | |
config, | |
options, | |
... | |
}: | |
{ | |
imports = [ | |
{ | |
options.meow = { | |
users = lib.mkOption { | |
type = lib.types.listOf lib.types.str; | |
default = [ ]; | |
}; | |
defaultUserSettings = lib.mkOption { | |
inherit (options.users.users) type; | |
default = { }; | |
}; | |
}; | |
} | |
{ | |
config = { | |
meow = { | |
users = [ | |
"alice" | |
"bob" | |
]; | |
defaultUserSettings = { | |
shell = pkgs.fish; | |
}; | |
}; | |
users.users = lib.genAttrs config.meow.users ( | |
name: config.meow.defaultUserSettings // { inherit name; } | |
); | |
}; | |
} | |
]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment