diff --git a/containers/shared.nix b/containers/shared.nix index 123727fb..1768735b 100644 --- a/containers/shared.nix +++ b/containers/shared.nix @@ -1,5 +1,8 @@ -{ pkgs, ... }: +{ pkgs, lib, config, ... }: +let + inherit (config.modules.system) username; +in { imports = [ ../modules/fish.nix @@ -52,11 +55,9 @@ users = { allowNoPasswordLogin = true; - users = { - user = { - password = lib.mkForce null; - extraGroups = lib.mkForce [ ]; - }; + users.${username} = { + password = lib.mkForce null; + extraGroups = lib.mkForce [ ]; }; }; diff --git a/modules/desktop.nix b/modules/desktop.nix index 0f5504a2..91cd7c60 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -4,6 +4,7 @@ let inherit (lib) mkEnableOption mkIf; inherit (pkgs.xfce) thunar-volman exo; inherit (pkgs) glib; + inherit (config.modules.system) username; theme = "monokai"; opacity = 0.95; @@ -100,7 +101,7 @@ in initial_session = { command = "${pkgs.hyprland}/bin/Hyprland"; - user = "user"; + user = username; }; }; }; diff --git a/modules/system.nix b/modules/system.nix index 12ee557c..2ccf97a3 100644 --- a/modules/system.nix +++ b/modules/system.nix @@ -4,11 +4,17 @@ let inherit (lib) mkOption; inherit (lib.types) str listOf; inherit (pkgs.nixVersions) nix_2_19; + inherit (cfg) username; cfg = config.modules.system; in { options.modules.system = { + username = mkOption { + type = str; + default = "user"; + }; + timeZone = mkOption { type = str; default = "America/New_York"; @@ -81,13 +87,11 @@ in users = { mutableUsers = false; - users = { - user = { - isNormalUser = true; - uid = 1000; - password = "user"; - extraGroups = [ "wheel" "networkmanager" ]; - }; + users.${username} = { + isNormalUser = true; + uid = 1000; + password = "user"; + extraGroups = [ "wheel" "networkmanager" ]; }; }; @@ -100,11 +104,10 @@ in programs.man.generateCaches = true; }]; - users = { - user = { - home.username = "user"; - home.homeDirectory = "/home/user"; - }; + users.${username}.home = { + inherit username; + + homeDirectory = "/home/${username}"; }; }; }; diff --git a/specializations/gnome.nix b/specializations/gnome.nix index 03cc3a02..d0d6f60f 100644 --- a/specializations/gnome.nix +++ b/specializations/gnome.nix @@ -1,5 +1,8 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, config, ... }: +let + inherit (config.modules.system) username; +in { services.xserver = { enable = true; @@ -13,7 +16,7 @@ autoLogin = { enable = true; - user = "user"; + user = username; }; }; diff --git a/specializations/plasma.nix b/specializations/plasma.nix index b1261f09..f52a4539 100644 --- a/specializations/plasma.nix +++ b/specializations/plasma.nix @@ -1,5 +1,8 @@ -{ pkgs, lib, ... }: +{ pkgs, lib, config, ... }: +let + inherit (config.modules.system) username; +in { services.xserver = { enable = true; @@ -9,7 +12,7 @@ autoLogin = { enable = true; - user = "user"; + user = username; }; };