This commit is contained in:
Philippe Laflamme 2025-07-11 19:10:02 +00:00 committed by GitHub
commit 991a26a3d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 42 additions and 31 deletions

View file

@ -5,7 +5,7 @@ on:
schedule: schedule:
- cron: 0 0 * * 1 - cron: 0 0 * * 1
jobs: jobs:
lint-nix: check:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -15,21 +15,5 @@ jobs:
- name: Install nix - name: Install nix
uses: cachix/install-nix-action@v25 uses: cachix/install-nix-action@v25
- name: Run nix-formatter-pack-check - name: Run flake checks
run: nix build .#checks.x86_64-linux.nix-formatter-pack-check run: nix flake check --impure -L
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

10
checks/ruff-fmt.nix Normal file
View 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
View file

@ -0,0 +1,10 @@
{ pkgs, checkRoot }:
pkgs.runCommandLocal "ruff-lint"
{
src = ./.;
nativeBuildInputs = with pkgs; [ ruff ];
}
''
cd ${checkRoot};
ruff check --no-cache && mkdir $out
''

18
flake.lock generated
View file

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1709445365, "lastModified": 1752256062,
"narHash": "sha256-DVv6nd9FQBbMWbOmhq0KVqmlc3y3FMSYl49UXmMcO+0=", "narHash": "sha256-2s0PrY3vIFusm4UrqPnskY6SgdVolEDAz9wHcCSadcw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "4de84265d7ec7634a69ba75028696d74de9a44a7", "rev": "b8b7e5ec3570eb003d55f4947dd39af15c3ca98d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -31,11 +31,11 @@
"nmt": "nmt" "nmt": "nmt"
}, },
"locked": { "locked": {
"lastModified": 1705252799, "lastModified": 1742249870,
"narHash": "sha256-HgSTREh7VoXjGgNDwKQUYcYo13rPkltW7IitHrTPA5c=", "narHash": "sha256-U37ECk3zpfp92D3H0gzfWPyb5sf0RdOdublCq1zjq+w=",
"owner": "Gerschtli", "owner": "Gerschtli",
"repo": "nix-formatter-pack", "repo": "nix-formatter-pack",
"rev": "2de39dedd79aab14c01b9e2934842051a160ffa5", "rev": "fe5b4498e3161191bd93fe0683dff347f6f689df",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -46,11 +46,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1708172716, "lastModified": 1752259019,
"narHash": "sha256-3M94oln0b61m3dUmLyECCA9hYAHXZEszM4saE3CmQO4=", "narHash": "sha256-XHjyWQjmXCaoU36cTPO6QRemYNTgIRyyKiy0pDwk7c4=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5d874ac46894c896119bce68e758e9e80bdb28f1", "rev": "1cf71b641e2358e0f92536b5df0a72a8c05edb05",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -63,9 +63,16 @@
}; };
}); });
checks = forEachSystem (system: { checks = forEachSystem (system:
nix-formatter-pack-check = nix-formatter-pack.lib.mkCheck formatterPackArgsFor.${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}); formatter = forEachSystem (system: nix-formatter-pack.lib.mkFormatter formatterPackArgsFor.${system});