@@ -4,12 +4,18 @@ inputs:
4
4
dogfood :
5
5
description : " Whether to use Nix installed from the latest artifact from master branch"
6
6
required : true # Be explicit about the fact that we are using unreleased artifacts
7
+ experimental-installer :
8
+ description : " Whether to use the experimental installer to install Nix"
9
+ default : false
7
10
extra_nix_config :
8
11
description : " Gets appended to `/etc/nix/nix.conf` if passed."
9
12
install_url :
10
13
description : " URL of the Nix installer"
11
14
required : false
12
15
default : " https://releases.nixos.org/nix/nix-2.30.2/install"
16
+ tarball_url :
17
+ description : " URL of the Nix tarball to use with the experimental installer"
18
+ required : false
13
19
github_token :
14
20
description : " Github token"
15
21
required : true
@@ -37,14 +43,57 @@ runs:
37
43
38
44
gh run download "$RUN_ID" --repo "$DOGFOOD_REPO" -n "$INSTALLER_ARTIFACT" -D "$INSTALLER_DOWNLOAD_DIR"
39
45
echo "installer-path=file://$INSTALLER_DOWNLOAD_DIR" >> "$GITHUB_OUTPUT"
46
+ TARBALL_PATH="$(find "$INSTALLER_DOWNLOAD_DIR" -name 'nix*.tar.xz' -print | head -n 1)"
47
+ echo "tarball-path=file://$TARBALL_PATH" >> "$GITHUB_OUTPUT"
40
48
41
49
echo "::notice ::Dogfooding Nix installer from master (https://github.com/$DOGFOOD_REPO/actions/runs/$RUN_ID)"
42
50
env :
43
51
GH_TOKEN : ${{ inputs.github_token }}
44
52
DOGFOOD_REPO : " NixOS/nix"
53
+ - name : " Download experimental installer"
54
+ shell : bash
55
+ id : download-experimental-nix-installer
56
+ if : ${{ inputs.experimental-installer == 'true' }}
57
+ run : |
58
+ if [ "$RUNNER_OS" == "Linux" ]; then
59
+ INSTALLER_OS="linux"
60
+ elif [ "$RUNNER_OS" == "macOS" ]; then
61
+ INSTALLER_OS="darwin"
62
+ else
63
+ echo "::error ::Unsupported RUNNER_OS: $RUNNER_OS"
64
+ fi
65
+
66
+ if [ "$RUNNER_ARCH" == "X64" ]; then
67
+ INSTALLER_ARCH="x86_64"
68
+ elif [ "$RUNNER_ARCH" == "ARM64" ]; then
69
+ INSTALLER_ARCH="aarch64"
70
+ else
71
+ echo "::error ::Unsupported RUNNER_ARCH: $RUNNER_ARCH"
72
+ fi
73
+
74
+ EXPERIMENTAL_INSTALLER_ARTIFACT="nix-installer-$INSTALLER_ARCH-$INSTALLER_OS"
75
+ EXPERIMENTAL_INSTALLER_PATH="$GITHUB_WORKSPACE/$EXPERIMENTAL_INSTALLER_ARTIFACT"
76
+ # TODO: This uses the latest release. It should probably be pinned, or dogfood the experimental repo's default branch - similar to the above
77
+ gh release download -R "$EXPERIMENTAL_INSTALLER_REPO" -D "$EXPERIMENTAL_INSTALLER_PATH" -p "nix-installer.sh" -p "$EXPERIMENTAL_INSTALLER_ARTIFACT"
78
+ chmod +x "$EXPERIMENTAL_INSTALLER_PATH/$EXPERIMENTAL_INSTALLER_ARTIFACT"
79
+
80
+ echo "installer-path=$EXPERIMENTAL_INSTALLER_PATH" >> "$GITHUB_OUTPUT"
81
+
82
+ echo "::notice Using experimental installer from $EXPERIMENTAL_INSTALLER_REPO (https://github.com/$EXPERIMENTAL_INSTALLER_REPO)"
83
+ env :
84
+ GH_TOKEN : ${{ inputs.github_token }}
85
+ EXPERIMENTAL_INSTALLER_REPO : " NixOS/experimental-nix-installer"
45
86
- uses : cachix/install-nix-action@c134e4c9e34bac6cab09cf239815f9339aaaf84e # v31.5.1
87
+ if : ${{ inputs.experimental-installer != 'true' }}
46
88
with :
47
89
# Ternary operator in GHA: https://www.github.com/actions/runner/issues/409#issuecomment-752775072
48
90
install_url : ${{ inputs.dogfood == 'true' && format('{0}/install', steps.download-nix-installer.outputs.installer-path) || inputs.install_url }}
49
91
install_options : ${{ inputs.dogfood == 'true' && format('--tarball-url-prefix {0}', steps.download-nix-installer.outputs.installer-path) || '' }}
50
92
extra_nix_config : ${{ inputs.extra_nix_config }}
93
+ - uses : DeterminateSystems/nix-installer-action@786fff0690178f1234e4e1fe9b536e94f5433196 # v20
94
+ if : ${{ inputs.experimental-installer == 'true' }}
95
+ with :
96
+ diagnostic-endpoint : " "
97
+ local-root : ${{ steps.download-experimental-nix-installer.outputs.installer-path }}
98
+ nix-package-url : ${{ inputs.dogfood == 'true' && steps.download-nix-installer.outputs.tarball-path || (inputs.tarball_url || '') }}
99
+ extra-conf : ${{ inputs.extra_nix_config }}
0 commit comments