diff options
Diffstat (limited to 'infra/libkookie/modules/harness/users.nix')
-rw-r--r-- | infra/libkookie/modules/harness/users.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/infra/libkookie/modules/harness/users.nix b/infra/libkookie/modules/harness/users.nix new file mode 100644 index 000000000000..d663ec38d1aa --- /dev/null +++ b/infra/libkookie/modules/harness/users.nix @@ -0,0 +1,42 @@ +{ config, lib, pkgs, ... }: + +let cfg = config.libkookie; +in +{ + options.libkookie = { + activeUsers = with lib; mkOption { + type = with types; listOf str; + default = []; + description = '' + List of active users on this system. This is relevant for what + userspace tools get installed, and what SSH pubkeys are included. + ''; + }; + + userPath = with lib; mkOption { + type = types.path; + default = null; + description = '' + Base path to the user definitions. Because of the way that + libkookie is structured, user declarations don't like in the + ./module tree, but instead should be kept in the ./config tree. + + This way, the separation between the actual modules, and system + configuration for a particular system remains intact. + ''; + }; + }; + + config = { + users.mutableUsers = false; + users.users = (with lib; + let + pathify = with builtins; + name: cfg.userPath + (toPath "/" + name + ".nix"); + include = path: import path { inherit pkgs lib; }; + in + listToAttrs (map + (name: nameValuePair name (include (pathify name))) + cfg.activeUsers)); + }; +} |