Skip to content

Commit

Permalink
actions: add separate validate flakes step
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Sep 20, 2023
1 parent 64b1f0b commit 4638375
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 4 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build-and-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/validate-flakes.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 0 additions & 2 deletions actions/build-and-cache.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ with constants;
installNixActionStep
cachixActionStep
setDefaultGitBranchStep
checkNixStep
# validateFlakesStep
(buildHomeManagerConfigurations { })
(buildNixOSConfigurations { })
];
Expand Down
9 changes: 9 additions & 0 deletions actions/steps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"
'';
};
}
23 changes: 23 additions & 0 deletions actions/validate-flakes.nix
Original file line number Diff line number Diff line change
@@ -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
];
};
};
}
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@
"build-and-cache"
"update-flakes"
"update-flakes-darwin"
"validate-flakes"
])
]); # END recursiveMergeAttrs
}

0 comments on commit 4638375

Please sign in to comment.