users: enable users per-host

This commit is contained in:
Katherina Walshe-Grey 2024-11-14 13:42:36 +00:00
parent 80fcd62ba4
commit d69e1dcc16
10 changed files with 72 additions and 30 deletions

View file

@ -2,7 +2,7 @@
imports = [
./qenya.nix
./randomcat.nix
./richard.nix
./trungle.nix
];
users.mutableUsers = false;

View file

@ -1,16 +1,28 @@
{ config, lib, pkgs, self, ... }:
let keys = import ../../keys.nix;
in {
users.users.qenya = {
isNormalUser = true;
home = "/home/qenya";
shell = pkgs.zsh;
openssh.authorizedKeys.keys = keys.users.qenya;
uid = 1001;
let
inherit (lib) mkIf mkEnableOption;
keys = import ../../keys.nix;
cfg = config.fountain.users.qenya;
in
{
options.fountain.users.qenya = {
enable = mkEnableOption "user qenya";
};
programs.zsh.enable = true;
config = mkIf cfg.enable {
users.users.qenya = {
uid = 1001;
isNormalUser = true;
group = "qenya";
shell = pkgs.zsh;
openssh.authorizedKeys.keys = keys.users.qenya;
};
home-manager.users."qenya" = self.homeManagerModules."qenya";
users.groups.qenya.gid = config.users.users.qenya.uid;
programs.zsh.enable = true;
home-manager.users."qenya" = self.homeManagerModules."qenya";
};
}

View file

@ -1,12 +1,23 @@
{ config, lib, pkgs, ... }:
let keys = import ../../keys.nix;
let
inherit (lib) mkIf mkEnableOption;
keys = import ../../keys.nix;
cfg = config.fountain.users.randomcat;
in
{
users.users.randomcat = {
isNormalUser = true;
home = "/home/randomcat";
openssh.authorizedKeys.keys = keys.users.randomcat;
uid = 1003;
options.fountain.users.randomcat = {
enable = mkEnableOption "user randomcat";
};
}
config = mkIf cfg.enable {
users.users.randomcat = {
uid = 1000;
isNormalUser = true;
group = "randomcat";
openssh.authorizedKeys.keys = keys.users.randomcat;
};
users.groups.randomcat.gid = config.users.users.randomcat.uid;
};
}

View file

@ -1,12 +0,0 @@
{ config, lib, pkgs, ... }:
let keys = import ../../keys.nix;
in
{
users.users.richard = {
isNormalUser = true;
home = "/home/richard";
openssh.authorizedKeys.keys = keys.users.trungle;
uid = 1002;
};
}

23
common/users/trungle.nix Normal file
View file

@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkEnableOption;
keys = import ../../keys.nix;
cfg = config.fountain.users.trungle;
in
{
options.fountain.users.trungle = {
enable = mkEnableOption "user trungle";
};
config = mkIf cfg.enable {
users.users.trungle = {
uid = 1002;
isNormalUser = true;
group = "trungle";
openssh.authorizedKeys.keys = keys.users.trungle;
};
users.groups.trungle.gid = config.users.users.trungle.uid;
};
}