on 19052d8 help sign in
47 lines 1.3 kB history raw
1# Test a package set
2{ stdenv, lib, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, dwarfdump }:
4with lib;
6let
7 project = cabalProject' {
8 inherit compiler-nix-name;
9 src = testSrc "cabal-simple-debug";
10 };
12 packages = project.hsPkgs;
14in recurseIntoAttrs {
15 # DWARF only works on linux with GHC 8.10.2 and newer
16 meta.disabled = __elem compiler-nix-name ["ghc865" "ghc884"]
17 || !stdenv.hostPlatform.isLinux || haskellLib.isCrossHost || stdenv.hostPlatform.isMusl;
18 ifdInputs = {
19 inherit (project) plan-nix;
20 };
21 run = stdenv.mkDerivation {
22 name = "cabal-simple-debug-test";
24 buildCommand = ''
25 exe="${(packages.cabal-simple.components.exes.cabal-simple.dwarf).exePath}"
27 size=$(command stat --format '%s' "$exe")
28 printf "size of executable $exe is $size. \n" >& 2
30 # fixme:
31 printf "checking whether executable included DWARF debug info... " >& 2
32 (${dwarfdump}/bin/dwarfdump $exe || true) | grep -c 'libraries/base/[A-Za-z0-9/]*\.hs'
33 (${dwarfdump}/bin/dwarfdump $exe || true) | grep -c '\/Main\.hs'
35 touch $out
36 '';
38 meta = {
39 platforms = platforms.all;
40 };
42 passthru = {
43 # Used for debugging with nix repl
44 inherit project packages;
45 };
46 };