Skip to content

Commit

Permalink
Add configuration builds to flake checks
Browse files Browse the repository at this point in the history
  • Loading branch information
rake5k committed Jan 8, 2023
1 parent 1bdd42c commit 4f4de3d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 37 deletions.
16 changes: 1 addition & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,4 @@ jobs:
uses: christianharke/flake-commons/.github/workflows/nix-ci.yml@main
with:
branch: master
nix-ci-nixos-vm:
uses: christianharke/flake-commons/.github/workflows/nix-ci.yml@main
with:
branch: master
nix-command: build .#nixosConfigurations.nixos-vm.config.system.build.toplevel
nix-ci-non-nixos-vm-christian:
uses: christianharke/flake-commons/.github/workflows/nix-ci.yml@main
with:
branch: master
nix-command: build --impure .#homeConfigurations."christian@non-nixos-vm".activationPackage
nix-ci-non-nixos-vm-demo:
uses: christianharke/flake-commons/.github/workflows/nix-ci.yml@main
with:
branch: master
nix-command: build --impure .#homeConfigurations."demo@non-nixos-vm".activationPackage
nix-command: flake check --impure
1 change: 1 addition & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ jobs:
uses: christianharke/flake-commons/.github/workflows/nix-update.yml@main
with:
base-branch: master
nix-check-command: flake check --impure
50 changes: 28 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
rootPath = ./.;
};

inherit (nixpkgs.lib) listToAttrs;
inherit (nixpkgs.lib) listToAttrs recursiveUpdate;
inherit (flakeLib) eachSystem mkHome mkNixos;
in
{
Expand Down Expand Up @@ -163,27 +163,33 @@
})
];

checks = listToAttrs [
(mkGeneric "pre-commit-check" (system: inputs.pre-commit-hooks.lib."${system}".run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
shellcheck.enable = true;
statix.enable = true;
};
}))

(mkCheck "shellcheck" {
script = mkShellCheck;
})

(mkCheck "nixpkgs-fmt" {
script = pkgs: ''
shopt -s globstar
${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check ${./.}/**/*.nix
'';
})
];
checks = recursiveUpdate
(listToAttrs [
(mkGeneric "pre-commit-check" (system: inputs.pre-commit-hooks.lib."${system}".run {
src = ./.;
hooks = {
nixpkgs-fmt.enable = true;
shellcheck.enable = true;
statix.enable = true;
};
}))

(mkCheck "shellcheck" {
script = mkShellCheck;
})

(mkCheck "nixpkgs-fmt" {
script = pkgs: ''
shopt -s globstar
${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check ${./.}/**/*.nix
'';
})
])
{
"build-nixos-vm" = self.nixosConfigurations.nixos-vm.config.system.build.toplevel;
"build-demo@non-nixos-vm" = self.homeConfigurations."demo@non-nixos-vm".activationPackage;
"build-christian@non-nixos-vm" = self.homeConfigurations."christian@non-nixos-vm".activationPackage;
};

devShells = listToAttrs [
(mkDevShell "default" {
Expand Down

0 comments on commit 4f4de3d

Please sign in to comment.