haskellPackages: when building with js backend, output jsexe directory alongside executable#383528
Conversation
993a66f to
5b31089
Compare
I'm tempted to preserve the original behavior at least to start with. If nothing else it should make for smaller migration steps
Am not seeing an alternative really. Seems silly to unconditionally copy over the jsexe from possibly the same derivation output Example output when intermediates aren't used |
There was a problem hiding this comment.
Note in the sample output this is pointing to inside the same nix store path.
Is it worth instead using something like ../../$installIntermediatesDir/build/$exe/$exe.jsexe when (enableSeparateBinOutput || enableSeparateIntermediatesOutput) == false to save space in the symlink path ?
|
Hmm, no matter how I layout the optionalString blocks, this seems to change whitespace of the installPhase bash script even for native ghc, causing mass rebuild. |
9b4e75e to
f7475bb
Compare
|
Well, I have been putting of this PR because I don’t get it.^^ The "problem" is that the jsexe directory is missing, I guess? Why do we need it? Yeah, I think the only way to avoid the mismatch is by reusing an existing blank line for the optionalString. |
Well that's where all the javascript is? Including the externs file. |
f7475bb to
be2f000
Compare
|
Ah, that makes tons of sense. 😆 The other thing is the intermediates stuff. I know we have but I don’t know anything about it. Are you using it? |
|
I never used intermediates myself, only learned about the flag when snooping around trying to find where all the jsexe went. I wouldn't say it interferes as much as, no point copying over the jsexe from the intermediates if they'll be present there anyway, hence the symlink instead in that case. |
maralorn
left a comment
There was a problem hiding this comment.
Okay, afaict we should do this.
Of course because of whitespace this is a set rebuild. Maybe we can be on the lookout when there is a good moment to merge it.
|
I'm not sure how often this bit is updated. If it will mass rebuild, maybe we can at least make it so it's the last such one from |
|
Damnit. I wanted to merge this just now because the stackage bump probably means a larger rebuild. Alas there is a merge conflict here. |
b1ff5c1 to
fe6844b
Compare
Tree-wide |
fe6844b to
97dbf74
Compare
…y alongside executable
97dbf74 to
a6aabc4
Compare
maralorn
left a comment
There was a problem hiding this comment.
This might be one of these cases where one day someone will try to use this with intermediates, it doesn’t work and then they are in the famous "how could this ever have worked" situation. Well, they will need to figure it out then. Besides the intermediate stuff this looks sane and we shouldn’t keep js users keep pointing to bespoke branches.
We do compilation of
*.jsexedirs into an executable for old GHCJShttps://github.com/NixOS/nixpkgs/blob/993a66fe2f934a4ee1c414f8ef3975d15608bd2c/pkgs/development/haskell-modules/generic-builder.nix#L668-L676
but in the JS backend that seems to be already handled, and we end up only getting the final executable
I'm not sure what causes this difference, but one workaround when
doInstallIntermediates = trueis to symlink to the intermediates. Maybe that's actually the correct behavior in that case, but there's extra stuff in there we don't want to bring along the ride with thejsexedirsSo maybe when
doInstallIntermediates = falsewe should instead copy thejsexedirs ourselves over fromdist?I also wonder whether the original behavior of outputting both a executable and .js files is what we want. I'm not sure how to detect the
GHCJS_BROWSERin the derivation, but that looks like it should determine which bits actually are placed inbin?Example output with multiple executables (tested on top of #380737)
Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.