mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 11:36:07 +01:00
feat: implement ruff as flake checks
Had to add `--impure` to the call due to the following error otherwise:
```
error:
… while checking flake output 'packages'
at /nix/store/5cjz7jyqyfr5vq8b6bjs24vdnvdhy9rb-source/flake.nix:118:7:
117|
118| packages = forEachSystem (system:
| ^
119| let
… while checking the derivation 'packages.x86_64-linux.bootstrap-aarch64'
at /nix/store/dg3hg3ksr5sl3adskxiwj7357z47ggvr-source/lib/attrsets.nix:977:47:
976| */
977| nameValuePair = name: value: { inherit name value; };
| ^
978|
(stack trace truncated; use '--show-trace' to show the full, detailed trace)
error: 'builtins.storePath' is not allowed in pure evaluation mode
```
This commit is contained in:
parent
bd677b46e6
commit
505cc019ae
4 changed files with 33 additions and 22 deletions
22
.github/workflows/lints.yml
vendored
22
.github/workflows/lints.yml
vendored
|
|
@ -5,7 +5,7 @@ on:
|
|||
schedule:
|
||||
- cron: 0 0 * * 1
|
||||
jobs:
|
||||
lint-nix:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
|
@ -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
checks/ruff-fmt.nix
Normal file
10
checks/ruff-fmt.nix
Normal file
|
|
@ -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
checks/ruff-lint.nix
Normal file
10
checks/ruff-lint.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ pkgs, checkRoot }:
|
||||
pkgs.runCommandLocal "ruff-lint"
|
||||
{
|
||||
src = ./.;
|
||||
nativeBuildInputs = with pkgs; [ ruff ];
|
||||
}
|
||||
''
|
||||
cd ${checkRoot};
|
||||
ruff check --no-cache && mkdir $out
|
||||
''
|
||||
13
flake.nix
13
flake.nix
|
|
@ -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});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue