diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-09-29 23:22:43 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-10-01 11:50:33 +0000 |
commit | ee0e200a153cf8cccf3027e417012d0e03f4d81a (patch) | |
tree | e6805d024aee5dea7084859724fe6ab51b9e1d5e /modules/nixos-apple-silicon/.github | |
parent | 2cc67706f134018c6876d57d619e3cda02286c0e (diff) | |
parent | 096dc63e5426e17f70b4a8bf7716c3dd3430ba8c (diff) | |
download | nixlib-ee0e200a153cf8cccf3027e417012d0e03f4d81a.tar nixlib-ee0e200a153cf8cccf3027e417012d0e03f4d81a.tar.gz nixlib-ee0e200a153cf8cccf3027e417012d0e03f4d81a.tar.bz2 nixlib-ee0e200a153cf8cccf3027e417012d0e03f4d81a.tar.lz nixlib-ee0e200a153cf8cccf3027e417012d0e03f4d81a.tar.xz nixlib-ee0e200a153cf8cccf3027e417012d0e03f4d81a.tar.zst nixlib-ee0e200a153cf8cccf3027e417012d0e03f4d81a.zip |
Add 'modules/nixos-apple-silicon/' from commit '096dc63e5426e17f70b4a8bf7716c3dd3430ba8c'
git-subtree-dir: modules/nixos-apple-silicon git-subtree-mainline: 2cc67706f134018c6876d57d619e3cda02286c0e git-subtree-split: 096dc63e5426e17f70b4a8bf7716c3dd3430ba8c
Diffstat (limited to 'modules/nixos-apple-silicon/.github')
-rw-r--r-- | modules/nixos-apple-silicon/.github/workflows/installer.yml | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/modules/nixos-apple-silicon/.github/workflows/installer.yml b/modules/nixos-apple-silicon/.github/workflows/installer.yml new file mode 100644 index 000000000000..2fe0b6d0655b --- /dev/null +++ b/modules/nixos-apple-silicon/.github/workflows/installer.yml @@ -0,0 +1,82 @@ +name: build bootstrap installer + +on: + push: + tags: + - 'release-*' + + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - uses: cachix/install-nix-action@v18 + with: + install_url: https://releases.nixos.org/nix/nix-2.13.2/install + nix_path: nixpkgs=channel:nixos-unstable + extra_nix_config: | + # save space on disk and in cache + auto-optimise-store = true + # keep all store paths necessary to build the outputs + keep-outputs = true + keep-derivations = true + + - name: cache nix store + id: cache-nix-store + uses: actions/cache@v3 + with: + key: installer5-${{ github.sha }} + restore-keys: | + installer5 + path: | + nix_store_dir + nix_store_db.sqlite + + - name: restore cached nix store + run: | + if [ -e nix_store_db.sqlite ]; then + sudo systemctl stop nix-daemon + + # put cached store paths back in their proper locations + sudo rm -rf /nix/store /nix/var/nix/db/db.sqlite + sudo mv nix_store_dir /nix/store + sudo cp nix_store_db.sqlite /nix/var/nix/db/db.sqlite + + # fix store permissions + sudo chmod 1775 /nix/store + sudo chown root:nixbld /nix/store + sudo chmod 0644 /nix/var/nix/db/db.sqlite + sudo chown -R root:root /nix/store /nix/var/nix/db/db.sqlite + + sudo systemctl start nix-daemon + fi + + - name: build installer + run: | + nix build --extra-experimental-features 'nix-command flakes' .#installer-bootstrap -j2 -L + cp result/iso/*.iso $(basename result/iso/*.iso | sed s/aarch64-linux/apple-silicon-${{ github.ref_name }}/) + + - uses: actions/upload-artifact@v3 + with: + name: installer + path: ./*.iso + + - uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: ./*.iso + + - name: prepare nix store for caching + run: | + # delete old stuff not relevant to this build + nix-collect-garbage + sudo systemctl stop nix-daemon + + # move store to a place where the cache action can read it + sudo mv /nix/store nix_store_dir + sudo mv /nix/var/nix/db/db.sqlite nix_store_db.sqlite + |