Skip to content

Commit

Permalink
move checks out of flake.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
nzbr committed Nov 10, 2022
1 parent 91d0353 commit 3bcd5ba
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 8 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:

- name: Run checks 📋
run: |
nix flake check
nix flake check -L
tests:
needs:
Expand Down
8 changes: 8 additions & 0 deletions checks/nixpkgs-fmt.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ runCommand
, nixpkgs-fmt
, ...
}:
runCommand "check-nixpkgs-fmt" { nativeBuildInputs = [ nixpkgs-fmt ]; } ''
nixpkgs-fmt --check ${./..}
touch $out
''
8 changes: 8 additions & 0 deletions checks/shfmt.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{ runCommand
, shfmt
, ...
}:
runCommand "check-shfmt" { nativeBuildInputs = [ shfmt ]; } ''
shfmt -i 2 -d ${./../scripts}/*.sh
touch $out
''
15 changes: 8 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@
pkgs = import nixpkgs { inherit system; };
in
{
checks = {
check-format = pkgs.runCommand "check-format" { nativeBuildInputs = with pkgs; [ nixpkgs-fmt shfmt ]; } ''
nixpkgs-fmt --check ${./.}
shfmt -i 2 -d ${./scripts}/*.sh
mkdir $out # success
'';
};
checks =
let
args = { inherit self; };
in
{
nixpkgs-fmt = pkgs.callPackage ./checks/nixpkgs-fmt.nix args;
shfmt = pkgs.callPackage ./checks/shfmt.nix args;
};

devShell = pkgs.mkShell {
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
Expand Down

0 comments on commit 3bcd5ba

Please sign in to comment.