mirror of
https://github.com/ilyakooo0/haskell.nix.git
synced 2024-09-20 11:27:22 +03:00
a500f39da7
This should simplify the interaction with musl quite a but. Musl specific mapping should go into the musl overlay now.
67 lines
2.0 KiB
Nix
67 lines
2.0 KiB
Nix
{ stackProject'
|
|
, stdenv, gmp6, openssl, zlib, libffi
|
|
, buildPackages
|
|
, recurseIntoAttrs
|
|
, testSrc
|
|
}:
|
|
|
|
with stdenv.lib;
|
|
|
|
let
|
|
# Grab the compiler name from stack-to-nix output.
|
|
# compiler = (stack-pkgs.extras {}).compiler.nix-name;
|
|
compiler = "ghc865"; # fixme
|
|
|
|
# IFD stack-to-nix
|
|
project = { gpl ? true }: stackProject' {
|
|
src = testSrc "fully-static";
|
|
pkg-def-extras = [];
|
|
modules = [
|
|
{
|
|
# Select a non-GMP compiler, usually for software licensing reasons.
|
|
ghc.package = mkIf (stdenv.hostPlatform.isMusl && !gpl)
|
|
buildPackages.haskell-nix.compiler.integer-simple.${compiler};
|
|
}
|
|
];
|
|
};
|
|
packagesGmp = (project { gpl = true; }).hsPkgs;
|
|
packagesIntegerSimple = (project { gpl = false; }).hsPkgs;
|
|
|
|
in recurseIntoAttrs {
|
|
ifdInputs = {
|
|
stack-nix-gmp = (project { gpl = true; }).stack-nix;
|
|
stack-nix-simple = (project { gpl = false; }).stack-nix;
|
|
};
|
|
run = stdenv.mkDerivation {
|
|
name = "fully-static-test";
|
|
|
|
depsBuildBuild = [ buildPackages.file ];
|
|
|
|
buildCommand = flip concatMapStrings
|
|
[ packagesGmp /* packagesIntegerSimple */ ]
|
|
(packages: ''
|
|
exe="${packages.pandoc.components.exes.pandoc}/bin/pandoc${stdenv.hostPlatform.extensions.executable}"
|
|
|
|
printf "checking whether executable runs... " >& 2
|
|
${toString packages.pandoc.components.exes.pandoc.config.testWrapper} $exe --version
|
|
|
|
'' + optionalString stdenv.hostPlatform.isMusl ''
|
|
printf "checking whether executable is static... " >& 2
|
|
file $exe
|
|
file $exe | grep "statically linked"
|
|
|
|
'') + "touch $out";
|
|
|
|
meta.platforms = platforms.all;
|
|
|
|
passthru = {
|
|
# Attributes used for debugging with nix repl
|
|
inherit buildPackages;
|
|
project-gmp = project { gpl = true; };
|
|
project-integer-simple = project { gpl = false; };
|
|
pandoc-gmp = packagesGmp.pandoc.components.exes.pandoc;
|
|
pandoc-integer-simple = packagesIntegerSimple.pandoc.components.exes.pandoc;
|
|
};
|
|
};
|
|
}
|