diff --git a/lib/modules/partition/disks.nix b/lib/modules/partition/disks.nix index e8764a2f..ba783123 100644 --- a/lib/modules/partition/disks.nix +++ b/lib/modules/partition/disks.nix @@ -91,9 +91,14 @@ let type); fdiskCommand = arguments: "sudo sfdisk ${arguments}"; - fdiskScript = script: append: "echo ${script} | ${fdiskCommand "${if append then "--append" else ""} ${diskVar}"}"; - wipeScript = script: fdiskScript script false; - appendScript = script: fdiskScript script true; + fdiskScript = script: args: append: + "echo ${script} | ${ + fdiskCommand "${builtins.concatStringsSep " " args} ${ + if append then "--append" else "" + } ${diskVar}" + }"; + wipeScript = script: fdiskScript script [] false; + appendScript = index: script: fdiskScript script ["-N" (builtins.toString index)] true; cleanup = lib.strings.concatLines (builtins.map (partition: "${fdiskCommand "--delete ${diskVar} ${toString partition.index}"} || true") @@ -130,7 +135,7 @@ let }; create = lib.strings.concatLines [ - (appendScript ''${toString index}: "$(${sizeOption})" type=${mkType type}'') + (appendScript index ''${toString index}: "$(${sizeOption})" type=${mkType type}'') probeScript "sudo ${formatScripts.${format}}" ];