name: build and cache machines and homes on: workflow_dispatch: push: pull_request: env: ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }} NIX_CONFIG: | show-trace = true extra-substituters = https://cdn.cy7.sh/main extra-trusted-public-keys = main:Ku31HoEWcBtfggge2VGj+QTkVrQuIwRIMGyfV/5VQP0= experimental-features = nix-command flakes accept-flake-config = true system-features = nixos-test benchmark big-parallel kvm TERM: ansi jobs: build-machines: strategy: fail-fast: false matrix: machine: - chunk - ytnix os: - ubuntu-latest runs-on: ${{ matrix.os }} steps: - name: Maximize build disk space uses: easimon/maximize-build-space@v10 with: overprovision-lvm: true swap-size-mb: 1024 remove-dotnet: 'true' remove-android: 'true' remove-haskell: 'true' remove-codeql: 'true' remove-docker-images: 'true' build-mount-path: /nix - name: Install Nix uses: cachix/install-nix-action@v30 - name: Sync repository uses: actions/checkout@v4 with: persist-credentials: false - name: setup attic run: | nix profile install github:zhaofengli/attic attic login cy7 https://cache.cy7.sh "$ATTIC_TOKEN" - name: build run: | package=".#nixosConfigurations."${{ matrix.machine }}".config.system.build.toplevel" nix build -L "$package" - name: cache if: always() run: | package=".#nixosConfigurations."${{ matrix.machine }}".config.system.build.toplevel" derivation="$(nix path-info --derivation "$package")" cache="$(nix-store --query --requisites --include-outputs "$derivation")" xargs attic push main <<< "$cache" build-homes: strategy: fail-fast: false matrix: home: - yt@ytnix - yt@chunk os: - ubuntu-latest # - macos-latest runs-on: ${{ matrix.os }} steps: - name: Maximize build disk space uses: easimon/maximize-build-space@v10 with: overprovision-lvm: true swap-size-mb: 1024 remove-dotnet: 'true' remove-android: 'true' remove-haskell: 'true' remove-codeql: 'true' remove-docker-images: 'true' build-mount-path: /nix - name: Install Nix uses: cachix/install-nix-action@v30 - name: Sync repository uses: actions/checkout@v4 with: persist-credentials: false - name: setup attic run: | nix profile install github:zhaofengli/attic attic login cy7 https://cache.cy7.sh "$ATTIC_TOKEN" - name: build run: | package=".#homeConfigurations."${{ matrix.home }}".activationPackage" nix build -L "$package" - name: cache if: always() run: | package=".#homeConfigurations."${{ matrix.home }}".activationPackage" derivation="$(nix path-info --derivation "$package")" cache="$(nix-store --query --requisites --include-outputs "$derivation")" xargs attic push main <<< "$cache"