ci/version-info: create temp files in a temp directory

Avoid polluting the repo with temporary `channels.{nix,json,toml}`
files. Write them to a temporary working directory instead.

(cherry picked from commit bc997a2409)
This commit is contained in:
Matt Sturgeon 2025-07-07 17:00:48 +01:00
parent f8b5a2fa7d
commit 76d059bac2

View file

@ -20,6 +20,10 @@ writeShellApplication {
};
text = ''
work=$(mktemp -d)
(
cd "$work"
# Download channel info from NixOS/infra
curl ${channelsURL} | nix eval --file - --json > channels.json
@ -29,15 +33,18 @@ writeShellApplication {
--argstr system ${stdenv.hostPlatform.system} \
--arg-from-file channelsJSON channels.json \
--out-link channels.toml
)
(
{
echo "# DO NOT MODIFY!"
echo "# This file was generated by ${
lib.strings.removePrefix (toString ../.. + "/") (toString ./default.nix)
}"
cat ${mainInfo}
echo
cat channels.toml
) > version-info.toml
cat "$work/channels.toml"
} > version-info.toml
rm -rf "$work"
'';
}