From 50e96ca6b4b0f29ff5e20e7873381270f03e7e37 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Fri, 14 Jun 2024 11:54:03 -0500 Subject: [PATCH] setup nix flake check to run before build --- .github/workflows/checks.yml | 50 ++++++++++++++++++++++++++++++++++++ .github/workflows/push.yml | 4 +++ lib/default.nix | 24 +++++++++++++++++ todo.md | 11 ++++---- 4 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/checks.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml new file mode 100644 index 0000000..ca53135 --- /dev/null +++ b/.github/workflows/checks.yml @@ -0,0 +1,50 @@ +name: Run Nix Flake Checks + +on: + workflow_dispatch: + inputs: + lockFile: + description: 'flake.lock file' + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }}-${{ inputs.host }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + # The default disk size of these runners is ~14GB + # Cleanup the disk, see upstream discussion https://github.com/actions/runner-images/issues/2840. + - name: Cleanup Disk Space + run: | + echo "Before removing files:" + df -h + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf /opt + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + echo "After removing files:" + df -h + + - uses: actions/checkout@v4 + + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@v2 + + - uses: cachix/cachix-action@v14 + with: + name: daylin + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + + - name: write lock file + if: "${{ inputs.lockFile != '' }}" + run: | + echo '${{ inputs.lockFile }}' > flake.lock + git diff + + - name: Build + run: | + cachix watch-exec daylin -- nix build '.#checks.x86_64-linux.packageCheck' diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6873317..955e620 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -9,6 +9,10 @@ on: - main jobs: + checks: + uses: ./.github/workflows/checks.yml + secrets: inherit + build: strategy: max-parallel: 1 diff --git a/lib/default.nix b/lib/default.nix index 35300e3..b4b865b 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -28,6 +28,17 @@ rec { nixosModules = listToAttrs (findModulesList ../modules); + mkPackageCheck = + { packages, pkgs }: + pkgs.runCommandLocal "build-third-party" + { + src = ./.; + nativeBuildInputs = [ packages ]; + } + '' + mkdir "$out" + ''; + mkSystem = hostName: nixosSystem { @@ -74,5 +85,18 @@ rec { packages = oizysPkg; devShells = devShells; formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); + checks = forAllSystems (pkgs: { + packageCheck = mkPackageCheck { + inherit pkgs; + # make sure lix is in this? + packages = [ + pkgs.pixi + pkgs.swww + + inputs.roc.packages.${pkgs.system}.full + inputs.roc.packages.${pkgs.system}.lang-server + ]; + }; + }); }; } diff --git a/todo.md b/todo.md index 0ddc714..0f2e697 100644 --- a/todo.md +++ b/todo.md @@ -1,10 +1,5 @@ # oizys todo's - -## nix expr - -- [ ] find out why pixi on GHA is different from local (possibly from the fetch git step?) - ## software - [ ] lid closed does not engage hyprlock? @@ -17,4 +12,10 @@ > kernel: ucsi_acpi USBC000:00: possible UCSI driver bug 2 > kernel: ucsi_acpi USBC000:00: error -EINVAL: PPM init failed + +GHA is running out of space to build `othalan`. +I really just want the CI to pre-compile a subset of the packages. +Currently, it just burns resources downloading packages over and over again. +Maybe I could use nix flake checks to accomplish this? +