Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Reduce the number of derivations #1605

Closed
wants to merge 51 commits into from
Closed

Conversation

hamishmack
Copy link
Collaborator

  • Share the default setup executable.
  • Make configFiles and ghc outputs of the component derivation.
  • Use propagatedBuildInputs and pkgsHostTarget for component dependencies.

@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Aug 20, 2022
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Aug 20, 2022

try

Build failed:

@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Aug 20, 2022
@hamishmack
Copy link
Collaborator Author

bors try-

@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Aug 20, 2022
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Aug 20, 2022

try

Build failed:

@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Sep 4, 2022
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 4, 2022

try

Build failed:

@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Sep 5, 2022
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 5, 2022

try

Build failed:

@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Sep 6, 2022
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 6, 2022

try

Build failed:

@hamishmack
Copy link
Collaborator Author

bors try

iohk-bors bot added a commit that referenced this pull request Sep 6, 2022
@iohk-bors
Copy link
Contributor

iohk-bors bot commented Sep 6, 2022

try

Build failed:

@L-as
Copy link
Contributor

L-as commented Sep 6, 2022

Not sure I understand. Can you give and example of something in the haskell.nix code we should be avoiding?

E.g., you're removing usages of runCommand, but if you make runCommand not use stdenv, it would probably be faster

The goal here is to reduce the eval time when no code needs to built. My aim was to reduce the amount and size of the derivations in the hope that eval would be faster over all.

Do you mean when you don't need to rebuild the Haskell code, or when no derivation needs to be built at all? In the latter case, optimising derivations won't do much of a difference anyway.
@aciceri (from @mlabs-haskell) was working on optimising IFD in Nix itself as part of https://input-output.atlassian.net/browse/OBT-325 (see https://github.com/mlabs-haskell/nix/tree/parallel-ifds-processes), albeit the funding for this has been removed. The problem is outlined in NixOS/nix#6299, essentially, Nix currently blocks on IFD rather than continuing evaluation and potentially doing multiple IFDs at the same time (since multiple things can be built at the same time). Just removing this limitation would have sped up haskell.nix quite a bit.
Nix evaluation is in general much slower than it could be, and even a 10x speed-up doesn't seem far-fetched to me with enough work. E.g. last time I checked the data type for values was 32 bytes even though 8 would be enough.

Once this change is merged I was going to look into how much could be saved by move the large configurePhase and buildPhase and installPhase strings into static shell scripts that use env variables as inputs (that is why this change uses pkgsHostTarget environment variable).

I'm not sure how fast passing things through the environment is, but it's possible that setting __structuredAttrs = true; in the derivation and using the JSON passed in instead would be a bit faster.

@yvan-sraka yvan-sraka added the enhancement New feature or request label Sep 20, 2022
…tions

# Conflicts:
#	builder/comp-builder.nix
#	builder/hspkg-builder.nix
#	lib/call-cabal-project-to-nix.nix
#	overlays/bootstrap.nix
#	overlays/cabal-pkg-config.nix
#	overlays/default.nix
#	overlays/haskell.nix
@stale
Copy link

stale bot commented Feb 2, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Feb 2, 2023
@hamishmack
Copy link
Collaborator Author

This work has been merged in #1854 (except pkgconfigSelector which I don't think we need any more)

@hamishmack hamishmack closed this Mar 28, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request wontfix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants