Skip to content

haskellPackages.nixfmt: drop - #554040

Merged
wolfgangwalther merged 1 commit into
NixOS:masterfrom
MattSturgeon:drop-nixfmt-hackage
Aug 19, 2026
Merged

wolfgangwalther merged 1 commit into
NixOS:masterfrom
MattSturgeon:drop-nixfmt-hackage

Conversation

@MattSturgeon

@MattSturgeon MattSturgeon commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

We've already dropped its top-level alias nixfmt-classic, however the underlying haskellPackages package is harder to drop because it is generated from hackage. See tracking issue: NixOS/nixfmt#340

In this PR I've added a throw when config.allowAliases is true, and I've attempted to drop the generated package. So far, I've only been able to get regenerate-hackage-packages.sh to set hydraPlatforms = lib.platforms.none, I've not been able to convince it to fully drop the package.

It'd be great if any haskell core maintainers could steer me in the right direction for how they want a generated-from-hackage package to be dropped. /cc @sternenseemann

I also fixed an issue with regenerate-hackage-packages.sh running nixfmt from PATH, instead of treefmt from the Nixpkgs shell. Otherwise, I was unable to run regenerate-hackage-packages.sh. EDIT: dropped for now; proved too controversial for this PR.

Things done

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 6.topic: haskell General-purpose, statically typed, purely functional programming language labels Aug 18, 2026
@wolfgangwalther

wolfgangwalther commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

It'd be great if any haskell core maintainers could steer me in the right direction for how they want a generated-from-hackage package to be dropped.

You'd have to finish #441204 or convince me to do it ;)

Put differently: There is currently no way to remove a package from haskellPackages entirely.

@sternenseemann sternenseemann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be possible to remove the package outright in the future with NixOS/cabal2nix#667, but we're currently a bit swamped with a lot of stuff going on.

fi

nixfmt pkgs/development/haskell-modules/hackage-packages.nix
nix-shell --run 'treefmt pkgs/development/haskell-modules/hackage-packages.nix'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change, this is deliberate.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate a bit more?

  • The CI team and formatting team have consistently advised not running nixfmt directly:
    • it may be an out-of-sync version vs what's used in CI
    • additional formatters (like nixf-diagnise) may also be relevant
    • Therefore, it's best to run the actual treefmt config
  • nixfmt is not pulled in as a script dependency (it's missing from the nix-shell shebang at the top)
    • Therefore, I cannot run the maintainers script without separately entering a shell with nixfmt available.
    • A quick way to tell if you've declared all dependencies is to add --pure to your nix-shell shebang.
      (I believe getopt is also undeclared, but I happened to have that installed on my system)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(dropped as this PR isn't the place to have the debate, but I'd still appreciate further elaboration)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, we deliberately called nixfmt here, because we couldn't do the "add the right thing to the nix-shell shebang" dance, when that was still a thing. That's because we need to depend on the current state of the branch on the shebang, to get latest cabal2nix-unstable. This conflicted with the need to pull nixfmt from CI's pinned commit.

We have basically been running with the assumption that you have entered nix-shell, before running this script.

However, the nix-shell --run treefmt .. call should probably work, I don't immediately see anything wrong with it.

Nixfmt is no longer released to Hackage; the package there is the
unmaintained "Nixfmt Classic" which is being dropped in Nixpkgs 26.11.

@wolfgangwalther wolfgangwalther left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff LGTM

@wolfgangwalther
wolfgangwalther dismissed sternenseemann’s stale review August 19, 2026 17:49

script change had been reverted

@wolfgangwalther
wolfgangwalther added this pull request to the merge queue Aug 19, 2026
@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Aug 19, 2026
Merged via the queue into NixOS:master with commit 2a8ed30 Aug 19, 2026
31 checks passed
@MattSturgeon
MattSturgeon deleted the drop-nixfmt-hackage branch August 19, 2026 18:06
@wolfgangwalther

Copy link
Copy Markdown
Contributor

Backport job failed with:

API rate limit exceeded for installation ID 57884664. If you reach out to GitHub Support for help, please include the request ID 1C80:1952CF:78A761:191BAFB:6A85EDFE and timestamp 2026-08-19 17:55:10 UTC.

Not relevant here, because there was no tag to backport anyway, just wanted to mention it in case this wasn't known already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: haskell General-purpose, statically typed, purely functional programming language 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants