Fixup support for Nix 2.23.0 and later

This commit is contained in:
Cole Helbling 2024-06-28 13:37:59 -07:00 committed by Cole Helbling
parent b0723e0fae
commit db4ee38117
4 changed files with 27 additions and 6 deletions

7
dist/index.js vendored
View File

@ -95086,8 +95086,13 @@ function makeNixCommandArgs(nixOptions, flakeInputs, commitMessage) {
"--update-input",
input
]);
const lockfileSummaryFlags = [
"--option",
"commit-lockfile-summary",
commitMessage
];
const updateLockMechanism = flakeInputFlags.length === 0 ? "update" : "lock";
return nixOptions.concat(["flake", updateLockMechanism]).concat(flakeInputFlags).concat(["--commit-lock-file", "--commit-lockfile-summary", commitMessage]);
return nixOptions.concat(["flake", updateLockMechanism]).concat(flakeInputFlags).concat(["--commit-lock-file"]).concat(lockfileSummaryFlags);
}
// src/index.ts

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -24,7 +24,8 @@ test("Nix command arguments", () => {
"flake",
"update",
"--commit-lock-file",
"--commit-lockfile-summary",
"--option",
"commit-lockfile-summary",
"just testing",
],
},
@ -42,7 +43,8 @@ test("Nix command arguments", () => {
"--update-input",
"rust-overlay",
"--commit-lock-file",
"--commit-lockfile-summary",
"--option",
"commit-lockfile-summary",
"just testing",
],
},
@ -57,7 +59,8 @@ test("Nix command arguments", () => {
"flake",
"update",
"--commit-lock-file",
"--commit-lockfile-summary",
"--option",
"commit-lockfile-summary",
"just testing",
],
},

View File

@ -9,10 +9,23 @@ export function makeNixCommandArgs(
input,
]);
// NOTE(cole-h): In Nix versions 2.23.0 and later, `commit-lockfile-summary` became an alias to
// the setting `commit-lock-file-summary` (https://github.com/NixOS/nix/pull/10691), and Nix does
// not treat aliases the same as their "real" setting by requiring setting aliases to be
// configured via `--option <alias name> <option value>`
// (https://github.com/NixOS/nix/issues/10989).
// So, we go the long way so that we can support versions both before and after Nix 2.23.0.
const lockfileSummaryFlags = [
"--option",
"commit-lockfile-summary",
commitMessage,
];
const updateLockMechanism = flakeInputFlags.length === 0 ? "update" : "lock";
return nixOptions
.concat(["flake", updateLockMechanism])
.concat(flakeInputFlags)
.concat(["--commit-lock-file", "--commit-lockfile-summary", commitMessage]);
.concat(["--commit-lock-file"])
.concat(lockfileSummaryFlags);
}