$ nix-build -E "with (import <nixpkgs> {}).pkgs; haskellPackages.callPackage ./. {}"
...
$ ldd /nix/store/pd6ax4qhldi79vkilxy8246l7pz7l59f-static-haskell-0.1.0.0/bin/main
not a dynamic executable
$ /nix/store/pd6ax4qhldi79vkilxy8246l7pz7l59f-static-haskell-0.1.0.0/bin/main
"hi"
{ mkDerivation, stdenv, haskell, glibc, gmp, bytestring | |
}: | |
let gmp-static = gmp.override { withStatic = true; }; | |
in mkDerivation { | |
pname = "static-haskell"; | |
version = "0.1.0.0"; | |
src = ./.; | |
isLibrary = false; | |
isExecutable = true; | |
configureFlags = [ | |
"--ghc-option=-optl=-static" | |
"--ghc-option=-optl=-pthread" | |
"--extra-lib-dirs=${glibc.static}/lib" | |
"--extra-lib-dirs=${gmp-static}/lib" | |
]; | |
executableHaskellDepends = [ | |
bytestring | |
]; | |
license = stdenv.lib.licenses.gpl3; | |
enableSharedExecutables = false; | |
} |
name: static-haskell-nix | |
version: 0.1.0.0 | |
dependencies: | |
- base >=4.9 && <5 | |
executables: | |
main: | |
main: Main.hs |
-- This file has been generated from package.yaml by hpack version 0.17.0. | |
-- | |
-- see: https://github.com/sol/hpack | |
name: static-haskell-nix | |
version: 0.1.0.0 | |
build-type: Simple | |
cabal-version: >= 1.10 | |
executable main | |
main-is: Main.hs | |
build-depends: | |
base >=4.9 && <5 | |
default-language: Haskell2010 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment