diff --git a/nixos/modules/image/repart-image.nix b/nixos/modules/image/repart-image.nix index 1bc50c719b14..e8047757117d 100644 --- a/nixos/modules/image/repart-image.nix +++ b/nixos/modules/image/repart-image.nix @@ -30,7 +30,7 @@ # arguments name, version, - imageFileBasename, + baseName, compression, fileSystems, finalPartitions, @@ -205,7 +205,7 @@ stdenvNoCC.mkDerivation ( echo "Building image with systemd-repart..." unshare --map-root-user fakeroot systemd-repart \ ''${systemdRepartFlags[@]} \ - ${imageFileBasename}.raw \ + ${baseName}.raw \ | tee repart-output.json runHook postBuild @@ -220,14 +220,14 @@ stdenvNoCC.mkDerivation ( # separate derivation to allow users to save disk space. Disk images are # already very space intensive so we want to allow users to mitigate this. + lib.optionalString compression.enable '' - for f in ${imageFileBasename}*; do + for f in ${baseName}*; do echo "Compressing $f with ${compression.algorithm}..." # Keep the original file when compressing and only delete it afterwards ${compressionCommand} $f && rm $f done '' + '' - mv -v repart-output.json ${imageFileBasename}* $out + mv -v repart-output.json ${baseName}* $out runHook postInstall ''; diff --git a/nixos/modules/image/repart-verity-store.nix b/nixos/modules/image/repart-verity-store.nix index ee2cdd05961e..b0b137789bec 100644 --- a/nixos/modules/image/repart-verity-store.nix +++ b/nixos/modules/image/repart-verity-store.nix @@ -194,8 +194,8 @@ in | assert_uki_repart_match.py "${config.system.build.intermediateImage}/repart-output.json" # copy the uncompressed intermediate image, so that systemd-repart picks it up - cp -v ${config.system.build.intermediateImage}/${config.image.repart.imageFileBasename}.raw . - chmod +w ${config.image.repart.imageFileBasename}.raw + cp -v ${config.system.build.intermediateImage}/${config.image.baseName}.raw . + chmod +w ${config.image.baseName}.raw ''; # replace "TBD" with the original roothash values diff --git a/nixos/modules/image/repart.nix b/nixos/modules/image/repart.nix index a44a2e5f9ea3..4190a7911db5 100644 --- a/nixos/modules/image/repart.nix +++ b/nixos/modules/image/repart.nix @@ -391,7 +391,7 @@ in mkfsEnv = mkfsOptionsToEnv cfg.mkfsOptions; val = pkgs.callPackage ./repart-image.nix { systemd = cfg.package; - imageFileBasename = config.image.baseName; + inherit (config.image) baseName; inherit (cfg) name version