-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
cabal2nix: split into a lightweight version and a wrapper #81125
Conversation
@peti Do you know why cabal2nix was using ghc 8.8.1 in the first place? |
b049c69
to
d5fe57e
Compare
Note for reviewers: I'm not sure what are the best practices for writing such a wrapper, so suggestions are definitely welcome there. |
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.
Can you make this target the haskell-updates
branch instead of master
?
This seems reasonable to me except for the following three things:
- There was probably a reason @peti set
cabal2nix
to use ghc881 instead of ghc865. That said,haskell-updates
is switching to ghc882, so maybe this doesn't matter. cabal2nix-unwrapped
probably shouldn't be exposed at the top level.symlinkJoin
is probably not the right thing to use here, since you're not joining a bunch of derivations. Although, I dunno, maybe its easier than using the normalstdenv.mkDerivation
.
776f42d
to
bb71f8c
Compare
05357fc
to
83c4b73
Compare
@cdepillabout Thanks for the review! Regarding your points:
|
bb71f8c
to
a26545b
Compare
Hmm, in edit: Ah, I see that would end up pulling a cabal2nix built with a version of ghc depending on the haskell package set. Yeah, I agree that we don't have many good solutions here. I think I am okay with having I need to try running this once or twice, but I think it should be pretty good as-is. |
Not really: we want On the other hand, we can decide we don't care about the (binary) duplication, and just use In the end, if the duplication of binary is acceptable, then changing |
@madjar Sorry, I ninja-edited my last comment while you were typing, I think. I think this PR looks fine as you have it. Give me a day or so to actually play around with this and make sure it is working. |
No worries! I think I'll make one more change to the way cabal2nix is
defined, to use runCommand instead of raw mkDerivation (to get the local
build and substituting settings right).
|
518e64c
to
e81ec2f
Compare
On second thought, I'm happy with this version that uses If you're satisfied with this, give me a sign. I'll make sure to rebase on top of a working commit, and merge. |
pkgs/top-level/all-packages.nix
Outdated
mkdir -p $out/bin | ||
ln -s ${cabal2nix-unwrapped}/share $out | ||
ln -s ${cabal2nix-unwrapped}/bin/hackage2nix $out/bin | ||
makeWrapper ${cabal2nix-unwrapped}/bin/cabal2nix $out/bin/cabal2nix \ | ||
--prefix PATH ":" "${nix}/bin" \ | ||
--prefix PATH ":" "${nix-prefetch-scripts}/bin" |
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 recommend this instead:
--prefix PATH : "${lib.makeBinPath [ nix nix-prefetch-scripts ]}"
makeBinPath
takes care of appending /bin
and using the bin
output if necessary
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.
Oh, that's cool! I'll do that right away.
Rebased on top of |
42dd19b
to
4a0fc1a
Compare
I hope you don't mind, I just pushed a change so it doesn't need a whitelist of paths to be copied from the unwrapped derivation. Makes it a bit more succinct. The |
@infinisil No worries! I think I used the whitelist to avoid copying |
0cad7b0
to
6e2198b
Compare
Current, the `cabal2nix` derivation contains both the executable, and a wrapper that adds `nix` and `nix-prefetch-scripts`, which are required for some features. However, when calling `callCabal2nix` to create a derivation from a cabal file at evaluation time, these features are not actually used, but the huge closure of `nix-prefetch-scripts` (which includes multiple vcs, as well as python and perl) still needs to be fetched. This commit splits cabal2nix into a lightweight version that is a standalone static binary (`cabal2nix-unwrapped`), and a wrapper that includes the proper dependencies in the path for full usage of the command line utility (`cabal2nix`). This commit also switches to the default ghc, to reduce the likelyhood of building a different ghc when calling `callCabal2nix`.
4a0fc1a
to
9f46e2b
Compare
@GrahamcOfBorg build cabal2nix @GrahamcOfBorg build cabal2nix-unwrapped @madjar The I've also tested this with the command:
As far as I could tell, it looks like it didn't have to pull in a bunch of language runtimes, so it worked as expected. |
@madjar Thanks for putting this together! |
My pleasure! |
Current, the
cabal2nix
derivation contains both the executable, and a wrapperthat adds
nix
andnix-prefetch-scripts
, which are required for somefeatures.
However, when calling
callCabal2nix
to create a derivation from a cabal fileat evaluation time,
these features are not actually used, but the huge closure of
nix-prefetch-scripts
(which includes multiple vcs, as well as python and perl)still needs to be fetched.
This commit splits cabal2nix into a lightweight version that is a standalone
static binary (
cabal2nix-unwrapped
), and a wrapper that includes the properdependencies in the path for full usage of the command line
utility (
cabal2nix
).This commit also switches to the default ghc, to reduce the likelyhood of
building a different ghc when calling
callCabal2nix
.Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)