2023-11-01 21:42:41 +03:00
|
|
|
{ config, pkgs, lib, secrets, home-manager, ... }:
|
2023-07-16 16:43:13 +03:00
|
|
|
|
2023-10-03 17:15:14 +03:00
|
|
|
let
|
|
|
|
cfg = config.my.users;
|
|
|
|
keys = [
|
|
|
|
# Celerrime
|
2023-11-25 18:13:44 +03:00
|
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF0GX4/09I5B7nVeU3EKw58VyKNsbwpi4KzuJrgpoVfR ivabus@celerrime-x"
|
2023-10-03 17:15:14 +03:00
|
|
|
];
|
2023-08-19 11:06:28 +03:00
|
|
|
in rec {
|
2023-10-03 17:15:14 +03:00
|
|
|
options.my.users = {
|
|
|
|
ivabus.enable = lib.mkEnableOption "Enable ivabus user";
|
|
|
|
user.enable = lib.mkEnableOption "Enable general-purpose user";
|
2023-07-16 16:43:13 +03:00
|
|
|
};
|
2023-10-03 17:15:14 +03:00
|
|
|
config = lib.mkMerge [
|
|
|
|
(lib.mkIf (cfg.ivabus.enable) {
|
|
|
|
my.features.secrets = lib.mkForce true;
|
2023-07-16 16:43:13 +03:00
|
|
|
|
2023-10-03 17:15:14 +03:00
|
|
|
users.groups.ivabus = { gid = 1000; };
|
|
|
|
users.users.ivabus = {
|
|
|
|
isNormalUser = true;
|
|
|
|
group = "ivabus";
|
|
|
|
extraGroups = [ "users" "wheel" ];
|
|
|
|
uid = 1000;
|
|
|
|
packages = with pkgs; [
|
|
|
|
tree
|
|
|
|
neofetch # I use NixOS BTW
|
|
|
|
duf
|
|
|
|
htop
|
|
|
|
];
|
|
|
|
shell = pkgs.zsh;
|
|
|
|
openssh.authorizedKeys.keys = keys;
|
|
|
|
hashedPassword = secrets.hashed-password;
|
|
|
|
};
|
|
|
|
programs.gnupg.agent.enable = true;
|
|
|
|
})
|
2023-08-19 11:06:28 +03:00
|
|
|
|
2023-10-03 17:15:14 +03:00
|
|
|
(lib.mkIf (cfg.user.enable) {
|
|
|
|
users.users.user = {
|
|
|
|
isNormalUser = true;
|
|
|
|
group = "users";
|
|
|
|
extraGroups = [ "video" "audio" "networkmanager" ];
|
|
|
|
uid = 1001;
|
|
|
|
packages = with pkgs; [
|
|
|
|
tree
|
|
|
|
neofetch # I use NixOS BTW
|
|
|
|
duf
|
|
|
|
htop
|
|
|
|
];
|
|
|
|
shell = pkgs.zsh;
|
|
|
|
openssh.authorizedKeys.keys = keys;
|
|
|
|
password = "12345";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
|
|
|
|
({
|
|
|
|
users.mutableUsers = false;
|
|
|
|
users.users.root = {
|
|
|
|
hashedPassword = null;
|
|
|
|
openssh.authorizedKeys.keys = keys;
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.shells = [ pkgs.zsh ];
|
|
|
|
programs.zsh = {
|
|
|
|
enable = true;
|
|
|
|
promptInit = "";
|
|
|
|
};
|
2023-07-16 16:43:13 +03:00
|
|
|
|
2023-10-03 17:15:14 +03:00
|
|
|
programs.ssh.startAgent = true;
|
2023-07-16 16:43:13 +03:00
|
|
|
|
2023-10-03 17:15:14 +03:00
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
|
|
|
})
|
|
|
|
];
|
2023-07-30 09:17:06 +03:00
|
|
|
}
|