Skip to content

Conversation

sternenseemann
Copy link
Member

recurseIntoAttrs was added recently in
NixOS/nixpkgs@99c0500

For hackage2nix, this is pointless. Dependencies between haskell packages are resolved directly. System dependencies should not resolve to haskellPackages under normal (any?) circumstances.


This is especially useful if a removal of a package causes evaluation failures in haskellPackages, as it allows running hackage2nix in order to eliminate references to the removed package.

However, it's still not possible if the rest of pkgs doesn't eval which is the case in e.g. NixOS/nixpkgs#450065. Missing attributes/arguments are an unrecoverable error in Nix. We can't allow aliases (which would turn the error into a recoverable via throwing aliases) since we may generate dependencies on aliases.

recurseIntoAttrs was added recently in
NixOS/nixpkgs@99c0500

For hackage2nix, this is pointless. Dependencies between haskell
packages are resolved directly. System dependencies should not resolve
to haskellPackages under normal (any?) circumstances.
@sternenseemann sternenseemann force-pushed the hackage2nix-dont-recurse-hs-pkgs branch from 6b69c66 to ecc801a Compare October 9, 2025 21:40
sternenseemann added a commit to NixOS/nixpkgs that referenced this pull request Oct 9, 2025
hackage2nix can't run if there are unrecoverable errors while generating
the nixpkgs package Nix. To create this change, I temporarily added
webkitgtk_4_0 = null to all-packages.nix to solve those errors. Then
running ./maintainers/scripts/haskell/regenerate-hackage-packages.sh --fast
effects the desired change.

See also NixOS/cabal2nix#674.
jtojnar pushed a commit to NixOS/nixpkgs that referenced this pull request Oct 9, 2025
hackage2nix can't run if there are unrecoverable errors while generating
the nixpkgs package Nix. To create this change, I temporarily added
webkitgtk_4_0 = null to all-packages.nix to solve those errors. Then
running ./maintainers/scripts/haskell/regenerate-hackage-packages.sh --fast
effects the desired change.

See also NixOS/cabal2nix#674.
jtojnar pushed a commit to NixOS/nixpkgs that referenced this pull request Oct 12, 2025
hackage2nix can't run if there are unrecoverable errors while generating
the nixpkgs package Nix. To create this change, I temporarily added
webkitgtk_4_0 = null to all-packages.nix to solve those errors. Then
running ./maintainers/scripts/haskell/regenerate-hackage-packages.sh --fast
effects the desired change.

See also NixOS/cabal2nix#674.
jtojnar pushed a commit to NixOS/nixpkgs that referenced this pull request Oct 13, 2025
hackage2nix can't run if there are unrecoverable errors while generating
the nixpkgs package Nix. To create this change, I temporarily added
webkitgtk_4_0 = null to all-packages.nix to solve those errors. Then
running ./maintainers/scripts/haskell/regenerate-hackage-packages.sh --fast
effects the desired change.

See also NixOS/cabal2nix#674.
Copy link
Contributor

@wolfgangwalther wolfgangwalther left a comment

Choose a reason for hiding this comment

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

However, it's still not possible if the rest of pkgs doesn't eval which is the case in e.g. NixOS/nixpkgs#450065. Missing attributes/arguments are an unrecoverable error in Nix. We can't allow aliases (which would turn the error into a recoverable via throwing aliases) since we may generate dependencies on aliases.

I think this could be solved by "structured aliases" introduced in NixOS/nixpkgs#442066. The aliases would also be exposed without aliases and they could be filtered out.

Comment on lines +81 to +85
let nixpkgsArgs = mconcat [ "{"
, "overlays = [ (self: super: { haskellPackages = self.lib.dontRecurseIntoAttrs super.haskellPackages; }) ];"
, "config.allowAliases = false;"
, "}"
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't we put this overlay's code in https://github.com/NixOS/cabal2nix/blob/master/distribution-nixpkgs/derivation-attr-paths.nix?

I think that fits better.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could do that, but we can't really add this feature without changing the API for distribution-nixpkgs which I didn't want to commit to yet…

Copy link
Contributor

Choose a reason for hiding this comment

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

I have no idea what you mean. Why would that change the API? And if so, why would that be bad?

jtojnar pushed a commit to NixOS/nixpkgs that referenced this pull request Oct 14, 2025
hackage2nix can't run if there are unrecoverable errors while generating
the nixpkgs package Nix. To create this change, I temporarily added
webkitgtk_4_0 = null to all-packages.nix to solve those errors. Then
running ./maintainers/scripts/haskell/regenerate-hackage-packages.sh --fast
effects the desired change.

See also NixOS/cabal2nix#674.
jtojnar pushed a commit to NixOS/nixpkgs that referenced this pull request Oct 18, 2025
hackage2nix can't run if there are unrecoverable errors while generating
the nixpkgs package Nix. To create this change, I temporarily added
webkitgtk_4_0 = null to all-packages.nix to solve those errors. Then
running ./maintainers/scripts/haskell/regenerate-hackage-packages.sh --fast
effects the desired change.

See also NixOS/cabal2nix#674.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants