nh2 / static-haskell-nix

easily build most Haskell programs into fully static Linux executables
388 stars 36 forks source link

Incorrect zstd static flag #120

Closed d-lapirov closed 10 months ago

d-lapirov commented 11 months ago

I'm somewhat new to nix, but it seems like the option to build zstd statically should be static = true, not enableStatic = true.

I'm not sure that this is relevant here, but I'm building against unsable nixpkgs, as I need an ghc946. Howerver I don't see zstd.enableStatic flag ever in the history of zstd/default.nix.

While trying to build my project I ended up with a patch to survey/default.nix with this content:

diff --git a/survey/default.nix b/survey/default.nix
index 4c451e4..f6f2c62 100644
--- a/survey/default.nix
+++ b/survey/default.nix
@@ -724,7 +724,7 @@ let

     openssl = previous.openssl.override { static = true; };

-    zstd = previous.zstd.override { enableStatic = true; };
+    zstd = previous.zstd.override { static = true; };

     libsass = previous.libsass.overrideAttrs (old: { dontDisableStatic = true; });

Only after patching survey I was able to build my project.

Is it something wrong on my side, and it should actually be enableStatic? https://github.com/NixOS/nixpkgs/blob/4077a0e4ac3356222bc1f0a070af7939c3098535/pkgs/tools/compression/zstd/default.nix#L6

nh2 commented 11 months ago

I think you're currently not using my pinned submodule:

image

https://github.com/nh2/static-haskell-nix/tree/88f1e2d57e3f4cd6d980eb3d8f99d5e60040ad54

which has these commits https://github.com/NixOS/nixpkgs/commits/9e49f8f1f37bc906cda1adb33064c325d760819a

among which https://github.com/NixOS/nixpkgs/commit/40d2db0cee0e72c5eaa051482f1c9cc62ed441b8

which has an open PR upstream at https://github.com/NixOS/nixpkgs/pull/243161

teggotic commented 11 months ago

This makes much more sense now. Thank you @nh2

Another question on this topic is that I need a GHC946 specifically, and the latest 94x one in your branch is 945. I think I should create my own fork with your branch as base and copy everything related to ghc946 from the nixpkgs master, right? Or you can suggest something different.

I hope I'm not taking too much of your time.

I've used the wrong account to create an issue :stuck_out_tongue_closed_eyes:

nh2 commented 10 months ago

@teggotic @d-lapirov

I need a GHC946 specifically, and the latest 94x one in your branch is 945. I think I should create my own fork with your branch as base and copy everything related to ghc946 from the nixpkgs master, right? Or you can suggest something different.

If I understand you right, you're saying that my pinned nixpkgs has ghc945 and you need ghc946 which is only in a newer nixpkgs.

In that case, you can do the following steps: