Skip to content
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

emanote: patch out erroneous runtime deps due to cabal _Path module #204675

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

edrex
Copy link
Contributor

@edrex edrex commented Dec 5, 2022

Patch emanote static binary's dependencies to remove erroneous references due to Cabal *_Path modules.

Reduces closure size for static executable reported by nix path-info -S ./result from 5643632280
to 570510096

What I did:

b7e

Things done
  • Built on platform(s)
    • x86_64-linux
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)

@edrex
Copy link
Contributor Author

edrex commented Dec 5, 2022

request reviews: @maralorn @srid @Profpatsch

@edrex
Copy link
Contributor Author

edrex commented Dec 5, 2022

Note that this kind of patch should be obsoleted if/when haskell/cabal#8534 lands and affected programs are patched to use the new mechanism for discovering/embedding dependency versions.

@srid
Copy link
Contributor

srid commented Dec 5, 2022

5.5G to 0.5G reduction in size? Great!

@edrex
Copy link
Contributor Author

edrex commented Dec 5, 2022

Note that emanote still has a runtime dependency on nodejs via tailwindcss, which accounts for most of the remaining size.

@srid
Copy link
Contributor

srid commented Dec 5, 2022

Note that emanote still has a runtime dependency on nodejs via tailwindcss, which accounts for most of the remaining size.

Tangential, but I really want to rewrite the Tailwind compiler in Haskell. It would also help srid/ema#20 in addition to srid/emanote#384 (comment)

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1 labels Dec 5, 2022
@edrex
Copy link
Contributor Author

edrex commented Dec 5, 2022

I notice that nix-build -A emanote causes both an executable and library build:

  • Building executable 'emanote' for emanote-0.8.0.0..
  • Building library for emanote-0.8.0.0..

That seems sensible but also the library isn't present in ./result/ so I feel like something funny is going on. Can anybody explain why the library is being built here? This happens without this patch too.

@maralorn
Copy link
Member

Hey @edrex generally the Haskell derivations in nixpkgs build all build outputs of a package, i.e. the library (if it exists) and all executables. This makes a lot of sense because in most Haskell packages the executable depends on the library, so it is needed for compilation. (There is a flag in our mkDerivation script to disable building the library, but for the before mentioned reason that will result in a build fail for most packages.)
When we use the justStaticExecutables function, the executables get linked statically and after that the library gets removed. This happens to reduce closure size, because the library contains references to store paths not needed by the statically linked executable. We cannot simply not build the library because it is needed at compile time.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 18, 2023
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: haskell 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 10.rebuild-linux: 1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants