It is possible to configure commit-lock-file-summary via a flake's nixConfig or via global nix config (e.g. specified in the install-nix action).
However, if --commit-lock-file-summary (or more precisely, --option commit-lockfile-summary) is supplied at the CLI, the configured value will be overridden by the value supplied at the CLI.
Instead, I'd propose removing the commit-msg input's default, and then only doing .concat(lockfileSummaryFlags) when commitMessage is truthy (non-empty). Alternatively, lockfileSummaryFlags could itself be an empty string when commitMessage is.
The default value specified in the input is usually1 identical to the default used by nix, so relying on nix's default when the input isn't defined seems like a reasonable behaviour.
The input:
|
commit-msg: |
|
description: "The message provided with the commit" |
|
required: false |
|
default: "flake.lock: Update" |
The lockfileSummaryFlags definition:
|
// 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, |
|
]; |
The concat:
|
.concat(lockfileSummaryFlags); |
It is possible to configure
commit-lock-file-summaryvia a flake'snixConfigor via global nix config (e.g. specified in the install-nix action).However, if
--commit-lock-file-summary(or more precisely,--option commit-lockfile-summary) is supplied at the CLI, the configured value will be overridden by the value supplied at the CLI.Instead, I'd propose removing the
commit-msginput'sdefault, and then only doing.concat(lockfileSummaryFlags)whencommitMessageis truthy (non-empty). Alternatively,lockfileSummaryFlagscould itself be an empty string whencommitMessageis.The default value specified in the input is usually1 identical to the default used by
nix, so relying on nix's default when the input isn't defined seems like a reasonable behaviour.The input:
update-flake-lock/action.yml
Lines 12 to 15 in d6b4710
The
lockfileSummaryFlagsdefinition:update-flake-lock/src/nix.ts
Lines 12 to 22 in d6b4710
The concat:
update-flake-lock/src/nix.ts
Line 30 in d6b4710
Footnotes
for top-level
flake.lockfiles it is identical. For nestedflake.lockfiles nix will default the commit summary to something likepath/to/flake.lock: Updaterelative to the root of the flake's source repo. ↩