forked from Gerschtli/nix-config
-
Notifications
You must be signed in to change notification settings - Fork 1
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
160 additions
and
32 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 |
---|---|---|
@@ -0,0 +1,137 @@ | ||
name: Build and test flake devshells (using gh caches) | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
workflow_call: | ||
inputs: | ||
branch: | ||
description: Branch name to build on | ||
default: "" | ||
required: false | ||
type: string | ||
secrets: | ||
CACHIX_ACTIVATE_TOKEN: | ||
CACHIX_AUTH_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
nix: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
yamlbasename: | ||
- ci_shells.yml | ||
os: | ||
- ubuntu-latest | ||
system: | ||
- aarch64 | ||
- x86_64 | ||
include: | ||
shell: devShells.$_system.ghcwasm | ||
command: ghc --version | ||
shell: devShells.$_system.commonlisp | ||
command: sbcl --version | ||
shell: devShells.$_system.rustwasm32 | ||
command: rustc --version | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.branch }} | ||
|
||
- name: Free Disk Space (Ubuntu) | ||
if: contains(matrix.shell, 'ruby') | ||
env: | ||
_system: ${{ matrix.system }}-linux | ||
uses: jlumbroso/free-disk-space@main | ||
continue-on-error: true | ||
with: | ||
tool-cache: true | ||
|
||
- name: Set Swap Space | ||
uses: actionhippie/swap-space@master | ||
with: | ||
size: 20G | ||
|
||
- name: Install qemu-user-static (aarch64) | ||
if: matrix.system == 'aarch64' | ||
env: | ||
_system: ${{ matrix.system }}-linux | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
sudo apt-get update --allow-releaseinfo-change | ||
sudo apt-get update | ||
sudo apt-get install -y qemu-user-static | ||
- name: Quick install | ||
env: | ||
_system: ${{ matrix.system }}-linux | ||
uses: cachix/install-nix-action@v29 | ||
with: | ||
install_url: 'https://releases.nixos.org/nix/nix-2.24.8/install' | ||
extra_nix_config: | | ||
substituters = https://cache.nixos.org/ https://nix-community.cachix.org | ||
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= | ||
keep-going = true | ||
show-trace = true | ||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | ||
keep-outputs = true | ||
${{ matrix.system == 'aarch64' && 'system = aarch64-linux # enables binfmt on that machine, see https://nixos.wiki/wiki/NixOS_on_ARM#Compiling_through_binfmt_QEMU' || '' }} | ||
- name: Restore and cache Nix store | ||
env: | ||
_system: ${{ matrix.system }}-linux | ||
uses: nix-community/cache-nix-action@v5 | ||
with: | ||
# save a new cache every time ci file changes | ||
primary-key: cache-${{ matrix.os }}-${{ hashFiles('.github/workflows/ci.yaml') }} | ||
restore-prefixes-first-match: cache-${{ matrix.os }}- | ||
# do purge caches | ||
purge: true | ||
# purge all versions of the cache | ||
purge-prefixes: cache-${{ matrix.os }}- | ||
# created more than 0 seconds ago relative to the start of the `Post Restore` phase | ||
purge-created: 0 | ||
# except the version with the `primary-key`, if it exists | ||
purge-primary-key: never | ||
# and collect garbage in the Nix store until it reaches this size in bytes | ||
gc-max-store-size: 8000000000 | ||
|
||
- name: Setup cachix | ||
env: | ||
_system: ${{ matrix.system }}-linux | ||
uses: cachix/cachix-action@v15 | ||
with: | ||
name: 573-bc | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
||
- name: My shells | ||
env: | ||
_system: ${{ matrix.system }}-linux | ||
uses: nicknovitski/[email protected] | ||
with: | ||
arguments: .#${{ (matrix.shell == '') && format('formatter.{0}', env._system) || matrix.shell }} --impure | ||
- run: | | ||
echo "::group::Development shells command" | ||
cachix use 573-bc | ||
cachix use nix-on-droid | ||
${{ (matrix.system == 'aarch64' || contains(matrix.shell, 'ruby')) && 'cachix watch-exec 573-bc -- \' || '' }} | ||
${{ matrix.command }} | ||
- name: Deploy cachix-agent spec | ||
if: github.ref == 'refs/heads/wsl2' && matrix.deploy-agent | ||
env: | ||
CACHIX_ACTIVATE_TOKEN: ${{ secrets.CACHIX_ACTIVATE_TOKEN }} | ||
TEST: ${{ matrix.system == 'aarch64' && '--impure' || '' }} | ||
run: | | ||
echo "::group::Build spec" | ||
spec="$(nix build --print-out-paths ".#cachix-deploy-spec-${{ matrix.deploy-agent }}" ${{ (matrix.system == 'aarch64' || contains(matrix.nix-command, 'develop')) && '--impure' || '' }})" | ||
echo "::group::Upload spec" | ||
cachix push 573-bc "$spec" | ||
# vim: set sw=2: |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ system, pkgsFor, name, args, ... }: | ||
# https://github.com/tweag/ormolu/blob/74887f00137d6cd91811440325c3ac330a371b2c/ormolu-live/default.nix | ||
let | ||
inherit (args) unstable ghc-wasm-meta; | ||
pkgs = unstable; | ||
pkgs = pkgsFor.${system}; | ||
in | ||
pkgs.mkShell { | ||
packages = [ ghc-wasm-meta ]; | ||
inherit name; | ||
packages = [ args.ghc-wasm-meta ]; | ||
} |
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