nh2 / static-haskell-nix

easily build most Haskell programs into fully static Linux executables
388 stars 36 forks source link

survey: Export final overlay as `pkgs` #41

Closed nh2 closed 5 years ago

nh2 commented 5 years ago

Fixes #39.

It fixes problems with e.g. -lsqlite not finding its .a file when the static-stack2nix-builder is used because that one uses just .pkgs as exported from survey.

If that exported .pkgs doesn't have archive files for sqlite (which until now it didn't have, becuase it just re-exported the pkgs from survey's import list), then of course linking will fail.

Odd is that fixing this also triggers the zlib = issue_61682_throw "zlib" previous.zlib; notice (see added comment); I don't know why that is. Commenting it out requires building a new GHC with these key changes:

% nix-diff /nix/store/jp8cc8hy35hbvwx19pv5aa8fqvf1b7pn-ghc-8.6.5.drv /nix/store/kxkmvjn9xc7027a3x8ydxba5rck9hz82-ghc-8.6.5.drv
- /nix/store/jp8cc8hy35hbvwx19pv5aa8fqvf1b7pn-ghc-8.6.5.drv:{out}
+ /nix/store/kxkmvjn9xc7027a3x8ydxba5rck9hz82-ghc-8.6.5.drv:{out}
• The input named `D5123.diff` differs
  - /nix/store/7nd9wjx2qkjggw3d5jrk1w1aar7ydjcp-D5123.diff.drv:{out}
  + /nix/store/8qcr2ksi16h95kxwal75zpi9v6r6jmr4-D5123.diff.drv:{out}
  • The input named `curl-7.64.1` differs
    - /nix/store/wpaqwfz8gg6vfvc588cqc9ry358xv4ig-curl-7.64.1.drv:{dev}
    + /nix/store/rlj4m1xj45wrispidf7719gpf9j2gp4w-curl-7.64.1.drv:{dev}
    • The input named `libkrb5-1.17` differs
      - /nix/store/w3hv9rgwb4lhabksp2d9cnzcdwv1mks2-libkrb5-1.17.drv:{dev}
      + /nix/store/d3s9r6w9d1m072y7ykhyfwap2s6807sl-libkrb5-1.17.drv:{dev}
      • The input named `keyutils-1.6` differs
        - /nix/store/hc9f4ngpkw2qkf76c4qdzrr5y2dahav1-keyutils-1.6.drv:{dev}
        + /nix/store/47wjga8hqnfmvh7g87sbhihsjr00sh3n-keyutils-1.6.drv:{dev}
        • The environments do not match:
            + dontDisableStatic=1
      • The input named `openssl-1.0.2r` differs
        - /nix/store/f0y72fc905zn03p2jrbg64ppvbxw9kqz-openssl-1.0.2r.drv:{dev}
        + /nix/store/jh0dg4vi4zq15wqichppc7wjf20qbh1p-openssl-1.0.2r.drv:{dev}
        • The environments do not match:
            postInstall=''
                ←# If we're building dyna←m←ic libraries, then don't install static
                # libraries.
                if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
                    rm "$out/lib/"*.a
                fi

                m←kdir -p $bin
                substituteInPlace $out/bin/c_rehash --replace /nix/store/8kl94wsr19xxsk676xi956nsmdpihybw-perl-5.28.2 /nix/store/8kl94wsr19xxsk676xi956nsmdpihybw-perl-5.28.2
                mv $out/bin $bin/

                mkdir $dev
                mv $out/include $dev/

                # remove dependency on Perl at runtime
                rm -r $out/etc/ssl/misc

                rmdir $out/etc/ssl/{certs,private}
            ''

Important here: dontDisableStatic=1 in keyutils, and the removal of .a-removal for openssl ( is what's usually red for deletion in nix-diff).