From f0fe4db61c57d64c067de7e90e0f7c65549da3da Mon Sep 17 00:00:00 2001 From: Else Someone Date: Sun, 22 Mar 2026 21:25:48 +0200 Subject: [PATCH] cloud-hypervisor: clean up the short-circuiting logic --- pkgs/cloud-hypervisor-gpu.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/cloud-hypervisor-gpu.nix b/pkgs/cloud-hypervisor-gpu.nix index a99ce6f..237caf7 100644 --- a/pkgs/cloud-hypervisor-gpu.nix +++ b/pkgs/cloud-hypervisor-gpu.nix @@ -34,10 +34,10 @@ cloud-hypervisor.overrideAttrs ( patches = patchesFromDir (spectrum + "/pkgs/cloud-hypervisor"); vhostPatches = patchesFromDir (spectrum + "/pkgs/cloud-hypervisor/vhost"); }; - previouslyPatched = oldAttrs ? spectrumPatches; - patchPhases = !previouslyPatched; + oldPatchesStruct = oldAttrs.passthru.spectrumPatches or { }; + missingPatchPhases = oldPatchesStruct != { }; isNewer = lib.versionOlder oldAttrs.spectrumPatches.version or "2000-00-00" spectrumPatches.version; - oldPatches = oldAttrs.spectrumPatches.patches or [ ]; + oldPatches = oldPatchesStruct.patches or [ ]; removeAll = removeElts: lst: builtins.filter (x: !(builtins.elem x removeElts)) lst; in optionalAttrs isNewer { @@ -47,7 +47,7 @@ cloud-hypervisor.overrideAttrs ( # Verbatim from spectrum postUnpack = oldAttrs.postUnpack or "" - + optionalString patchPhases '' + + optionalString missingPatchPhases '' unpackFile $vhost chmod -R +w vhost ''; @@ -58,7 +58,7 @@ cloud-hypervisor.overrideAttrs ( # Verbatim copy from spectrum postPatch = oldAttrs.postPatch or "" - + optionalString patchPhases '' + + optionalString missingPatchPhases '' pushd ../vhost for patch in $vhostPatches; do echo applying patch $patch