Compare commits
2 Commits
main
...
static-bui
Author | SHA1 | Date | |
---|---|---|---|
![]() |
58f5a861f3 | ||
![]() |
4bbc31f41b |
22
flake.nix
22
flake.nix
@ -26,13 +26,29 @@
|
|||||||
# And some build configuration.
|
# And some build configuration.
|
||||||
# See https://nixos.org/manual/nixpkgs/unstable/#haskell-packaging-helpers.
|
# See https://nixos.org/manual/nixpkgs/unstable/#haskell-packaging-helpers.
|
||||||
[
|
[
|
||||||
# Remove warp which pulls GHC into the runtime deps for some reason.
|
# Configurable static build. Set cabal options...
|
||||||
|
compose.disableSharedExecutables
|
||||||
|
compose.disableSharedLibraries
|
||||||
|
# ... and link required static libraries.
|
||||||
|
(compose.appendConfigureFlags [
|
||||||
|
"--ghc-option=-optl=-static"
|
||||||
|
"--ghc-option=-optl=-pthread"
|
||||||
|
"--extra-lib-dirs=${pkgs.gmp6.override { withStatic = true; }}/lib"
|
||||||
|
"--extra-lib-dirs=${pkgs.zlib.static}/lib"
|
||||||
|
"--extra-lib-dirs=${pkgs.glibc.static}/lib"
|
||||||
|
"--extra-lib-dirs=${pkgs.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib"
|
||||||
|
])
|
||||||
|
# Remove all references to the Nix store from the executable.
|
||||||
|
# This is important because Nix uses the references for calculating
|
||||||
|
# what needs to be in the Docker container.
|
||||||
|
# FIXME: Using static linking, these references shouldn't even still be there.
|
||||||
|
# Can we somehow make GHC stop emitting them?
|
||||||
(compose.overrideCabal (drv: {
|
(compose.overrideCabal (drv: {
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
remove-references-to -t ${pkgs.haskellPackages.warp} $out/bin/utoy
|
${pkgs.nukeReferences}/bin/nuke-refs $out/bin/utoy
|
||||||
'';
|
'';
|
||||||
}))
|
}))
|
||||||
# Return only the bin folder to curb image size
|
# Return only the bin folder to curb image size.
|
||||||
compose.justStaticExecutables
|
compose.justStaticExecutables
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user