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
pkgsStatic: improve usability #65213
Conversation
This flag can replace the extra static parameter to packages that don't work automatically with this adapter.
this collides with the derivations which have a static output. (but there are only 3 of them https://search.nix.gsc.io/?q=outputs.*static&i=nope&files=&repos=) |
How about |
@@ -53,6 +53,14 @@ self: super: let | |||
|
|||
in { | |||
stdenv = foldl (flip id) super.stdenv staticAdapters; | |||
gcc49Stdenv = foldl (flip id) super.gcc49Stdenv staticAdapters; |
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'll have to test this, but I had hoped that these would get the static flags as well. They should all just extend the super.stdenv
attr, but their may be some issue with. There might be some late binding that needs to happen though.
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 expected that as well, but after adding the first patch the packages from my overlay didn't pick up the static attribute. I had to add these to get a correct build.
I don't follow, why would an attribute in |
I'd like to add another commit to this PR: Turn |
Since glibc has a |
It is not my intention the add a I actually tried to force this collision by modifying diff --git a/pkgs/development/libraries/zlib/default.nix b/pkgs/development/libraries/zlib/default.nix
index 7fb5be1c343..ca3b31525de 100644
--- a/pkgs/development/libraries/zlib/default.nix
+++ b/pkgs/development/libraries/zlib/default.nix
@@ -26,14 +26,14 @@ stdenv.mkDerivation (rec {
'';
outputs = [ "out" "dev" ]
- ++ stdenv.lib.optional (shared && static) "static";
+ ++ stdenv.lib.optional static "static";
setOutputFlags = false;
outputDoc = "dev"; # single tiny man3 page
configureFlags = stdenv.lib.optional shared "--shared"
++ stdenv.lib.optional (static && !shared) "--static";
- postInstall = stdenv.lib.optionalString (shared && static) ''
+ postInstall = stdenv.lib.optionalString static ''
moveToOutput lib/libz.a "$static"
''
# jww (2015-01-06): Sometimes this library install as a .so, even on The extra |
Ah sorry I had not understood. This is fine then. |
4388e71
to
e06b7d9
Compare
I wasn't aware of the uses of |
@matthewbauer: Can we put the workaround for the alternate Propagating all buildInputs unconditionally might be a bit too much. Technically it is only necessary if the output contains archive libraries. Should I devise a heuristic for that? |
@tobim I'm not sure if a heuristic is possible, but might be interesting to look at |
@GrahamcOfBorg build pkgsStatic.proot pkgsStatic.nano |
The naive approach would be to simply look for any '.a' files in all outputs. It would contains lots of false positives, but it would be an improvement nonetheless. |
I just noticed that the existing |
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.
Looks good! The main ones that I care about working are pkgsStatic.proot and pkgsStatic.nix (still requires #56281 unfortunately). Eventually we need to add a release-static.nix to make sure these are not breaking between changes (or piggyback off release-cross.nix).
@matthewbauer there is nothing left to do in this PR, can you merge? |
My use case is a proprietary tool that comes with support for |
I think we should get rid of propagating build inputs by using |
@FRidh for any package that has transitive dependencies outside of the stuff that is always present (libc, libgcc...), We could think about automatically splitting the |
Yes I understand why its done. I've opened #83667 for the discussion. |
Motivation for this change
Defining packages that require an extra
static
parameter to work withpkgsStatic
in overlays is rather awkward right now. Passingstatic
within stdenv removes the need to explicitly add most packages to thepkgsStatic
attrset. The flag can be queried byattrByPath ["static"] false stdenv
.stdenv
s with alternative compilers are now overridden inpkgsStatic
.Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)