From d3305f1e761a0f8774f8d1f146961b0df622f0a3 Mon Sep 17 00:00:00 2001 From: ahwx Date: Fri, 27 Feb 2026 00:52:11 +0100 Subject: [PATCH] chore: move linux specific things to `user-linux.nix` --- modules/core/user-linux.nix | 22 +++++++++++++++++ modules/core/user.nix | 49 +++++++++++++++++++++---------------- 2 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 modules/core/user-linux.nix diff --git a/modules/core/user-linux.nix b/modules/core/user-linux.nix new file mode 100644 index 0000000..4bfa680 --- /dev/null +++ b/modules/core/user-linux.nix @@ -0,0 +1,22 @@ +{ username, ... }: +{ + users.users.${username} = { + isNormalUser = true; + extraGroups = [ + "networkmanager" + "wheel" + "docker" + "input" + "dialout" + "wheel" + ]; + initialPassword = "temporary-password"; + }; + + home-manager = { + inherit username; + homeDirectory = "/home/${username}"; + }; + + fonts.fontconfig.antialias = false; +} diff --git a/modules/core/user.nix b/modules/core/user.nix index aa2c3ec..51f83a4 100644 --- a/modules/core/user.nix +++ b/modules/core/user.nix @@ -1,18 +1,26 @@ { pkgs, inputs, - config, username, host, + lib, + system, ... }: { imports = - [ inputs.home-manager.nixosModules.home-manager ] - ++ [ ./../../roles/default.nix ] - ++ [ ./sops.nix ] + (lib.optionals (system == "x64_64-linux") [ inputs.home-manager.nixosModules.home-manager ]) + ++ (lib.optionals (system == "aarch64-darwin") [ inputs.home-manager.darwinModules.home-manager ]) + ++ (lib.optionals (system == "x64_64-linux") [ ./../../roles/default.nix ]) + ++ (lib.optionals (system == "aarch64-linux") [ ./../../roles/default.nix ]) + ++ (lib.optionals (system == "x64_64-linux") [ ./user-linux.nix ]) + ++ (lib.optionals (system == "aarch64-linux") [ ./user-linux.nix ]) + ++ (lib.optionals (system == "x64_64-linux") [ ./sops.nix ]) + ++ (lib.optionals (system == "aarch64-linux") [ ./sops.nix ]) ++ [ ./../../variables.nix ]; + home-manager = { + backupFileExtension = "bak"; useUserPackages = true; useGlobalPkgs = true; extraSpecialArgs = { inherit inputs username host; }; @@ -30,34 +38,33 @@ [ ./../home/default.server.nix ] else if (host == "daisy") then [ ./../home/default.server.nix ] - # else if (host == "yoshino") then - # [ ./../home/default.nix ] + else if (system == "aarch64-darwin") then + [ ./../home/default.azalea.nix ] else [ ./../home ]; home = { - username = "${username}"; - homeDirectory = "/home/${username}"; + username = "liv"; stateVersion = "22.11"; + sessionVariables = { + EDITOR = "nvim"; + VISUAL = "nvim"; + PAGER = "less"; + }; }; programs.home-manager.enable = true; }; }; - fonts.fontconfig.antialias = false; - users.users.${username} = { - isNormalUser = true; - description = "${username}"; - extraGroups = [ - "networkmanager" - "wheel" - "docker" - "input" - "dialout" - "wheel" - ]; + home = + if (system == "x64_64-linux") then + "/home/${username}" + else if (system == "aarch64-darwin") then + "/Users/${username}" + else + "/home/${username}"; shell = pkgs.zsh; - initialPassword = "temporary-password"; + description = "ahwx"; }; nix.settings.allowed-users = [ "${username}" ]; }