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
quartus-prime-lite: Add postInstall option #123469
Conversation
This can be used to remove unused files to reduce closure size. For example, if you're only going to use the twentynm platform: quartus-prime-lite.override { postInstall = '' find $out/modelsim_ase/altera/{verilog,vhdl}/* ! -name src ! -path '*twentynm*' -delete ''; }
Result of 1 package failed to build:1 package built successfully:
Note that build failures may predate this PR, and could be nondeterministic or hardware dependent. |
The robot failed to build because the package is nonfree of course. With the default |
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.
Overall, I approve of adding feature flags to reduce closure size, thanks for this work! Is removing folders like this likely to cause crashes at runtime, or does Quartus gracefully handle the case where these folders have been removed?
It might also be worth splitting quartus into quartus
and quartus-unwrapped
top-level packages, so that people can override the base package more easily.
supportedDevices ? [ "Arria II" "Cyclone V" "Cyclone IV" "Cyclone 10 LP" "MAX II/V" "MAX 10 FPGA" ] }: | ||
{ buildFHSUserEnv, makeDesktopItem, writeScript, stdenv, lib, requireFile, unstick | ||
, supportedDevices ? [ "Arria II" "Cyclone V" "Cyclone IV" "Cyclone 10 LP" "MAX II/V" "MAX 10 FPGA" ] | ||
, postInstall ? "" |
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 would prefer some more structured options here. For example, your suggested change could have:
disableCCompiler = true
platforms = [ "twentynm" ]
I don't know which parts of Quartus can be removed in this way, so I'll leave it to you to design a good interface here.
Unfortunately I have no clue what parts can be safely removed, I've never
used this package other than for one fpga image derivation.
|
Hm, I don't think I know any other packages that expose a If we don't have structured options, it might be better to expose the |
I've just opened #124906, which exposes the unrwapped version as a parameter. This means you change could be applied in an overlay, like:
Would this be sufficient for your use-case? I think that other PR has the approach of being a bit more general, because it allows other attributes of the package to be overridden as well, at the expense of slightly more code. |
Thanks, that sounds good.
|
This allows customizing the install process for the unwrapped process, as proposed in #123469, without introducing top-level support for untested modifications. The PR could then be straightforwardly implemented as an overlay, that does: quartus-prime-lite = super.quartus-prime-lite.override { unwrapped = quartus-prime-lite.unwrapped.overrideAttrs (o: { buildCommand = o.buildCommand + '' rm -r $out/nios2eds/bin/gnu find $out/modelsim_ase/altera/{verilog,vhdl}/* ! -name src ! -path '*twentynm*' -delete ''; }); };
Motivation for this change
quartus-prime-lite has a pretty large closure size of about 15GB. This option allows cutting out unneeded parts before the package is stored permanently in the nix store.
For example, if you're only going to use the twentynm platform and you're not going to use the builtin C compiler, you can cut the closure size in half with:
Things done
I tested a
postInstall
similar to the above and was still able to produce fpga images.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)