Skip to content

Commit 76d059b

Browse files
committed
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 bc997a2)
1 parent f8b5a2f commit 76d059b

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

update-scripts/version-info/default.nix

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,31 @@ writeShellApplication {
2020
};
2121

2222
text = ''
23-
# Download channel info from NixOS/infra
24-
curl ${channelsURL} | nix eval --file - --json > channels.json
23+
work=$(mktemp -d)
24+
(
25+
cd "$work"
2526
26-
# Use channels.nix to build channels.toml
27-
nix build --impure \
28-
--file ${./supported-versions.nix} \
29-
--argstr system ${stdenv.hostPlatform.system} \
30-
--arg-from-file channelsJSON channels.json \
31-
--out-link channels.toml
27+
# Download channel info from NixOS/infra
28+
curl ${channelsURL} | nix eval --file - --json > channels.json
3229
33-
(
30+
# Use channels.nix to build channels.toml
31+
nix build --impure \
32+
--file ${./supported-versions.nix} \
33+
--argstr system ${stdenv.hostPlatform.system} \
34+
--arg-from-file channelsJSON channels.json \
35+
--out-link channels.toml
36+
)
37+
38+
{
3439
echo "# DO NOT MODIFY!"
3540
echo "# This file was generated by ${
3641
lib.strings.removePrefix (toString ../.. + "/") (toString ./default.nix)
3742
}"
3843
cat ${mainInfo}
3944
echo
40-
cat channels.toml
41-
) > version-info.toml
45+
cat "$work/channels.toml"
46+
} > version-info.toml
47+
48+
rm -rf "$work"
4249
'';
4350
}

0 commit comments

Comments
 (0)