From e59d580d37f88d996e13f208e9aeb593503a6e1d Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Fri, 28 Jun 2024 19:36:23 -0400 Subject: [PATCH] move user home-manager declarations to nixosModules --- hosts/fallarbor/home.nix | 4 ---- hosts/lavaridge/home.nix | 1 - hosts/mandarin/home.nix | 2 -- hosts/mauville/home.nix | 3 +-- hosts/petalburg/home.nix | 1 - hosts/rustboro/home.nix | 1 - nixosModules/options.nix | 26 +++++++++++++++++++++++++- nixosModules/users/aly/default.nix | 10 +++++++--- nixosModules/users/dustin/default.nix | 11 ++++++++--- nixosModules/users/morgan/default.nix | 11 ++++++++--- 10 files changed, 49 insertions(+), 21 deletions(-) diff --git a/hosts/fallarbor/home.nix b/hosts/fallarbor/home.nix index 3831ea0c..c83c3007 100644 --- a/hosts/fallarbor/home.nix +++ b/hosts/fallarbor/home.nix @@ -5,8 +5,4 @@ pkgs, ... }: { - home-manager = { - users.aly = import ../../homes/aly; - users.dustin = import ../../homes/dustin; - }; } diff --git a/hosts/lavaridge/home.nix b/hosts/lavaridge/home.nix index cb899ba4..b085e592 100644 --- a/hosts/lavaridge/home.nix +++ b/hosts/lavaridge/home.nix @@ -16,6 +16,5 @@ }; } ]; - users.aly = import ../../homes/aly; }; } diff --git a/hosts/mandarin/home.nix b/hosts/mandarin/home.nix index 9ddd117b..80acb3f1 100644 --- a/hosts/mandarin/home.nix +++ b/hosts/mandarin/home.nix @@ -16,7 +16,5 @@ }; } ]; - users.aly = import ../../homes/aly; - users.morgan = import ../../homes/morgan; }; } diff --git a/hosts/mauville/home.nix b/hosts/mauville/home.nix index ea04e6db..96c91c50 100644 --- a/hosts/mauville/home.nix +++ b/hosts/mauville/home.nix @@ -63,7 +63,7 @@ } ]; - users.aly = { + users.aly = lib.mkForce { imports = [../../homes/aly]; systemd.user = { services = { @@ -141,6 +141,5 @@ }; }; }; - users.dustin = import ../../homes/dustin; }; } diff --git a/hosts/petalburg/home.nix b/hosts/petalburg/home.nix index 84245469..958d44aa 100644 --- a/hosts/petalburg/home.nix +++ b/hosts/petalburg/home.nix @@ -16,6 +16,5 @@ ''; } ]; - users.aly = import ../../homes/aly; }; } diff --git a/hosts/rustboro/home.nix b/hosts/rustboro/home.nix index d1ac1557..82ee9a23 100644 --- a/hosts/rustboro/home.nix +++ b/hosts/rustboro/home.nix @@ -24,6 +24,5 @@ }; } ]; - users.aly = import ../../homes/aly; }; } diff --git a/nixosModules/options.nix b/nixosModules/options.nix index 8a285810..f15930cc 100644 --- a/nixosModules/options.nix +++ b/nixosModules/options.nix @@ -254,29 +254,53 @@ type = lib.types.bool; }; size = lib.mkOption { - description = "Percent size of the zram swap relative to RAM."; + description = "zram swap size relative to RAM."; default = 50; type = lib.types.int; }; }; }; + users = { aly = { enable = lib.mkEnableOption "Aly's user."; + + manageHome = lib.mkOption { + description = "Whether to enable aly's home directory."; + type = lib.types.bool; + default = config.ar.users.aly.enable; + }; + password = lib.mkOption { description = "Hashed password for aly."; type = lib.types.str; }; }; + dustin = { enable = lib.mkEnableOption "Dustin's user."; + + manageHome = lib.mkOption { + description = "Whether to manage dustin's home directory."; + type = lib.types.bool; + default = config.ar.users.dustin.enable; + }; + password = lib.mkOption { description = "Hashed password for dustin."; type = lib.types.str; }; }; + morgan = { enable = lib.mkEnableOption "Morgan's user."; + + manageHome = lib.mkOption { + description = "Whether to manage morgan's home directory."; + type = lib.types.bool; + default = config.ar.users.morgan.enable; + }; + password = lib.mkOption { description = "Hashed password for morgan."; type = lib.types.str; diff --git a/nixosModules/users/aly/default.nix b/nixosModules/users/aly/default.nix index 9aad36bf..9b92cbb5 100644 --- a/nixosModules/users/aly/default.nix +++ b/nixosModules/users/aly/default.nix @@ -1,11 +1,15 @@ { - inputs, - pkgs, - lib, config, + lib, + pkgs, ... }: { config = lib.mkIf config.ar.users.aly.enable { + home-manager.users.aly = + if config.ar.users.aly.manageHome + then import ../../../homes/aly + else {}; + users.users.aly = { description = "Aly Raffauf"; extraGroups = ["networkmanager" "wheel" "docker" "libvirtd" "video"]; diff --git a/nixosModules/users/dustin/default.nix b/nixosModules/users/dustin/default.nix index 2f8bbeba..48b2337f 100644 --- a/nixosModules/users/dustin/default.nix +++ b/nixosModules/users/dustin/default.nix @@ -1,15 +1,20 @@ { - inputs, - pkgs, - lib, config, + lib, + pkgs, ... }: { config = lib.mkIf config.ar.users.dustin.enable { + home-manager.users.dustin = + if config.ar.users.dustin.manageHome + then import ../../../homes/dustin + else {}; + users.users.dustin = { description = "Dustin Raffauf"; extraGroups = ["networkmanager" "wheel" "docker" "libvirtd" "video"]; hashedPassword = config.ar.users.dustin.password; + isNormalUser = true; uid = 1001; }; diff --git a/nixosModules/users/morgan/default.nix b/nixosModules/users/morgan/default.nix index 751f66c2..09387420 100644 --- a/nixosModules/users/morgan/default.nix +++ b/nixosModules/users/morgan/default.nix @@ -1,15 +1,20 @@ { - inputs, - pkgs, - lib, config, + lib, + pkgs, ... }: { config = lib.mkIf config.ar.users.morgan.enable { + home-manager.users.morgan = + if config.ar.users.morgan.manageHome + then import ../../../homes/morgan + else {}; + users.users.morgan = { description = "Morgan Tamayo"; extraGroups = ["networkmanager" "wheel" "docker" "libvirtd" "video"]; hashedPassword = config.ar.users.morgan.password; + isNormalUser = true; uid = 1002; };