nixfmt icon indicating copy to clipboard operation
nixfmt copied to clipboard

Drop nixfmt-classic from nixpkgs

Open jfly opened this issue 5 months ago • 6 comments

When doing the stable release, we announced that "The classic nixfmt will stay available for some more time as pkgs.nixfmt-classic" (https://github.com/NixOS/nixpkgs/blob/b3bc1e31d0fc920cc11a79ed4f4bd202961addfb/doc/release-notes/rl-2511.section.md#highlights-sec-nixpkgs-release-2511-highlights).

We should decide exactly how long that is. It seems reasonable to me to wait until the next release (26.05). Concretely, I propose that:

  1. We add a deprecation warning to pkgs.nixfmt-classic now, with the expectation that 25.11 is released with the deprecation warning.
  2. Once 25.11 is cut off from master, we remove pkgs.nixfmt-classic, with the expectation that 26.05 is released with no pkgs.nixfmt-classic.

The plan

  • [x] Do immediately: Move nixfmt-classic to aliases.nix. (It's currently in all-packages).

  • [x] Do immediately: Add a deprecation warning like this:

    nixfmt-classic = (
      if lib.oldestSupportedReleaseIsAtLeast 2605 then
        throw "nixfmt-classic has been removed as it is deprecated and unmaintained."
      else if lib.oldestSupportedReleaseIsAtLeast 2511 then
        lib.warnOnInstantiate
          "nixfmt-classic is deprecated and unmaintained. We recommend switching to nixfmt."
       else
         lib.id
    ) haskellPackages.nixfmt.bin;
    
  • [ ] Once 25.11 is the oldest supported version in master: list the deprecation in nixpkgs' release notes.

  • [ ] Once 26.05 is the oldest supported version in master: list the removal in nixpkgs' release notes.

  • [ ] Once 26.05 is the oldest supported version in master: simplify the above to just the throw.

    • TBD what (if anything) we do with haskellPackages.nixfmt.bin

jfly avatar Sep 17 '25 16:09 jfly

Please make sure to keep nixfmt building until then. Currently nixfmt-0.6.0 has too strict bounds to work with Stackage LTS 24 without further workarounds:

Encountered missing or private dependencies:
    base >=4.12.0 && <4.19,
    filepath >=1.4.2 && <1.5,
    megaparsec >=9.0.1 && <9.6

This could be fixed by a simple Hackage revision (in this case) to

base < 4.21
megaparsec < 9.8
filepath < 1.6

sternenseemann avatar Sep 21 '25 11:09 sternenseemann

@sternenseemann, thanks for the heads up.

We have had some turnover in the team (I don't even know how to do a release to Hackage, because we thought we'd never have to). I know very little about the nixpkgs Haskell package set. Can we relax those constraints with a patch over in nixpkgs (knowing this will go away soon)? Or would it be simplest to get the change on Hackage?

jfly avatar Sep 21 '25 12:09 jfly

We are currently working around this in Nixpkgs, but that is some extra code we need to keep track of. Also it does not help for anyone using cabal-install or whatever to install directly from Hackage.

Making a new release is not necessary, a Hackage revision can simply be made in the Hackage web interface. @infinisil of the current team (?) has access.

sternenseemann avatar Sep 21 '25 12:09 sternenseemann

Then I think that's the signal that it should be deprecated it Nixpkgs, instead of spending any more effort on it. It's already deprecated on Hackage as of recently: #161.

infinisil avatar Sep 21 '25 18:09 infinisil

Nevermind, I'll just note you won't fix this.

sternenseemann avatar Sep 22 '25 00:09 sternenseemann

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/formatting-team-meeting-2025-09-30/70099/1

nixos-discourse avatar Sep 30 '25 19:09 nixos-discourse