-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document and clean up substituter configuration (#14)
- Loading branch information
1 parent
87d4bf1
commit b5d2e8c
Showing
4 changed files
with
108 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
echo "::group::Setting up substituter ${INPUT_SUBSTITUTER}" | ||
|
||
echo "${INPUT_SUBSTITUTER_KEY}" >/tmp/secret-key | ||
|
||
echo "Populating the environment with the substituter's URL and options, and AWS's credentials" | ||
{ | ||
echo "FLOX_SUBSTITUTER=${INPUT_SUBSTITUTER}${INPUT_SUBSTITUTER_OPTIONS}" | ||
echo "${INPUT_AWS_ACCESS_KEY_ID}" | ||
echo "${INPUT_AWS_SECRET_ACCESS_KEY}" | ||
} >>"${GITHUB_ENV}" | ||
|
||
echo "Making the Nix daemon aware of the substituter" | ||
{ | ||
EXTRA_TRUSTED_PUBLIC_KEY=$(echo "${INPUT_SUBSTITUTER_KEY}" | nix key convert-secret-to-public) | ||
echo "extra-trusted-public-keys = ${EXTRA_TRUSTED_PUBLIC_KEY}" | ||
echo "extra-substituters = ${INPUT_SUBSTITUTER}" | ||
} | sudo tee -a /etc/nix/nix.conf >/dev/null | ||
|
||
echo "Making the Nix daemon aware of the AWS credentials" | ||
|
||
sudo mkdir -p /etc/systemd/system/nix-daemon.service.d | ||
printf "%s\n" \ | ||
'[Service]' \ | ||
"Environment=AWS_ACCESS_KEY_ID=${INPUT_AWS_ACCESS_KEY_ID}" \ | ||
"Environment=AWS_SECRET_ACCESS_KEY=${INPUT_AWS_SECRET_ACCESS_KEY}" | | ||
sudo tee -a /etc/systemd/system/nix-daemon.service.d/aws-credentials.conf >/dev/null | ||
|
||
echo "Restarting the Nix daemon" | ||
|
||
sudo systemctl daemon-reload | ||
sudo systemctl restart nix-daemon.service | ||
|
||
echo "::endgroup::" |
b5d2e8c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Causing breakage in CI:
https://github.com/flox/flox/actions/runs/5224829217/jobs/9433560382?pr=100