-
-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
94 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,35 @@ | ||
name: Nix Installer | ||
description: Nix Installer | ||
|
||
inputs: | ||
cache-unique-id: | ||
description: Unique ID to differentiate caches | ||
required: true | ||
|
||
outputs: | ||
cache-hit: | ||
description: "Indicate if cache is hit" | ||
description: Whether the cache was restored or not | ||
value: ${{ steps.nix-cache.outputs.cache-hit }} | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@3ebd1aebb47f95493b62de6eec0cac3cd74e50a9 | ||
|
||
- name: Cache Nix Store | ||
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 | ||
- name: Cache nix env take N+1 | ||
uses: actions/cache@v2 | ||
id: nix-cache | ||
with: | ||
path: /tmp/nixcache | ||
key: cache-nix-${{ github.workflow }}-${{ github.job }}-${{ hashFiles('**/flake.lock') }} | ||
path: | | ||
/tmp/nix-cache | ||
key: nix-cache-${{ runner.os }}-${{ github.workflow }}-${{ github.job }}-${{ inputs.cache-unique-id }}-${{ hashFiles('**/flake.lock') }} | ||
|
||
- name: Restore Nix Cache | ||
shell: bash | ||
- name: cache hit | ||
if: steps.nix-cache.outputs.cache-hit == 'true' | ||
run: nix copy --from /tmp/nixcache | ||
shell: bash | ||
run: | | ||
sudo chown -R 777 /tmp/nix-cache | ||
sudo chown -R 777 /nix | ||
sudo cp -fRT /tmp/nix-cache/ /nix/ | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@3ebd1aebb47f95493b62de6eec0cac3cd74e50a9 | ||
|
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,20 @@ | ||
name: Nix Cache | ||
description: Cache Nix File To Temporary Directory | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- shell: bash | ||
run: | | ||
sudo systemctl stop nix-daemon | ||
sudo cp -r /nix /tmp/nix-cache | ||
sudo rm -rf /tmp/nix-cache/var/nix/daemon-socket/socket | ||
sudo rm -rf /tmp/nix-cache/var/nix/userpool | ||
sudo rm -rf /tmp/nix-cache/var/nix/gc.lock | ||
sudo rm -rf /tmp/nix-cache/var/nix/db/big-lock | ||
sudo rm -rf /tmp/nix-cache/var/nix/db/reserved | ||
sudo rm -rf /tmp/nix-cache/var/nix/userpool2 | ||
sudo chown -R 777 /tmp/nix-cache | ||
ls -al /tmp/nix-cache |
This file was deleted.
Oops, something went wrong.
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