From 515d252eb3c382e0ecc6c8158a6a75f191da3f2a Mon Sep 17 00:00:00 2001 From: Sander Date: Tue, 20 Aug 2024 12:24:12 +0000 Subject: [PATCH] fix: switch nixfmt to nixfmt-classic --- modules/hooks.nix | 2 +- nix/tools.nix | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/hooks.nix b/modules/hooks.nix index 480f0262..2c21ae8a 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -2861,7 +2861,7 @@ lib.escapeShellArgs (lib.concatMap (ext: [ "--ghc-opt" "-X${ext}" ]) hooks.ormol { name = "nixfmt"; description = "Nix code prettifier."; - package = tools.nixfmt; + package = tools.nixfmt-classic; entry = "${hooks.nixfmt.package}/bin/nixfmt ${lib.optionalString (hooks.nixfmt.settings.width != null) "--width=${toString hooks.nixfmt.settings.width}"}"; files = "\\.nix$"; }; diff --git a/nix/tools.nix b/nix/tools.nix index 83528ae0..c3eb9d92 100644 --- a/nix/tools.nix +++ b/nix/tools.nix @@ -45,6 +45,8 @@ , mdsh , nil , nixfmt +, nixfmt-classic ? null +, nixfmt-rfc-style ? null , nixpkgs-fmt , nodePackages , ocamlPackages @@ -131,7 +133,6 @@ in mdl mdsh nil - nixfmt nixpkgs-fmt ormolu pre-commit-hook-ensure-sops @@ -201,4 +202,9 @@ in checkmake = if stdenv.isLinux || checkmake.version >= "0.2.2" then checkmake else null; headache = callPackage ./headache { }; + + # nixfmt was renamed to nixfmt-classic in 24.05. + # nixfmt may be replaced by nixfmt-rfc-style in the future. + nixfmt = if nixfmt-classic == null then nixfmt else nixfmt-classic; + inherit nixfmt-classic nixfmt-rfc-style; }