diff --git a/.github/workflows/build-and-cache.yml b/.github/workflows/build-and-cache.yml index dc7c4406..66469629 100644 --- a/.github/workflows/build-and-cache.yml +++ b/.github/workflows/build-and-cache.yml @@ -24,8 +24,6 @@ jobs: name: thiagokokada-nix-configs - name: Set default git branch (to reduce log spam) run: git config --global init.defaultBranch master - - name: Check if all `.nix` files are formatted correctly - run: nix run '.#formatCheck' - name: 'Build Home-Manager configs for: home-linux, steamdeck' run: |- nix build --print-build-logs '.#homeConfigurations.home-linux.activationPackage' diff --git a/.github/workflows/validate-flakes.yml b/.github/workflows/validate-flakes.yml new file mode 100644 index 00000000..dd556829 --- /dev/null +++ b/.github/workflows/validate-flakes.yml @@ -0,0 +1,30 @@ +jobs: + build-linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v22 + with: + extra_nix_config: access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} + nix_path: nixpkgs=channel:nixos-unstable + - name: Setup aarch64-linux + run: | + DEBIAN_FRONTEND=noninteractive + sudo apt-get update -q -y + sudo apt-get install -q -y qemu-system-aarch64 qemu-efi binfmt-support qemu-user-static + sudo sh -c "echo 'system-features = aarch64-linux' >> /etc/nix/nix.conf" + - uses: cachix/cachix-action@v12 + with: + authToken: ${{ secrets.CACHIX_TOKEN }} + extraPullNames: nix-community + name: thiagokokada-nix-configs + - name: Set default git branch (to reduce log spam) + run: git config --global init.defaultBranch master + - name: Check if all `.nix` files are formatted correctly + run: nix run '.#formatCheck' + - name: Validate Flakes + run: nix flake check +name: validate-flakes +"on": + - push + - workflow_dispatch diff --git a/actions/build-and-cache.nix b/actions/build-and-cache.nix index c597bed4..197b6d69 100644 --- a/actions/build-and-cache.nix +++ b/actions/build-and-cache.nix @@ -15,8 +15,6 @@ with constants; installNixActionStep cachixActionStep setDefaultGitBranchStep - checkNixStep - # validateFlakesStep (buildHomeManagerConfigurations { }) (buildNixOSConfigurations { }) ]; diff --git a/actions/steps.nix b/actions/steps.nix index 60ae79d1..9630c93f 100644 --- a/actions/steps.nix +++ b/actions/steps.nix @@ -104,4 +104,13 @@ with constants; diffIds)); }; }; + setupAarch64 = { + name = "Setup aarch64-linux"; + run = '' + DEBIAN_FRONTEND=noninteractive + sudo apt-get update -q -y + sudo apt-get install -q -y qemu-system-aarch64 qemu-efi binfmt-support qemu-user-static + sudo sh -c "echo 'system-features = aarch64-linux' >> /etc/nix/nix.conf" + ''; + }; } diff --git a/actions/validate-flakes.nix b/actions/validate-flakes.nix new file mode 100644 index 00000000..afead26a --- /dev/null +++ b/actions/validate-flakes.nix @@ -0,0 +1,23 @@ +let + steps = import ./steps.nix; + constants = import ./constants.nix; +in +with constants; +{ + name = "validate-flakes"; + on = [ "push" "workflow_dispatch" ]; + jobs = { + build-linux = { + inherit (ubuntu) runs-on; + steps = with steps; [ + checkoutStep + installNixActionStep + setupAarch64 + cachixActionStep + setDefaultGitBranchStep + checkNixStep + validateFlakesStep + ]; + }; + }; +} diff --git a/flake.nix b/flake.nix index 8a98f455..e64abc54 100644 --- a/flake.nix +++ b/flake.nix @@ -179,6 +179,7 @@ "build-and-cache" "update-flakes" "update-flakes-darwin" + "validate-flakes" ]) ]); # END recursiveMergeAttrs }