Cache nix
Some checks failed
/ Test on 29.1 (push) Waiting to run
/ Test on snapshot (push) Waiting to run
/ Test on 28.2 (push) Has been cancelled

This commit is contained in:
Maciej 2024-08-15 20:26:07 +03:00
parent d9347fcc22
commit 6db71f77c3
Signed by: maciej
GPG key ID: 41D62D42D3B0D765
2 changed files with 18 additions and 2 deletions

View file

@ -7,7 +7,21 @@ inputs:
runs: runs:
using: 'composite' using: 'composite'
steps: steps:
- name: Restore cached version
id: cache-restore
uses: https://code.forgejo.org/actions/cache/restore@v4
with:
path: |
/nix/store
key: ${{ inputs.version }}-${{ hashFiles('flake.lock') }}
- run: ${{ github.action_path }}/install.sh - run: ${{ github.action_path }}/install.sh
shell: bash shell: bash
env: env:
INPUT_VERSION: ${{ inputs.version }} INPUT_VERSION: ${{ inputs.version }}
- name: Cache version
id: cache-put
uses: https://code.forgejo.org/actions/cache/save@v4
with:
path: |
/nix/store
key: ${{ inputs.version }}-${{ hashFiles('flake.lock') }}

View file

@ -1,6 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
# Sudo is required by this installer
apt-get update -qq
apt-get install -y sudo
if nix_path="$(type -p nix)" ; then if nix_path="$(type -p nix)" ; then
echo "Aborting: Nix is already installed at ${nix_path}" echo "Aborting: Nix is already installed at ${nix_path}"
exit exit
@ -79,8 +83,6 @@ else
# "fix" the following error when running nix* # "fix" the following error when running nix*
# error: the group 'nixbld' specified in 'build-users-group' does not exist # error: the group 'nixbld' specified in 'build-users-group' does not exist
add_config "build-users-group =" add_config "build-users-group ="
apt-get update -qq
apt-get install -y sudo
sudo mkdir -p /etc/nix sudo mkdir -p /etc/nix
sudo chmod 0755 /etc/nix sudo chmod 0755 /etc/nix
sudo cp "$workdir/nix.conf" /etc/nix/nix.conf sudo cp "$workdir/nix.conf" /etc/nix/nix.conf