user factory

This commit is contained in:
John Lancaster
2026-03-10 23:12:09 -05:00
parent 5e62bcd97c
commit 24c6ac52a7
4 changed files with 59 additions and 30 deletions

View File

@@ -0,0 +1,28 @@
# Lifted from:
# https://github.com/Doc-Steve/dendritic-design-with-flake-parts/blob/69edacdb5a4a6ca71d649bb8eb62cf8c630c8627/modules/users/bob%20%5BNDn%5D/bob.nix#L8
{ self, ... }:
{
config.flake.factory.user = username: isAdmin: {
nixos."${username}" = { lib, pkgs, ... }: {
users.users."${username}" = {
isNormalUser = true;
home = "/home/${username}";
extraGroups = lib.optionals isAdmin [
"input"
"networkmanager"
"wheel"
];
};
home-manager.users."${username}" = {
imports = [
self.modules.homeManager."${username}"
];
};
};
homeManager."${username}" = {
home.username = "${username}";
};
};
}