-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
haskell: don't lose packageOverrides for native-bignum and integer-simple #167956
haskell: don't lose packageOverrides for native-bignum and integer-simple #167956
Conversation
75ceffd
to
49d1461
Compare
Here is a file that can be used to test this change:
let
nixpkgs-src = /some/path/to/your/nixpkgs/repo;
my-overlay = final: prev: {
haskell = prev.haskell // {
packageOverrides =
final.lib.composeExtensions
(prev.haskell.packageOverrides or (_: _: {}))
(hfinal: hprev: {
my-new-package = hfinal.conduit;
});
};
};
pkgs = import nixpkgs-src { overlays = [my-overlay]; };
in
pkgs.haskell.packages.native-bignum.ghc902.my-new-package If you build this with the change from this PR, it successfully builds $ nix-build test.nix
...
/nix/store/hcd5c14hcx0dw76cbk9xhnbyf0xs9181-conduit-1.3.4.2 However, if you're not using this PR, then you get an error about the $ nix-build test.nix
error: attribute 'my-new-package' missing
at /home/illabout/temp/what012.nix:21:1:
21| pkgs.pkgsStatic.haskellPackages.my-new-package
| ^ |
pkgs/top-level/haskell-packages.nix
Outdated
native-bignum = | ||
let | ||
nativeBignumGhcNames = pkgs.lib.filter | ||
(name: builtins.elem name nativeBignumIncludes) | ||
(pkgs.lib.attrNames compiler); | ||
in | ||
pkgs.lib.genAttrs nativeBignumGhcNames | ||
(name: | ||
packages.${name}.override (oldAttrs: { | ||
ghc = bh.compiler.native-bignum.${name}; | ||
buildHaskellPackages = bh.packages.native-bignum.${name}; | ||
overrides = | ||
pkgs.lib.composeExtensions | ||
(oldAttrs.overrides or (_: _: {})) | ||
(_: _: { integer-gmp = null; }); | ||
}) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I refactored this to make it a little easier to see exactly what is going on.
The only non-whitespace change is going from
overrides = _self : _super : {
integer-gmp = null;
};
to
overrides =
pkgs.lib.composeExtensions
(oldAttrs.overrides or (_: _: {}))
(_: _: { integer-gmp = null; });
With this change, we make sure to keep any old overrides.
This is important because package.${name}
is going to refer to one of the Haskell package sets. For instance:
nixpkgs/pkgs/top-level/haskell-packages.nix
Lines 222 to 226 in af5b994
ghc902 = callPackage ../development/haskell-modules { | |
buildHaskellPackages = bh.packages.ghc902; | |
ghc = bh.compiler.ghc902; | |
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-9.0.x.nix { }; | |
}; |
You can see that this is defined with callPackage
, which is defined in that same file:
nixpkgs/pkgs/top-level/haskell-packages.nix
Lines 31 to 34 in af5b994
callPackage = newScope { | |
haskellLib = haskellLibUncomposable.compose; | |
overrides = pkgs.haskell.packageOverrides; | |
}; |
callPackage
specifically defines overrides
as packageOverrides
. The change in this PR makes sure not to lose this.
49d1461
to
aaf6ac1
Compare
It appears that integer-gmp is already set to null for all compilers, so there is no need to explicitly set it to null in the integer-simple and native-bignum package sets.
aaf6ac1
to
1be5cae
Compare
Description of changes
This updates
haskell.packages.{native-bignum,integer-simple}.*
so that the new haskell packages added topackageOverrides
are kept in the native-bignum and integer-simple package sets.Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes