Static build

This commit is contained in:
Tom Sydney Kerckhove 2024-04-15 10:13:15 +02:00
parent 18ed00ec2f
commit a7bdef3966
2 changed files with 16 additions and 2 deletions

View File

@ -49,11 +49,15 @@
];
};
pkgs = pkgsFor nixpkgs;
muslPkgs = pkgs.pkgsMusl;
in
{
overlays.${system} = import ./nix/overlay.nix;
packages.${system}.default = pkgs.feedback;
packages.${system} = {
default = pkgs.feedback;
static = muslPkgs.feedback;
};
checks.${system} = {
release = self.packages.${system}.default;
shell = self.devShells.${system}.default;

View File

@ -19,7 +19,7 @@ with final.haskell.lib;
(old: {
doBenchmark = true;
doHaddock = true;
doCoverage = false;
doCoverage = false; # No need because we use dekking
doHoogle = true;
doCheck = false; # Only in coverage report
hyperlinkSource = false;
@ -39,7 +39,17 @@ with final.haskell.lib;
"--ghc-options=-Wcpp-undef"
"--ghc-options=-Werror"
"--ghc-options=-optP-Wno-nonportable-include-path" # For macos
] ++ optionals final.stdenv.hostPlatform.isMusl [
"--ghc-option=-static"
"--ghc-option=-optl=-static"
# Static
"--extra-lib-dirs=${final.gmp6.override { withStatic = true; }}/lib"
"--extra-lib-dirs=${final.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib"
# for -ltinfo
"--extra-lib-dirs=${(final.ncurses.override { enableStatic = true; })}/lib"
];
enableSharedExecutables = !final.stdenv.hostPlatform.isMusl;
enableSharedLibraries = !final.stdenv.hostPlatform.isMusl;
})));
feedback-test-harness = buildStrictly
(overrideCabal (self.callPackage ../feedback-test-harness { }) (old: {