diff --git a/flake-parts/hosts.nix b/flake-parts/hosts.nix index ffa40f8..a99ca4a 100644 --- a/flake-parts/hosts.nix +++ b/flake-parts/hosts.nix @@ -9,15 +9,14 @@ let hostName: inputs.nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs self; }; - modules = - (lib.singleton { networking = { inherit hostName; }; }) - ++ ( - "${self}/hosts/${hostName}" - |> builtins.readDir - |> lib.attrNames - |> lib.filter (file: file |> lib.hasSuffix ".nix") - |> lib.map (file: "${self}/hosts/${hostName}/${file}") - ); + modules = [ + { networking = { inherit hostName; }; } + "${self}/hosts/${hostName}/default.nix" + "${self}/hosts/${hostName}/hardware.nix" + "${self}/hosts/${hostName}/disko.nix" + "${self}/users/seb" + ] + ++ lib.optional (lib.pathExists "${self}/users/seb/@${hostName}") "${self}/users/seb/@${hostName}"; }; in { diff --git a/justfile b/justfile index 0eb077f..74dca9a 100644 --- a/justfile +++ b/justfile @@ -41,7 +41,7 @@ reboot: [group('remote')] deploy +hosts: for host in {{ hosts }}; do \ - nh os switch . --hostname=$host --target-host=$host; \ + nh os switch . --hostname=$host --target-host=$host; \ done [group('remote')] @@ -69,9 +69,4 @@ sops-rotate-all: just _sops-do "find . -type f -name 'secrets.json' -exec sops rotate --in-place {} \;" _sops-do command: - if command -v sops > /dev/null 2>&1; then \ - {{ command }}; \ - else \ - nix develop .#sops --command bash -c "{{ command }}; \ - exec zsh"; \ - fi + -if command -v sops >/dev/null 2>&1; then {{ command }}; else nix develop .#sops --command bash -c "{{ command }}; exec zsh"; fi diff --git a/profiles/core.nix b/profiles/core.nix index 9b1850c..6f0e790 100644 --- a/profiles/core.nix +++ b/profiles/core.nix @@ -68,16 +68,7 @@ console.keyMap = "de-latin1-nodeadkeys"; - sops.secrets."seb-password".neededForUsers = true; - users = { - mutableUsers = false; - users.seb = { - isNormalUser = true; - description = "Sebastian Stork"; - hashedPasswordFile = config.sops.secrets."seb-password".path; - extraGroups = [ "wheel" ]; - }; - }; + users.mutableUsers = false; programs.neovim = { enable = true; diff --git a/profiles/workstation.nix b/profiles/workstation.nix index 5c722c9..714740c 100644 --- a/profiles/workstation.nix +++ b/profiles/workstation.nix @@ -1,16 +1,6 @@ +{ self, pkgs, ... }: { - config, - inputs, - self, - pkgs, - pkgs-unstable, - ... -}: -{ - imports = [ - self.nixosModules.profile-core - inputs.home-manager.nixosModules.home-manager - ]; + imports = [ self.nixosModules.profile-core ]; boot.kernelPackages = pkgs.linuxPackages_latest; @@ -29,14 +19,4 @@ }; programs.localsend.enable = true; - - programs.zsh.enable = true; - users.users.seb.shell = pkgs.zsh; - - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = { inherit inputs self pkgs-unstable; }; - users.seb = "${self}/users/seb/@${config.networking.hostName}/home.nix"; - }; } diff --git a/users/home-manager.nix b/users/home-manager.nix new file mode 100644 index 0000000..8a5bbe5 --- /dev/null +++ b/users/home-manager.nix @@ -0,0 +1,17 @@ +{ + inputs, + self, + pkgs-unstable, + ... +}: +{ + imports = [ inputs.home-manager.nixosModules.home-manager ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit inputs self pkgs-unstable; + }; + }; +} diff --git a/users/seb/@desktop/default.nix b/users/seb/@desktop/default.nix new file mode 100644 index 0000000..1de054e --- /dev/null +++ b/users/seb/@desktop/default.nix @@ -0,0 +1,8 @@ +{ self, pkgs, ... }: +{ + imports = [ "${self}/users/home-manager.nix" ]; + home-manager.users.seb = ./home.nix; + + users.users.seb.shell = pkgs.zsh; + programs.zsh.enable = true; +} diff --git a/users/seb/@laptop/default.nix b/users/seb/@laptop/default.nix new file mode 100644 index 0000000..1de054e --- /dev/null +++ b/users/seb/@laptop/default.nix @@ -0,0 +1,8 @@ +{ self, pkgs, ... }: +{ + imports = [ "${self}/users/home-manager.nix" ]; + home-manager.users.seb = ./home.nix; + + users.users.seb.shell = pkgs.zsh; + programs.zsh.enable = true; +} diff --git a/users/seb/default.nix b/users/seb/default.nix new file mode 100644 index 0000000..8ea413f --- /dev/null +++ b/users/seb/default.nix @@ -0,0 +1,11 @@ +{ config, ... }: +{ + sops.secrets."seb-password".neededForUsers = true; + + users.users.seb = { + isNormalUser = true; + description = "Sebastian Stork"; + hashedPasswordFile = config.sops.secrets."seb-password".path; + extraGroups = [ "wheel" ]; + }; +}