Skip to content

Fix callPackage still producing dynamic executables - #128

Open
FPtje wants to merge 1 commit into
masterfrom
fp/fix-callPackage-dynamic-executables
Open

Fix callPackage still producing dynamic executables#128
FPtje wants to merge 1 commit into
masterfrom
fp/fix-callPackage-dynamic-executables

Conversation

@FPtje

@FPtje FPtje commented Jun 30, 2024

Copy link
Copy Markdown
Collaborator

This was due to staticHaskellBinariesOverlay overlay changing every existing package to build statically, but not every new package called with callPackage.

Here's an example building against my own glualint:

Before

cd survey
nix repl --file default.nix --print-build-logs
nix-repl> :b (haskellPackages.extend (normalPkgs.callPackage /home/falco/Programs/glualint/nix/haskell-overlay.nix {})).callPackage /home/falco/Programs/glualint/default.nix {
}
This derivation produced the following outputs:
  out -> /nix/store/5qfjn4xkw1wwybywjq5qxr1dhsd16kw0-glualint-0.1.0.0
file /nix/store/5qfjn4xkw1wwybywjq5qxr1dhsd16kw0-glualint-0.1.0.0/bin/glualint
/nix/store/5qfjn4xkw1wwybywjq5qxr1dhsd16kw0-glualint-0.1.0.0/bin/glualint: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/134sxj760d4nx8g85scj0h41bf8p7b7j-musl-1.2.3/lib/ld-musl-x86_64.so.1, stripped

After

nix-repl> :b (haskellPackages.extend (normalPkgs.callPackage /home/falco/Programs/glualint/nix/haskell-overlay.nix {})).callPackage /home/falco/Programs/glualint/default.nix {}

This derivation produced the following outputs:
  out -> /nix/store/24dbxj94lisb3hmcwjs3vkk8w4xlhsar-glualint-0.1.0.0

file /nix/store/24dbxj94lisb3hmcwjs3vkk8w4xlhsar-glualint-0.1.0.0/bin/glualint
/nix/store/24dbxj94lisb3hmcwjs3vkk8w4xlhsar-glualint-0.1.0.0/bin/glualint: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped

@FPtje
FPtje marked this pull request as draft June 30, 2024 13:21
This was due to `staticHaskellBinariesOverlay` overlay changing every
_existing_ package to build statically, but not every _new_ package
called with `callPackage`.
@FPtje
FPtje force-pushed the fp/fix-callPackage-dynamic-executables branch from da65237 to d0f4678 Compare June 30, 2024 13:23
Comment thread survey/default.nix
Comment on lines +1712 to +1716
(final.lib.mapAttrs
(name: value:
if (isProperHaskellPackage value && isExecutable value) then statify value else value
)
super
super) // {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping I could get rid of this map, as the callPackage override would take over its functionality. That doesn't appear to happen, though, and leaving this out will cause any regular executables to be dynamically linked.

@FPtje
FPtje marked this pull request as ready for review June 30, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant