2024-04-26 14:19:53 -03:00
|
|
|
// Build the Nix args out of inputs from the Actions environment
|
|
|
|
export function makeNixCommandArgs(
|
|
|
|
nixOptions: string[],
|
|
|
|
flakeInputs: string[],
|
|
|
|
commitMessage: string,
|
|
|
|
): string[] {
|
|
|
|
const flakeInputFlags = flakeInputs.flatMap((input) => [
|
|
|
|
"--update-input",
|
|
|
|
input,
|
|
|
|
]);
|
|
|
|
|
2024-05-09 14:15:38 -04:00
|
|
|
const updateLockMechanism = flakeInputFlags.length === 0 ? "update" : "lock";
|
|
|
|
|
2024-04-26 14:19:53 -03:00
|
|
|
return nixOptions
|
2024-05-09 14:15:38 -04:00
|
|
|
.concat(["flake", updateLockMechanism])
|
2024-04-26 14:19:53 -03:00
|
|
|
.concat(flakeInputFlags)
|
2024-05-09 14:15:38 -04:00
|
|
|
.concat(["--commit-lock-file", "--commit-lockfile-summary", commitMessage]);
|
2024-04-26 14:19:53 -03:00
|
|
|
}
|