fix system.stateVersion

This commit is contained in:
Jörg Thalheim
2025-02-14 12:13:36 +07:00
parent f8bf39e43a
commit d3bd120a04
10 changed files with 35 additions and 29 deletions

View File

@@ -7,14 +7,17 @@ in
(nixos-lib.runTest { (nixos-lib.runTest {
hostPkgs = pkgs; hostPkgs = pkgs;
# speed-up evaluation # speed-up evaluation
defaults = { defaults = (
{ config, ... }:
{
imports = [ imports = [
./minify.nix ./minify.nix
]; ];
documentation.enable = lib.mkDefault false; documentation.enable = lib.mkDefault false;
nix.settings.min-free = 0; nix.settings.min-free = 0;
system.stateVersion = lib.version; system.stateVersion = config.system.nixos.release;
}; }
);
# to accept external dependencies such as disko # to accept external dependencies such as disko
node.specialArgs.self = self; node.specialArgs.self = self;

View File

@@ -6,11 +6,14 @@
let let
baseModule = { baseModule = {
imports = (import (pkgs.path + "/nixos/modules/module-list.nix")) ++ [ imports = (import (pkgs.path + "/nixos/modules/module-list.nix")) ++ [
(
{ config, ... }:
{ {
nixpkgs.pkgs = pkgs; nixpkgs.pkgs = pkgs;
clan.core.name = "dummy"; clan.core.name = "dummy";
system.stateVersion = lib.version; system.stateVersion = config.system.nixos.release;
} }
)
]; ];
}; };

View File

@@ -1,7 +1,7 @@
{ lib, ... }: { config, ... }:
{ {
clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__"; clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__";
system.stateVersion = lib.version; system.stateVersion = config.system.nixos.release;
sops.age.keyFile = "__CLAN_SOPS_KEY_PATH__"; sops.age.keyFile = "__CLAN_SOPS_KEY_PATH__";
clan.core.facts.secretUploadDirectory = "__CLAN_SOPS_KEY_DIR__"; clan.core.facts.secretUploadDirectory = "__CLAN_SOPS_KEY_DIR__";
clan.virtualisation.graphics = false; clan.virtualisation.graphics = false;

View File

@@ -1,7 +1,7 @@
{ lib, ... }: { config, ... }:
{ {
clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__"; clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__";
system.stateVersion = lib.version; system.stateVersion = config.system.nixos.release;
sops.age.keyFile = "__CLAN_SOPS_KEY_PATH__"; sops.age.keyFile = "__CLAN_SOPS_KEY_PATH__";
clan.core.facts.secretUploadDirectory = "__CLAN_SOPS_KEY_DIR__"; clan.core.facts.secretUploadDirectory = "__CLAN_SOPS_KEY_DIR__";
clan.virtualisation.graphics = false; clan.virtualisation.graphics = false;

View File

@@ -1,7 +1,7 @@
{ lib, ... }: { config, ... }:
{ {
clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__"; clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__";
system.stateVersion = lib.version; system.stateVersion = config.system.nixos.release;
clan.virtualisation.graphics = false; clan.virtualisation.graphics = false;
networking.useDHCP = false; networking.useDHCP = false;

View File

@@ -14,11 +14,11 @@
meta.name = "test_flake_with_core"; meta.name = "test_flake_with_core";
machines = { machines = {
vm1 = vm1 =
{ lib, ... }: { config, ... }:
{ {
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__"; clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__";
system.stateVersion = lib.version; system.stateVersion = config.system.nixos.release;
sops.age.keyFile = "__CLAN_SOPS_KEY_PATH__"; sops.age.keyFile = "__CLAN_SOPS_KEY_PATH__";
clan.core.facts.secretUploadDirectory = "__CLAN_SOPS_KEY_DIR__"; clan.core.facts.secretUploadDirectory = "__CLAN_SOPS_KEY_DIR__";
clan.core.sops.defaultGroups = [ "admins" ]; clan.core.sops.defaultGroups = [ "admins" ];
@@ -28,7 +28,7 @@
networking.useDHCP = false; networking.useDHCP = false;
}; };
vm2 = vm2 =
{ lib, ... }: { config, ... }:
{ {
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
imports = [ imports = [
@@ -39,7 +39,7 @@
clan.user-password.user = "alice"; clan.user-password.user = "alice";
clan.user-password.prompt = false; clan.user-password.prompt = false;
clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__"; clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__";
system.stateVersion = lib.version; system.stateVersion = config.system.nixos.release;
sops.age.keyFile = "__CLAN_SOPS_KEY_PATH__"; sops.age.keyFile = "__CLAN_SOPS_KEY_PATH__";
clan.core.facts.secretUploadDirectory = "__CLAN_SOPS_KEY_DIR__"; clan.core.facts.secretUploadDirectory = "__CLAN_SOPS_KEY_DIR__";
clan.core.networking.zerotier.networkId = "82b44b162ec6c013"; clan.core.networking.zerotier.networkId = "82b44b162ec6c013";

View File

@@ -13,7 +13,7 @@
meta.name = "test_flake_with_core_and_pass"; meta.name = "test_flake_with_core_and_pass";
machines = { machines = {
vm1 = vm1 =
{ lib, ... }: { lib, config, ... }:
{ {
imports = [ imports = [
clan-core.clanModules.sshd clan-core.clanModules.sshd
@@ -24,7 +24,7 @@
clan.user-password.prompt = false; clan.user-password.prompt = false;
clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__"; clan.core.networking.targetHost = "__CLAN_TARGET_ADDRESS__";
system.stateVersion = lib.version; system.stateVersion = config.system.nixos.release;
clan.core.facts.secretStore = "password-store"; clan.core.facts.secretStore = "password-store";
clan.core.facts.secretUploadDirectory = lib.mkForce "__CLAN_SOPS_KEY_DIR__/secrets"; clan.core.facts.secretUploadDirectory = lib.mkForce "__CLAN_SOPS_KEY_DIR__/secrets";

View File

@@ -15,7 +15,7 @@ let
self.clanModules.trusted-nix-caches self.clanModules.trusted-nix-caches
]; ];
system.stateVersion = config.system.nixos.version; system.stateVersion = config.system.nixos.release;
nixpkgs.pkgs = self.inputs.nixpkgs.legacyPackages.x86_64-linux; nixpkgs.pkgs = self.inputs.nixpkgs.legacyPackages.x86_64-linux;
boot.loader.grub.efiSupport = lib.mkDefault true; boot.loader.grub.efiSupport = lib.mkDefault true;

View File

@@ -14,5 +14,5 @@
]; ];
nixpkgs.pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; nixpkgs.pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux;
system.stateVersion = config.system.nixos.version; system.stateVersion = config.system.nixos.release;
} }

View File

@@ -11,9 +11,9 @@
# TODO: Instead create a machine by calling the API, this wont break in future tests and is much closer to what the user performs # TODO: Instead create a machine by calling the API, this wont break in future tests and is much closer to what the user performs
cat > $out/machines/testmachine/hardware-configuration.nix << EOF cat > $out/machines/testmachine/hardware-configuration.nix << EOF
{ lib, ... }: { { lib, config, ... }: {
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
system.stateVersion = lib.version; system.stateVersion = config.system.nixos.release;
documentation.enable = false; documentation.enable = false;
users.users.root.initialPassword = "fnord23"; users.users.root.initialPassword = "fnord23";
boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ]; boot.loader.grub.devices = lib.mkForce [ "/dev/sda" ];