From 6efdad5e666dac219da722f2e8cc6673db64d027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jalil=20David=20Salam=C3=A9=20Messina?= Date: Wed, 11 Sep 2024 08:56:51 +0200 Subject: [PATCH] fix: the small things * small typo on the flake description * crane went full lib mode so it doesn't have any inputs to override * `treefmt` warns on `nixfmt-rfc-style` as its `nixfmt` module is also `nixfmt-rfc-style`, switch to the `nixfmt` module. * `pre-commit-hooks` uses `nixfmt-classic` when requesting `nixfmt` so we need to filter out `nixfmt` and enable `nixfmt-rfc-style` manually. * there was an unneeded with statement warning from `nixd` Signed-off-by: Jalil David Salame Messina --- .config/treefmt.nix | 2 +- flake.nix | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.config/treefmt.nix b/.config/treefmt.nix index 7729ec0..b92d4c6 100644 --- a/.config/treefmt.nix +++ b/.config/treefmt.nix @@ -5,7 +5,7 @@ { projectRootFile = "Cargo.toml"; programs = { - nixfmt-rfc-style.enable = true; # nix + nixfmt.enable = true; # nix statix.enable = true; # nix static analysis deadnix.enable = true; # find dead nix code rustfmt.enable = true; # rust diff --git a/flake.nix b/flake.nix index eb3c1f6..7b144c8 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ # SPDX-License-Identifier: EUPL-1.2 { - description = "Nix Weather - Check Cache Availablility of NixOS Configurations"; + description = "Nix Weather - Check Cache Availability of NixOS Configurations"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; @@ -13,10 +13,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - crane = { - url = "github:ipetkov/crane"; - inputs.nixpkgs.follows = "nixpkgs"; - }; + crane.url = "github:ipetkov/crane"; fenix = { url = "github:nix-community/fenix"; @@ -244,7 +241,10 @@ pre-commit-check = let # some treefmt formatters are not supported in pre-commit-hooks we filter them out for now. - toFilter = [ "yamlfmt" ]; + toFilter = [ + "yamlfmt" + "nixfmt" + ]; filterFn = n: _v: (!builtins.elem n toFilter); treefmtFormatters = pkgs.lib.mapAttrs (_n: v: { inherit (v) enable; }) ( pkgs.lib.filterAttrs filterFn (import ./.config/treefmt.nix).programs @@ -255,10 +255,12 @@ hooks = treefmtFormatters // { # not in treefmt convco.enable = true; + # named nixfmt in treefmt (which defaults to nixfmt-classic for pre-commit-hooks) + nixfmt-rfc-style.enable = true; reuse = { enable = true; name = "reuse"; - entry = with pkgs; "${pkgs.reuse}/bin/reuse lint"; + entry = with pkgs; "${reuse}/bin/reuse lint"; pass_filenames = false; }; };