setup nix flake check to run before build

This commit is contained in:
Daylin Morgan 2024-06-14 11:54:03 -05:00
parent 1fe009085b
commit 50e96ca6b4
Signed by: daylin
GPG key ID: 950D13E9719334AD
4 changed files with 84 additions and 5 deletions

50
.github/workflows/checks.yml vendored Normal file
View file

@ -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'

View file

@ -9,6 +9,10 @@ on:
- main
jobs:
checks:
uses: ./.github/workflows/checks.yml
secrets: inherit
build:
strategy:
max-parallel: 1

View file

@ -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
];
};
});
};
}

11
todo.md
View file

@ -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?
<!-- generated with <3 by daylinmorgan/todo -->