From 5d962bd4baf88a7905910f7f4b205fbe7674c421 Mon Sep 17 00:00:00 2001 From: Clan Merge Bot Date: Mon, 9 Dec 2024 00:00:21 +0000 Subject: [PATCH 1/3] update flake lock - 2024-12-09T00:00+00:00 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Flake lock file updates: • Updated input 'disko': 'github:nix-community/disko/2814a5224a47ca19e858e027f7e8bff74a8ea9f1?narHash=sha256-2uMaVAZn7fiyTUGhKgleuLYe5%2BEAAYB/diKxrM7g3as%3D' (2024-11-30) → 'github:nix-community/disko/785c1e02c7e465375df971949b8dcbde9ec362e5?narHash=sha256-8dupm9GfK%2BBowGdQd7EHK5V61nneLfr9xR6sc5vtDi0%3D' (2024-12-02) • Updated input 'flake-parts': 'github:hercules-ci/flake-parts/506278e768c2a08bec68eb62932193e341f55c90?narHash=sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS%2Bb4tfNFCwE%3D' (2024-11-01) → 'github:hercules-ci/flake-parts/205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9?narHash=sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c%3D' (2024-12-04) • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/2c27ab2e60502d1ebb7cf38909de38663f762a79?narHash=sha256-n/DOfpKH1vkukuBnach91QBQId2dr5tkE7/7UrkV2zw%3D' (2024-12-01) → 'github:NixOS/nixpkgs/929116e316068c7318c54eb4d827f7d9756d5e9c?narHash=sha256-aLJxoTDDSqB%2B/3orsulE6/qdlX6MzDLIITLZqdgMpqo%3D' (2024-12-05) • Updated input 'sops-nix': 'github:Mic92/sops-nix/3433ea14fbd9e6671d0ff0dd45ed15ee4c156ffa?narHash=sha256-xtt95%2Bc7OUMoqZf4OvA/7AemiH3aVuWHQbErYQoPwFk%3D' (2024-11-25) → 'github:Mic92/sops-nix/c6134b6fff6bda95a1ac872a2a9d5f32e3c37856?narHash=sha256-m6/qwJAJYcidGMEdLqjKzRIjapK4nUfMq7rDCTmZajc%3D' (2024-12-02) • Updated input 'treefmt-nix': 'github:numtide/treefmt-nix/6209c381904cab55796c5d7350e89681d3b2a8ef?narHash=sha256-2qbdorpq0TXHBWbVXaTqKoikN4bqAtAplTwGuII%2BoAc%3D' (2024-11-29) → 'github:numtide/treefmt-nix/357cda84af1d74626afb7fb3bc12d6957167cda9?narHash=sha256-9qOp6jNdezzLMxwwXaXZWPXosHbNqno%2Bf7Ii/xftqZ8%3D' (2024-12-08) --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index b010f2bfb..c0941d143 100644 --- a/flake.lock +++ b/flake.lock @@ -57,11 +57,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1733024928, - "narHash": "sha256-n/DOfpKH1vkukuBnach91QBQId2dr5tkE7/7UrkV2zw=", + "lastModified": 1733376361, + "narHash": "sha256-aLJxoTDDSqB+/3orsulE6/qdlX6MzDLIITLZqdgMpqo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2c27ab2e60502d1ebb7cf38909de38663f762a79", + "rev": "929116e316068c7318c54eb4d827f7d9756d5e9c", "type": "github" }, "original": { From 7b0cbc31829dbff95b6c14373755d321c133277f Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 9 Dec 2024 12:57:12 +0100 Subject: [PATCH 2/3] postgresql: nix fmt --- clanModules/postgresql/default.nix | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/clanModules/postgresql/default.nix b/clanModules/postgresql/default.nix index 73690a0b7..49a98b37e 100644 --- a/clanModules/postgresql/default.nix +++ b/clanModules/postgresql/default.nix @@ -204,12 +204,10 @@ in if [[ -e "${current}" ]]; then ( - ${ - lib.optionalString (db.restore.stopOnRestore != [ ]) '' - systemctl stop ${builtins.toString db.restore.stopOnRestore} - trap "systemctl start ${builtins.toString db.restore.stopOnRestore}" EXIT - '' - } + ${lib.optionalString (db.restore.stopOnRestore != [ ]) '' + systemctl stop ${builtins.toString db.restore.stopOnRestore} + trap "systemctl start ${builtins.toString db.restore.stopOnRestore}" EXIT + ''} mkdir -p "${folder}" if runuser -u postgres -- psql -d postgres -c "SELECT 1 FROM pg_database WHERE datname = '${db.name}'" | grep -q 1; then From 22848256d81e24632a4e64e49a791a0da04bc423 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 9 Dec 2024 17:21:14 +0100 Subject: [PATCH 3/3] installer-test: adapt to upstream changes --- checks/installation/flake-module.nix | 86 ++++++++++++++++------------ 1 file changed, 48 insertions(+), 38 deletions(-) diff --git a/checks/installation/flake-module.nix b/checks/installation/flake-module.nix index ce0dbacb0..f48c4e040 100644 --- a/checks/installation/flake-module.nix +++ b/checks/installation/flake-module.nix @@ -7,8 +7,8 @@ { clan.machines.test-install-machine = { clan.core.networking.targetHost = "test-install-machine"; - fileSystems."/".device = lib.mkDefault "/dev/vdb"; - boot.loader.grub.device = lib.mkDefault "/dev/vdb"; + fileSystems."/".device = lib.mkDefault "/dev/vda"; + boot.loader.grub.device = lib.mkDefault "/dev/vda"; imports = [ self.nixosModules.test-install-machine ]; }; @@ -22,7 +22,7 @@ (modulesPath + "/profiles/qemu-guest.nix") ../lib/minify.nix ]; - clan.single-disk.device = "/dev/vdb"; + clan.single-disk.device = "/dev/vda"; environment.etc."install-successful".text = "ok"; @@ -47,7 +47,6 @@ pkgs.nixos-anywhere ] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs); closureInfo = pkgs.closureInfo { rootPaths = dependencies; }; - qemu-common = import "${inputs.nixpkgs}/nixos/lib/qemu-common.nix" { inherit lib pkgs; }; in { # On aarch64-linux, hangs on reboot with after installation: @@ -64,22 +63,41 @@ name = "test-installation"; nodes.target = { services.openssh.enable = true; - users.users.root.openssh.authorizedKeys.keyFiles = [ ../lib/ssh/pubkey ]; - system.nixos.variant_id = "installer"; - environment.systemPackages = [ pkgs.nixos-facter ]; - virtualisation.emptyDiskImages = [ 4096 ]; - nix.settings = { - substituters = lib.mkForce [ ]; - hashed-mirrors = null; - connect-timeout = lib.mkForce 3; - flake-registry = pkgs.writeText "flake-registry" ''{"flakes":[],"version":2}''; - experimental-features = [ - "nix-command" - "flakes" - ]; - }; - system.extraDependencies = dependencies; + virtualisation.diskImage = "./target.qcow2"; + virtualisation.useBootLoader = true; + + # virtualisation.fileSystems."/" = { + # device = "/dev/disk/by-label/this-is-not-real-and-will-never-be-used"; + # fsType = "ext4"; + # }; }; + nodes.installer = + { modulesPath, ... }: + { + imports = [ + (modulesPath + "/../tests/common/auto-format-root-device.nix") + ]; + services.openssh.enable = true; + users.users.root.openssh.authorizedKeys.keyFiles = [ ../lib/ssh/pubkey ]; + system.nixos.variant_id = "installer"; + environment.systemPackages = [ pkgs.nixos-facter ]; + virtualisation.emptyDiskImages = [ 512 ]; + virtualisation.diskSize = 8 * 1024; + virtualisation.rootDevice = "/dev/vdb"; + # both installer and target need to use the same diskImage + virtualisation.diskImage = "./target.qcow2"; + nix.settings = { + substituters = lib.mkForce [ ]; + hashed-mirrors = null; + connect-timeout = lib.mkForce 3; + flake-registry = pkgs.writeText "flake-registry" ''{"flakes":[],"version":2}''; + experimental-features = [ + "nix-command" + "flakes" + ]; + }; + system.extraDependencies = dependencies; + }; nodes.client = { environment.systemPackages = [ self.packages.${pkgs.system}.clan-cli @@ -100,36 +118,28 @@ }; testScript = '' - def create_test_machine(oldmachine=None, args={}): # taken from - startCommand = "${qemu-common.qemuBinary pkgs.qemu_test}" - startCommand += " -cpu max -m 1024 -virtfs local,path=/nix/store,security_model=none,mount_tag=nix-store" - startCommand += f' -drive file={oldmachine.state_dir}/empty0.qcow2,id=drive1,if=none,index=1,werror=report' - startCommand += ' -device virtio-blk-pci,drive=drive1' - machine = create_machine({ - "startCommand": startCommand, - } | args) - driver.machines.append(machine) - return machine - - start_all() + client.start() + installer.start() client.succeed("${pkgs.coreutils}/bin/install -Dm 600 ${../lib/ssh/privkey} /root/.ssh/id_ed25519") - client.wait_until_succeeds("timeout 2 ssh -o StrictHostKeyChecking=accept-new -v root@target hostname") + client.wait_until_succeeds("timeout 2 ssh -o StrictHostKeyChecking=accept-new -v root@installer hostname") client.succeed("cp -r ${../..} test-flake && chmod -R +w test-flake") client.fail("test -f test-flake/machines/test-install-machine/hardware-configuration.nix") - client.succeed("clan machines update-hardware-config --flake test-flake test-install-machine root@target>&2") + client.succeed("clan machines update-hardware-config --flake test-flake test-install-machine root@installer >&2") client.succeed("test -f test-flake/machines/test-install-machine/hardware-configuration.nix") - client.succeed("clan machines update-hardware-config --backend nixos-facter --flake test-flake test-install-machine root@target>&2") + client.succeed("clan machines update-hardware-config --backend nixos-facter --flake test-flake test-install-machine root@installer>&2") client.succeed("test -f test-flake/machines/test-install-machine/facter.json") - client.succeed("clan machines install --debug --flake ${../..} --yes test-install-machine --target-host root@target >&2") + client.succeed("clan machines install --debug --flake ${../..} --yes test-install-machine --target-host root@installer >&2") try: - target.shutdown() + installer.shutdown() except BrokenPipeError: # qemu has already exited pass - new_machine = create_test_machine(oldmachine=target, args={ "name": "new_machine" }) - assert(new_machine.succeed("cat /etc/install-successful").strip() == "ok") + target.state_dir = installer.state_dir + target.start() + target.wait_for_unit("multi-user.target") + assert(target.succeed("cat /etc/install-successful").strip() == "ok") ''; } { inherit pkgs self; }; };