diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index dd4fbb1ea7..5b29fe46cd 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -23,6 +23,11 @@ jobs: - name: Setup 3rd party dependencies uses: ./.github/actions/setup-dependencies + - name: Setup Nix + uses: cachix/install-nix-action@v30 + with: + install_url: https://releases.nixos.org/nix/nix-2.18.8/install + - name: Check pre-commit hook uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 32addbddfb..b8091d86e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,17 @@ repos: types_or: [python, pyi] require_serial: true entry: poetry run ruff format --force-exclude + - id: nixfmt + name: Format Nix (nixfmt) + types: [nix] + language: system + require_serial: true + entry: bash -c 'command -v nix && nix "$@" || echo "skipping nixfmt"' nix + args: + - --experimental-features + - nix-command flakes + - --accept-flake-config + - fmt - repo: https://github.com/jendrikseipp/vulture rev: v2.7 @@ -36,11 +47,6 @@ repos: - id: vulture name: Check vulture - - repo: https://github.com/nix-community/nixpkgs-fmt - rev: v1.3.0 - hooks: - - id: nixpkgs-fmt - - repo: https://github.com/python-jsonschema/check-jsonschema rev: 0.21.0 hooks: diff --git a/flake.nix b/flake.nix index 30b0dad86e..3b923077de 100644 --- a/flake.nix +++ b/flake.nix @@ -83,5 +83,7 @@ }); legacyPackages = forAllSystems (system: nixpkgsFor.${system}); + + formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style); }; }