on e94de40 help sign in
66 lines 2.0 kB history raw
1{ stackProject'
2, stdenv, gmp6, openssl, zlib, libffi
3, buildPackages
4, recurseIntoAttrs
5, testSrc
6}:
8with stdenv.lib;
10let
11 # Grab the compiler name from stack-to-nix output.
12 # compiler = (stack-pkgs.extras {}).compiler.nix-name;
13 compiler = "ghc865"; # fixme
15 # IFD stack-to-nix
16 project = { gpl ? true }: stackProject' {
17 src = testSrc "fully-static";
18 pkg-def-extras = [];
19 modules = [
20 {
21 # Select a non-GMP compiler, usually for software licensing reasons.
22 ghc.package = mkIf (stdenv.hostPlatform.isMusl && !gpl)
23 buildPackages.haskell-nix.compiler.integer-simple.${compiler};
24 }
25 ];
26 };
27 packagesGmp = (project { gpl = true; }).hsPkgs;
28 packagesIntegerSimple = (project { gpl = false; }).hsPkgs;
30in recurseIntoAttrs {
31 ifdInputs = {
32 stack-nix-gmp = (project { gpl = true; }).stack-nix;
33 stack-nix-simple = (project { gpl = false; }).stack-nix;
34 };
35 run = stdenv.mkDerivation {
36 name = "fully-static-test";
38 depsBuildBuild = [ buildPackages.file ];
40 buildCommand = flip concatMapStrings
41 [ packagesGmp /* packagesIntegerSimple */ ]
42 (packages: ''
43 exe="${packages.pandoc.components.exes.pandoc}/bin/pandoc${stdenv.hostPlatform.extensions.executable}"
45 printf "checking whether executable runs... " >& 2
46 ${toString packages.pandoc.components.exes.pandoc.config.testWrapper} $exe --version
48 '' + optionalString stdenv.hostPlatform.isMusl ''
49 printf "checking whether executable is static... " >& 2
50 file $exe
51 file $exe | grep "statically linked"
53 '') + "touch $out";
55 meta.platforms = platforms.all;
57 passthru = {
58 # Attributes used for debugging with nix repl
59 inherit buildPackages;
60 project-gmp = project { gpl = true; };
61 project-integer-simple = project { gpl = false; };
62 pandoc-gmp = packagesGmp.pandoc.components.exes.pandoc;
63 pandoc-integer-simple = packagesIntegerSimple.pandoc.components.exes.pandoc;
64 };
65 };