Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
schedule:
- cron: 0 0 * * 1
jobs:
lint-nix:
check:
runs-on: ubuntu-latest

steps:
Expand All @@ -15,21 +15,5 @@ jobs:
- name: Install nix
uses: cachix/install-nix-action@v25

- name: Run nix-formatter-pack-check
run: nix build .#checks.x86_64-linux.nix-formatter-pack-check

lint-py:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install nix
uses: cachix/install-nix-action@v25

- name: Run ruff linter
run: nix run 'nixpkgs#ruff' -- check

- name: Run ruff formatter
run: nix run 'nixpkgs#ruff' -- format --diff
- name: Run flake checks
run: nix flake check --impure -L
10 changes: 10 additions & 0 deletions checks/ruff-fmt.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ pkgs, checkRoot }:
pkgs.runCommandLocal "ruff-fmt"
{
src = ./.;
nativeBuildInputs = with pkgs; [ ruff ];
}
''
cd ${checkRoot};
ruff format --no-cache --diff && mkdir $out
''
10 changes: 10 additions & 0 deletions checks/ruff-lint.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{ pkgs, checkRoot }:
pkgs.runCommandLocal "ruff-lint"
{
src = ./.;
nativeBuildInputs = with pkgs; [ ruff ];
}
''
cd ${checkRoot};
ruff check --no-cache && mkdir $out
''
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,16 @@
};
});

checks = forEachSystem (system: {
nix-formatter-pack-check = nix-formatter-pack.lib.mkCheck formatterPackArgsFor.${system};
});
checks = forEachSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
nix-formatter-pack-check = nix-formatter-pack.lib.mkCheck formatterPackArgsFor.${system};
ruff-lint = import ./checks/ruff-lint.nix { inherit pkgs; checkRoot = ./.; };
ruff-fmt = import ./checks/ruff-fmt.nix { inherit pkgs; checkRoot = ./.; };
}
);

formatter = forEachSystem (system: nix-formatter-pack.lib.mkFormatter formatterPackArgsFor.${system});

Expand Down
Loading