Skip to content

Commit db4ee38

Browse files
committed
Fixup support for Nix 2.23.0 and later
1 parent b0723e0 commit db4ee38

File tree

4 files changed

+27
-6
lines changed

4 files changed

+27
-6
lines changed

dist/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95086,8 +95086,13 @@ function makeNixCommandArgs(nixOptions, flakeInputs, commitMessage) {
9508695086
"--update-input",
9508795087
input
9508895088
]);
95089+
const lockfileSummaryFlags = [
95090+
"--option",
95091+
"commit-lockfile-summary",
95092+
commitMessage
95093+
];
9508995094
const updateLockMechanism = flakeInputFlags.length === 0 ? "update" : "lock";
95090-
return nixOptions.concat(["flake", updateLockMechanism]).concat(flakeInputFlags).concat(["--commit-lock-file", "--commit-lockfile-summary", commitMessage]);
95095+
return nixOptions.concat(["flake", updateLockMechanism]).concat(flakeInputFlags).concat(["--commit-lock-file"]).concat(lockfileSummaryFlags);
9509195096
}
9509295097

9509395098
// src/index.ts

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/nix.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ test("Nix command arguments", () => {
2424
"flake",
2525
"update",
2626
"--commit-lock-file",
27-
"--commit-lockfile-summary",
27+
"--option",
28+
"commit-lockfile-summary",
2829
"just testing",
2930
],
3031
},
@@ -42,7 +43,8 @@ test("Nix command arguments", () => {
4243
"--update-input",
4344
"rust-overlay",
4445
"--commit-lock-file",
45-
"--commit-lockfile-summary",
46+
"--option",
47+
"commit-lockfile-summary",
4648
"just testing",
4749
],
4850
},
@@ -57,7 +59,8 @@ test("Nix command arguments", () => {
5759
"flake",
5860
"update",
5961
"--commit-lock-file",
60-
"--commit-lockfile-summary",
62+
"--option",
63+
"commit-lockfile-summary",
6164
"just testing",
6265
],
6366
},

src/nix.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,23 @@ export function makeNixCommandArgs(
99
input,
1010
]);
1111

12+
// NOTE(cole-h): In Nix versions 2.23.0 and later, `commit-lockfile-summary` became an alias to
13+
// the setting `commit-lock-file-summary` (https://github.com/NixOS/nix/pull/10691), and Nix does
14+
// not treat aliases the same as their "real" setting by requiring setting aliases to be
15+
// configured via `--option <alias name> <option value>`
16+
// (https://github.com/NixOS/nix/issues/10989).
17+
// So, we go the long way so that we can support versions both before and after Nix 2.23.0.
18+
const lockfileSummaryFlags = [
19+
"--option",
20+
"commit-lockfile-summary",
21+
commitMessage,
22+
];
23+
1224
const updateLockMechanism = flakeInputFlags.length === 0 ? "update" : "lock";
1325

1426
return nixOptions
1527
.concat(["flake", updateLockMechanism])
1628
.concat(flakeInputFlags)
17-
.concat(["--commit-lock-file", "--commit-lockfile-summary", commitMessage]);
29+
.concat(["--commit-lock-file"])
30+
.concat(lockfileSummaryFlags);
1831
}

0 commit comments

Comments
 (0)