diff --git a/hosts/default.nix b/hosts/default.nix index 7815d7c..3be311a 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,6 +1,7 @@ { x1g9 = { system = "x86_64-linux"; + stateVersion = "26.05"; user = "moons"; path = ./x1g9; diff --git a/hosts/x1g9/nixos.nix b/hosts/x1g9/nixos.nix index 0b31a81..83548c1 100644 --- a/hosts/x1g9/nixos.nix +++ b/hosts/x1g9/nixos.nix @@ -2,6 +2,4 @@ imports = [ ./hardware.nix ]; - - system.stateVersion = "26.05"; } diff --git a/libs/hosts.nix b/libs/hosts.nix index d69bfc1..4236472 100644 --- a/libs/hosts.nix +++ b/libs/hosts.nix @@ -37,16 +37,25 @@ let "${name}: path must name an existing host directory" ( ensure - (lib.all - (field: builtins.isList (spec.${field} or [ ]) && lib.all builtins.isString (spec.${field} or [ ])) - [ - "profiles" - "applications" - "units" - ] + ( + spec ? stateVersion + && builtins.isString spec.stateVersion + && builtins.match "[0-9][0-9]\\.[0-9][0-9]" spec.stateVersion != null + ) + "${name}: stateVersion is required and must have the form YY.MM" + ( + ensure + (lib.all + (field: builtins.isList (spec.${field} or [ ]) && lib.all builtins.isString (spec.${field} or [ ])) + [ + "profiles" + "applications" + "units" + ] + ) + "${name}: profiles, applications, and units must be lists of strings" + (ensure (builtins.isBool (spec.homeManager or true)) "${name}: homeManager must be a boolean" spec) ) - "${name}: profiles, applications, and units must be lists of strings" - (ensure (builtins.isBool (spec.homeManager or true)) "${name}: homeManager must be a boolean" spec) ) ) ) @@ -67,6 +76,7 @@ let homeModules = [ (registry.mkModule { class = "home"; }) (registry.mkSelectionModule selected) + { home.stateVersion = spec.stateVersion; } ] ++ lib.optional (homePath != null) homePath; in @@ -88,6 +98,7 @@ let homeModules = [ (registry.mkModule { class = "home"; }) (registry.mkSelectionModule selected) + { home.stateVersion = spec.stateVersion; } ] ++ lib.optional (homePath != null) homePath; in @@ -111,7 +122,10 @@ let modules = [ (registry.mkModule { class = "nixos"; }) (registry.mkSelectionModule selected) - { networking.hostName = lib.mkDefault name; } + { + networking.hostName = lib.mkDefault name; + system.stateVersion = spec.stateVersion; + } ] ++ lib.optional (spec.homeManager or true) (mkHomeManagerModule name spec selected) ++ lib.optional (nixosPath != null) nixosPath; diff --git a/modules/users/moons/home.nix b/modules/users/moons/home.nix index cd1cb30..2abe851 100644 --- a/modules/users/moons/home.nix +++ b/modules/users/moons/home.nix @@ -3,7 +3,6 @@ home = { username = primaryUser; homeDirectory = "/home/${primaryUser}"; - stateVersion = "26.05"; }; programs.home-manager.enable = true; diff --git a/modules/users/moons/nixos.nix b/modules/users/moons/nixos.nix index 2f49e94..3937da8 100644 --- a/modules/users/moons/nixos.nix +++ b/modules/users/moons/nixos.nix @@ -1,12 +1,29 @@ -{ primaryUser, ... }: +{ primaryUser, pkgs, ... }: { users.users.${primaryUser} = { isNormalUser = true; description = "moons"; extraGroups = [ + "adbusers" + "docker" + "libvirtd" + "lp" "networkmanager" + "scanner" "wheel" + "vboxusers" + "dialout" ]; + + shell = pkgs.zsh; + ignoreShellProgramCheck = true; + + openssh.authorizedKeys.keys = [ + "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIKhxDkucmeCor6CKoXAua7DgDSzuXrZOtpdkyzQxz5+aAAAABHNzaDo= moons@moons14.com" + "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIN6hZJyng/5LgFKPjR6uZAd/00UkO0vN0uQOoIvfSELdAAAABHNzaDo= moons@moons14.com" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPLwReAiwhXoO34S2+MrvqUhi8IWp4IzUq4OSp3niJdq" + ]; + }; nix.settings = { diff --git a/overlays/default.nix b/overlays/default.nix index e4f8a7d..2c63c08 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,6 +1,2 @@ -{ inputs, ... }: { - flake.overlays.default = _final: prev: { - llm-agents = inputs.llm-agents.packages.${prev.stdenv.hostPlatform.system}; - }; } diff --git a/tests/fixtures/registry/hosts/nixos.nix b/tests/fixtures/registry/hosts/nixos.nix index 3df8577..b057af4 100644 --- a/tests/fixtures/registry/hosts/nixos.nix +++ b/tests/fixtures/registry/hosts/nixos.nix @@ -5,5 +5,4 @@ }; boot.loader.grub.enable = false; - system.stateVersion = "26.05"; } diff --git a/tests/fixtures/registry/modules/users/test/home.nix b/tests/fixtures/registry/modules/users/test/home.nix index 4ce2994..79d6752 100644 --- a/tests/fixtures/registry/modules/users/test/home.nix +++ b/tests/fixtures/registry/modules/users/test/home.nix @@ -3,6 +3,5 @@ home = { username = "test"; homeDirectory = if pkgs.stdenv.hostPlatform.isDarwin then "/Users/test" else "/home/test"; - stateVersion = "26.05"; }; } diff --git a/tests/registry.nix b/tests/registry.nix index 2cc21fb..f416712 100644 --- a/tests/registry.nix +++ b/tests/registry.nix @@ -43,6 +43,7 @@ let nixosHost = hostLib.mkNixos "registry-test" { system = "x86_64-linux"; + stateVersion = "26.05"; user = "test"; path = ./fixtures/registry/hosts; profiles = [ "interface.test" ]; @@ -50,6 +51,7 @@ let darwinHost = hostLib.mkDarwin "registry-test-darwin" { system = "aarch64-darwin"; + stateVersion = "26.05"; user = "test"; path = ./fixtures/registry/hosts; applications = [ "alpha" ]; @@ -109,6 +111,8 @@ let "beta-home" ]; assert nixosHost.config.my.profiles.interface.test.enable; + assert nixosHost.config.system.stateVersion == "26.05"; + assert nixosHost.config.home-manager.users.test.home.stateVersion == "26.05"; assert nixosHost.config.home-manager.users.test.my.applications.alpha.enable; assert nixosHost.config.home-manager.users.test.test.homeValues == [ @@ -116,6 +120,7 @@ let "beta-home" ]; assert darwinHost.config.my.applications.alpha.enable; + assert darwinHost.config.home-manager.users.test.home.stateVersion == "26.05"; assert darwinHost.config.home-manager.users.test.my.applications.alpha.enable; assert darwinHost.config.home-manager.users.test.test.homeValues == [ "home" ]; assert