Compare commits
No commits in common. "static-build" and "main" have entirely different histories.
static-bui
...
main
22
flake.nix
22
flake.nix
@ -26,29 +26,13 @@
|
||||
# And some build configuration.
|
||||
# See https://nixos.org/manual/nixpkgs/unstable/#haskell-packaging-helpers.
|
||||
[
|
||||
# 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?
|
||||
# Remove warp which pulls GHC into the runtime deps for some reason.
|
||||
(compose.overrideCabal (drv: {
|
||||
postInstall = ''
|
||||
${pkgs.nukeReferences}/bin/nuke-refs $out/bin/utoy
|
||||
remove-references-to -t ${pkgs.haskellPackages.warp} $out/bin/utoy
|
||||
'';
|
||||
}))
|
||||
# Return only the bin folder to curb image size.
|
||||
# Return only the bin folder to curb image size
|
||||
compose.justStaticExecutables
|
||||
];
|
||||
in {
|
||||
|
Loading…
x
Reference in New Issue
Block a user