commercialhaskell / stack

The Haskell Tool Stack
http://haskellstack.org
BSD 3-Clause "New" or "Revised" License
3.99k stars 845 forks source link

Performance overheard with nix integration. #4406

Open chrissound opened 5 years ago

chrissound commented 5 years ago

I've recently migrated to Nixos, and have started using nix with stack. However this seems to add considerable delay to starting ghci for things like ghcid / intero - something I normally wouldn't notice is now taking 5s +-.

I'm not too familiar with what Nix is doing, but possibly there is a way to cache something or mount something in a ramfile (tmpfs iirc)?

Output of stack -v ghci app:

``` 1.9.1 x86_64 hpack-0.31.0 2018-11-18 21:11:25.371137: [debug] Checking for project config at: /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/stack.yaml 2018-11-18 21:11:25.371426: [debug] Loading project config file stack.yaml 2018-11-18 21:11:25.374024: [debug] Decoding build plan from: /home/chris/.stack/build-plan/lts-12.12.yaml 2018-11-18 21:11:25.374136: [debug] Trying to decode /home/chris/.stack/build-plan-cache/lts-12.12.cache 2018-11-18 21:11:25.381773: [debug] Success decoding /home/chris/.stack/build-plan-cache/lts-12.12.cache 2018-11-18 21:11:25.382056: [debug] PATH is: Just "/home/chris/.local/bin/:/home/chris/bin:/run/wrappers/bin:/etc/profiles/per-user/chris/bin:/home/chris/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/chris/.local/bin" 2018-11-18 21:11:25.382142: [debug] Using a nix-shell environment with nix packages: zlib.dev, zlib.out, haskell.compiler.ghc843, git, gcc, gmp 2018-11-18 21:11:25.382479: [debug] Run process: /run/current-system/sw/bin/nix-shell --pure -E "with (import {}); let inputs = [zlib.dev zlib.out haskell.compiler.ghc843 git gcc gmp]; libPath = lib.makeLibraryPath inputs; stackExtraArgs = lib.concatMap (pkg: [ ''--extra-lib-dirs=${lib.getLib pkg}/lib'' ''--extra-include-dirs=${lib.getDev pkg}/include'' ]) inputs; in runCommand ''myEnv'' { buildInputs = lib.optional stdenv.isLinux glibcLocales ++ inputs; STACK_PLATFORM_VARIANT=''nix''; STACK_IN_NIX_SHELL=1; LD_LIBRARY_PATH = libPath;STACK_IN_NIX_EXTRA_ARGS = stackExtraArgs; } \"\"" --run "'/nix/store/anrbbqw3v0zgb0gypv9vskf59yfs3pbm-stack-1.9.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=1.9.1' '-v' 'ghci' 'app'" 1.9.1 x86_64 hpack-0.31.0 2018-11-18 21:11:27.616683: [debug] Checking for project config at: /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/stack.yaml 2018-11-18 21:11:27.616988: [debug] Loading project config file stack.yaml 2018-11-18 21:11:27.623744: [debug] Decoding build plan from: /home/chris/.stack/build-plan/lts-12.12.yaml 2018-11-18 21:11:27.623886: [debug] Trying to decode /home/chris/.stack/build-plan-cache/lts-12.12.cache 2018-11-18 21:11:27.632732: [debug] Success decoding /home/chris/.stack/build-plan-cache/lts-12.12.cache 2018-11-18 21:11:27.632898: [debug] Getting system compiler version 2018-11-18 21:11:27.633125: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --info 2018-11-18 21:11:27.751692: [debug] Process finished in 118ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --info 2018-11-18 21:11:27.754339: [debug] Asking GHC for its version 2018-11-18 21:11:27.754587: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --numeric-version 2018-11-18 21:11:27.755750: [debug] Getting Cabal package version 2018-11-18 21:11:27.756307: [debug] Getting global package database location 2018-11-18 21:11:27.756410: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version 2018-11-18 21:11:27.757184: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db list --global 2018-11-18 21:11:27.834491: [debug] Process finished in 77ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db list --global 2018-11-18 21:11:27.846129: [debug] Process finished in 90ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version 2018-11-18 21:11:27.854536: [debug] Process finished in 100ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --numeric-version 2018-11-18 21:11:27.855253: [debug] GHC version is: ghc-8.4.3 2018-11-18 21:11:27.855372: [debug] Resolving package entries 2018-11-18 21:11:27.855535: [debug] Trying to decode /home/chris/.stack/loaded-snapshot-cache/x86_64-linux-nix/ghc-8.4.3/lts-12.12.cache 2018-11-18 21:11:27.926332: [debug] Success decoding /home/chris/.stack/loaded-snapshot-cache/x86_64-linux-nix/ghc-8.4.3/lts-12.12.cache 2018-11-18 21:11:27.928398: [debug] Starting to execute command inside EnvConfig 2018-11-18 21:11:27.928525: [debug] Parsing the targets 2018-11-18 21:11:27.928796: [debug] Running hpack on /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/package.yaml 2018-11-18 21:11:27.932962: [debug] hpack output unchanged in /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-18 21:11:27.935342: [debug] Trying to decode /home/chris/.stack/indices/Hackage/01-index.cache 2018-11-18 21:11:28.287698: [debug] Success decoding /home/chris/.stack/indices/Hackage/01-index.cache 2018-11-18 21:11:28.330095: [debug] Start: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-18 21:11:28.333248: [debug] Finished in 3ms: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-18 21:11:28.333513: [debug] Exception ignored when attempting to load /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/stack-build-caches/exe-app: /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/stack-build-caches/exe-app: openBinaryFile: does not exist (No such file or directory) 2018-11-18 21:11:28.335793: [debug] Parsing the targets 2018-11-18 21:11:28.366899: [debug] Finding out which packages are already installed 2018-11-18 21:11:28.367333: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-18 21:11:28.460505: [debug] Process finished in 93ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-18 21:11:28.460765: [debug] Ignoring package text due to wanting version 1.2.3.1 instead of 1.2.3.0 2018-11-18 21:11:28.461256: [debug] Ignoring package haskeline due to wanting version 0.7.4.3 instead of 0.7.4.2 2018-11-18 21:11:28.461547: [debug] Ignoring package stm due to wanting version 2.4.5.1 instead of 2.4.5.0 2018-11-18 21:11:28.461850: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:28.806107: [debug] Process finished in 344ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:28.811633: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:28.885053: [debug] Process finished in 73ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:28.885905: [debug] Start: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-18 21:11:28.888947: [debug] Finished in 3ms: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-18 21:11:28.895785: [info] Using main module: 1. Package `app' component exe:app with main-is file: /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/src/Main.hs 2018-11-18 21:11:28.895965: [debug] Parsing the targets 2018-11-18 21:11:28.927028: [debug] Start: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-18 21:11:28.930181: [debug] Finished in 3ms: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-18 21:11:28.930447: [debug] Exception ignored when attempting to load /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/stack-build-caches/exe-app: /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/stack-build-caches/exe-app: openBinaryFile: does not exist (No such file or directory) 2018-11-18 21:11:28.932038: [debug] Finding out which packages are already installed 2018-11-18 21:11:28.932235: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-18 21:11:29.029916: [debug] Process finished in 98ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-18 21:11:29.030245: [debug] Ignoring package text due to wanting version 1.2.3.1 instead of 1.2.3.0 2018-11-18 21:11:29.030702: [debug] Ignoring package haskeline due to wanting version 0.7.4.3 instead of 0.7.4.2 2018-11-18 21:11:29.030961: [debug] Ignoring package stm due to wanting version 2.4.5.1 instead of 2.4.5.0 2018-11-18 21:11:29.031837: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:29.374383: [debug] Process finished in 342ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:29.379732: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:29.453281: [debug] Process finished in 73ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:29.454027: [debug] Constructing the build plan 2018-11-18 21:11:29.607116: [debug] Checking if we are going to build multiple executables with the same name 2018-11-18 21:11:29.607319: [debug] Executing the build plan 2018-11-18 21:11:29.608772: [debug] Getting global package database location 2018-11-18 21:11:29.608882: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db list --global 2018-11-18 21:11:29.684047: [debug] Process finished in 75ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db list --global 2018-11-18 21:11:29.684703: [info] Building all executables for `app' once. After a successful build of all of them, only specified executables will be rebuilt. 2018-11-18 21:11:29.685727: [info] app-0.1.0.0: initial-build-steps (exe) 2018-11-18 21:11:29.686065: [debug] Run process within /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/: /home/chris/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1 repl stack-initial-build-steps 2018-11-18 21:11:29.770487: [debug] Process finished in 84ms: /home/chris/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1 repl stack-initial-build-steps 2018-11-18 21:11:29.770861: [debug] Finding out which packages are already installed 2018-11-18 21:11:29.771109: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-18 21:11:29.869445: [debug] Process finished in 98ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-18 21:11:29.869680: [debug] Ignoring package text due to wanting version 1.2.3.1 instead of 1.2.3.0 2018-11-18 21:11:29.870158: [debug] Ignoring package haskeline due to wanting version 0.7.4.3 instead of 0.7.4.2 2018-11-18 21:11:29.870952: [debug] Ignoring package stm due to wanting version 2.4.5.1 instead of 2.4.5.0 2018-11-18 21:11:29.871194: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:30.214190: [debug] Process finished in 343ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:30.219660: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:30.295848: [debug] Process finished in 76ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-18 21:11:30.296494: [debug] Start: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-18 21:11:30.299420: [debug] Finished in 3ms: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-18 21:11:30.307238: [info] Configuring GHCi with the following packages: app 2018-11-18 21:11:30.308359: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --version 2018-11-18 21:11:30.409289: [debug] Process finished in 101ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --version 2018-11-18 21:11:30.409599: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --interactive -i -odir=/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/odir -hidir=/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/odir -hide-all-packages -i/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/app -i/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/src -i/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/app/autogen -i/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/global-autogen -i/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/app/app-tmp -stubdir=/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build -I/nix/store/0cra95pqdhh33wi730bnc0mq2jwixlrr-gmp-6.1.2-dev/include -I/nix/store/0w330s2s7xiq31api8lfhydbc13896sb-zlib-1.2.11-dev/include -I/nix/store/3ni1gjg15klcc8x52x71ip5jx9blj5zx-git-2.16.5/include -I/nix/store/8c30dl4mmgm4rip1l08fvad9gca5sk2j-zlib-1.2.11/include -I/nix/store/9y2f87qb1djmpjs1gxl6smfkpl581waa-gcc-wrapper-7.3.0/include -I/nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/include -L/nix/store/0w330s2s7xiq31api8lfhydbc13896sb-zlib-1.2.11-dev/lib -L/nix/store/3ni1gjg15klcc8x52x71ip5jx9blj5zx-git-2.16.5/lib -L/nix/store/8c30dl4mmgm4rip1l08fvad9gca5sk2j-zlib-1.2.11/lib -L/nix/store/9y2f87qb1djmpjs1gxl6smfkpl581waa-gcc-wrapper-7.3.0/lib -L/nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/lib -L/nix/store/wc2ll61lypsv9yig6mvy73c0lw1dp15a-gmp-6.1.2/lib -package-id=aeson-1.3.1.1-1OkqdtyvGki5l4J1NAv2t2 -package-id=base-4.11.1.0 -package-id=binary-0.8.5.1 -package-id=binary-orphans-0.1.8.0-39x4G6qSmgR8DCEznq5kuk -package-id=bytestring-0.10.8.2 -package-id=directory-1.3.1.5 -package-id=lens-4.16.1-GeAlAh4cVDbGTwh8cjNcYq -package-id=old-locale-1.0.0.7-26K7wLFR2jK44UeOklvTCh -package-id=pretty-simple-2.1.0.1-8ASs0wI9YI68ZBesbmgb1L -package-id=split-0.2.3.3-3fFb67BrTpqAjKImK4FBjR -package-id=stm-2.4.5.1-1n1oRyz2WxkGi5pMiXlR3y -package-id=string-conversions-0.4.0.1-EzMSOHvXmIDwYIHdiF4RR -package-id=text-1.2.3.1-8ApPkOe77J58YHRjtBm7I8 -package-id=time-1.8.0.2 -optP-include -optP/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/ghci/88aa14ad/cabal_macros.h -ghci-script=/run/user/1000/haskell-stack-ghci/92d62735/ghci-script GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help ```
$ stack --version
Version 1.9.1, Git revision f9d0042c141660e1d38f797e1d426be4a99b2a3c (6168 commits) x86_64 hpack-0.31.0

Method of installation

dbaynard commented 5 years ago

The longest command to run (by a long way) seems to be this:

Run process: /run/current-system/sw/bin/nix-shell --pure -E "
  with (import <nixpkgs> {});
  let inputs = [zlib.dev zlib.out haskell.compiler.ghc843 git gcc gmp];
      libPath = lib.makeLibraryPath inputs;
      stackExtraArgs = lib.concatMap (pkg: [ ''--extra-lib-dirs=${lib.getLib pkg}/lib''   ''--extra-include-dirs=${lib.getDev pkg}/include'' ]) inputs;
  in runCommand ''myEnv'' {
      buildInputs = lib.optional stdenv.isLinux glibcLocales ++ inputs;
      STACK_PLATFORM_VARIANT=''nix'';
      STACK_IN_NIX_SHELL=1;
      LD_LIBRARY_PATH = libPath;
      STACK_IN_NIX_EXTRA_ARGS = stackExtraArgs;
  } \"\"" --run "'/nix/store/anrbbqw3v0zgb0gypv9vskf59yfs3pbm-stack-1.9.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=1.9.1' '-v' 'ghci' 'app'"

@nh2 is probably the best person to comment on nix behaviour.

nh2 commented 5 years ago

Right, as @dbaynard said, that's ~2.3 seconds for the nix-shell invocation.

There are only two things I can think of to improve the situation:

There may also be some nix related things that make other steps done by stack slower with the nix integration. For example, at least until recently, nix generated hug environment variables and amounts of linker flags, which made all programs called by stack (e.g. the eventual ghc --make invocation, or ghc-pkg) slower. Many of them were fixed, but it is possible that others remain.

@chrissound For this latter point, if you have time for it, it would be interesting to see the same project built with -v on the same computer on non-NixOS, to see if it's only nix-shell that slows it down, or if the other [debug] steps have shorter time differences in between as well.

Stack being uncomfortably slow with nix integration is certainly an issue UX-wise, which is good to track how it improves over time, but I don't have any immediate ideas on what can be done for it.

chrissound commented 5 years ago

I may have modified the code from the original run so I've run them both again:

stack nix: 6.4s stack: 1.48s

With the stack nix:

``` time stack -v ghci app 1.9.1 x86_64 hpack-0.31.0 2018-11-21 19:20:45.985417: [debug] Checking for project config at: /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/stack.yaml 2018-11-21 19:20:45.985701: [debug] Loading project config file stack.yaml 2018-11-21 19:20:45.988258: [debug] Decoding build plan from: /home/chris/.stack/build-plan/lts-12.12.yaml 2018-11-21 19:20:45.988384: [debug] Trying to decode /home/chris/.stack/build-plan-cache/lts-12.12.cache 2018-11-21 19:20:45.995277: [debug] Success decoding /home/chris/.stack/build-plan-cache/lts-12.12.cache 2018-11-21 19:20:45.995476: [debug] PATH is: Just "/home/chris/.local/bin/:/home/chris/bin:/run/wrappers/bin:/etc/profiles/per-user/chris/bin:/home/chris/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin" 2018-11-21 19:20:45.995549: [debug] Using a nix-shell environment with nix packages: zlib.dev, zlib.out, haskell.compiler.ghc843, git, gcc, gmp 2018-11-21 19:20:45.995836: [debug] Run process: /run/current-system/sw/bin/nix-shell --pure -E "with (import {}); let inputs = [zlib.dev zlib.out haskell.compiler.ghc843 git gcc gmp]; libPath = lib.makeLibraryPath inputs; stackExtraArgs = lib.concatMap (pkg: [ ''--extra-lib-dirs=${lib.getLib pkg}/lib'' ''--extra-include-dirs=${lib.getDev pkg}/include'' ]) inputs; in runCommand ''myEnv'' { buildInputs = lib.optional stdenv.isLinux glibcLocales ++ inputs; STACK_PLATFORM_VARIANT=''nix''; STACK_IN_NIX_SHELL=1; LD_LIBRARY_PATH = libPath;STACK_IN_NIX_EXTRA_ARGS = stackExtraArgs; } \"\"" --run "'/nix/store/anrbbqw3v0zgb0gypv9vskf59yfs3pbm-stack-1.9.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=1.9.1' '-v' 'ghci' 'app'" 1.9.1 x86_64 hpack-0.31.0 2018-11-21 19:20:48.176376: [debug] Checking for project config at: /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/stack.yaml 2018-11-21 19:20:48.176681: [debug] Loading project config file stack.yaml 2018-11-21 19:20:48.183424: [debug] Decoding build plan from: /home/chris/.stack/build-plan/lts-12.12.yaml 2018-11-21 19:20:48.183566: [debug] Trying to decode /home/chris/.stack/build-plan-cache/lts-12.12.cache 2018-11-21 19:20:48.192381: [debug] Success decoding /home/chris/.stack/build-plan-cache/lts-12.12.cache 2018-11-21 19:20:48.192549: [debug] Getting system compiler version 2018-11-21 19:20:48.192778: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --info 2018-11-21 19:20:48.315465: [debug] Process finished in 123ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --info 2018-11-21 19:20:48.317976: [debug] Getting global package database location 2018-11-21 19:20:48.318267: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db list --global 2018-11-21 19:20:48.319519: [debug] Asking GHC for its version 2018-11-21 19:20:48.320056: [debug] Getting Cabal package version 2018-11-21 19:20:48.320220: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --numeric-version 2018-11-21 19:20:48.321101: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version 2018-11-21 19:20:48.398890: [debug] Process finished in 80ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db list --global 2018-11-21 19:20:48.413632: [debug] Process finished in 92ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version 2018-11-21 19:20:48.418176: [debug] Process finished in 97ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --numeric-version 2018-11-21 19:20:48.418374: [debug] GHC version is: ghc-8.4.3 2018-11-21 19:20:48.418502: [debug] Resolving package entries 2018-11-21 19:20:48.418680: [debug] Trying to decode /home/chris/.stack/loaded-snapshot-cache/x86_64-linux-nix/ghc-8.4.3/lts-12.12.cache 2018-11-21 19:20:48.488561: [debug] Success decoding /home/chris/.stack/loaded-snapshot-cache/x86_64-linux-nix/ghc-8.4.3/lts-12.12.cache 2018-11-21 19:20:48.490627: [debug] Starting to execute command inside EnvConfig 2018-11-21 19:20:48.490751: [debug] Parsing the targets 2018-11-21 19:20:48.491020: [debug] Running hpack on /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/package.yaml 2018-11-21 19:20:48.495192: [debug] hpack output unchanged in /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-21 19:20:48.497535: [debug] Trying to decode /home/chris/.stack/indices/Hackage/01-index.cache 2018-11-21 19:20:48.846944: [debug] Success decoding /home/chris/.stack/indices/Hackage/01-index.cache 2018-11-21 19:20:48.888751: [debug] Start: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-21 19:20:48.891787: [debug] Finished in 3ms: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-21 19:20:48.892049: [debug] Exception ignored when attempting to load /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/stack-build-caches/exe-app: /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/stack-build-caches/exe-app: openBinaryFile: does not exist (No such file or directory) 2018-11-21 19:20:48.894436: [debug] Parsing the targets 2018-11-21 19:20:48.925081: [debug] Finding out which packages are already installed 2018-11-21 19:20:48.925524: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-21 19:20:49.025734: [debug] Process finished in 100ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-21 19:20:49.025960: [debug] Ignoring package text due to wanting version 1.2.3.1 instead of 1.2.3.0 2018-11-21 19:20:49.026402: [debug] Ignoring package haskeline due to wanting version 0.7.4.3 instead of 0.7.4.2 2018-11-21 19:20:49.026664: [debug] Ignoring package stm due to wanting version 2.4.5.1 instead of 2.4.5.0 2018-11-21 19:20:49.026917: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:49.377259: [debug] Process finished in 350ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:49.382569: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:49.461900: [debug] Process finished in 79ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:49.462665: [debug] Start: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-21 19:20:49.465651: [debug] Finished in 3ms: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-21 19:20:49.472412: [info] Using main module: 1. Package `app' component exe:app with main-is file: /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/src/Main.hs 2018-11-21 19:20:49.472596: [debug] Parsing the targets 2018-11-21 19:20:49.503677: [debug] Start: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-21 19:20:49.506804: [debug] Finished in 3ms: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-21 19:20:49.507065: [debug] Exception ignored when attempting to load /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/stack-build-caches/exe-app: /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/stack-build-caches/exe-app: openBinaryFile: does not exist (No such file or directory) 2018-11-21 19:20:49.508615: [debug] Finding out which packages are already installed 2018-11-21 19:20:49.508808: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-21 19:20:49.609452: [debug] Process finished in 100ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-21 19:20:49.609779: [debug] Ignoring package text due to wanting version 1.2.3.1 instead of 1.2.3.0 2018-11-21 19:20:49.610203: [debug] Ignoring package haskeline due to wanting version 0.7.4.3 instead of 0.7.4.2 2018-11-21 19:20:49.610460: [debug] Ignoring package stm due to wanting version 2.4.5.1 instead of 2.4.5.0 2018-11-21 19:20:49.611322: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:49.960635: [debug] Process finished in 349ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:49.966595: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:50.036922: [debug] Process finished in 70ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:50.037666: [debug] Constructing the build plan 2018-11-21 19:20:50.190969: [debug] Checking if we are going to build multiple executables with the same name 2018-11-21 19:20:50.191164: [debug] Executing the build plan 2018-11-21 19:20:50.192796: [debug] Getting global package database location 2018-11-21 19:20:50.192910: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db list --global 2018-11-21 19:20:50.264269: [debug] Process finished in 71ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --no-user-package-db list --global 2018-11-21 19:20:50.264945: [info] Building all executables for `app' once. After a successful build of all of them, only specified executables will be rebuilt. 2018-11-21 19:20:50.265965: [info] app-0.1.0.0: initial-build-steps (exe) 2018-11-21 19:20:50.266307: [debug] Run process within /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/: /home/chris/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1 repl stack-initial-build-steps 2018-11-21 19:20:50.351115: [debug] Process finished in 85ms: /home/chris/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1 repl stack-initial-build-steps 2018-11-21 19:20:50.351487: [debug] Finding out which packages are already installed 2018-11-21 19:20:50.351729: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-21 19:20:50.444758: [debug] Process finished in 93ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-11-21 19:20:50.444978: [debug] Ignoring package text due to wanting version 1.2.3.1 instead of 1.2.3.0 2018-11-21 19:20:50.445384: [debug] Ignoring package haskeline due to wanting version 0.7.4.3 instead of 0.7.4.2 2018-11-21 19:20:50.446075: [debug] Ignoring package stm due to wanting version 2.4.5.1 instead of 2.4.5.0 2018-11-21 19:20:50.446326: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:50.785091: [debug] Process finished in 339ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:50.790262: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:50.860867: [debug] Process finished in 70ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nix/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot 2018-11-21 19:20:50.861525: [debug] Start: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-21 19:20:50.864516: [debug] Finished in 3ms: getPackageFiles /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/app.cabal 2018-11-21 19:20:50.871412: [info] Configuring GHCi with the following packages: app 2018-11-21 19:20:50.872503: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --version 2018-11-21 19:20:50.967466: [debug] Process finished in 95ms: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --version 2018-11-21 19:20:50.967772: [debug] Run process: /nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/bin/ghc --interactive -i -odir=/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/odir -hidir=/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/odir -hide-all-packages -i/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/app -i/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/src -i/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/app/autogen -i/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/global-autogen -i/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build/app/app-tmp -stubdir=/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nix/Cabal-2.2.0.1/build -I/nix/store/0cra95pqdhh33wi730bnc0mq2jwixlrr-gmp-6.1.2-dev/include -I/nix/store/0w330s2s7xiq31api8lfhydbc13896sb-zlib-1.2.11-dev/include -I/nix/store/3ni1gjg15klcc8x52x71ip5jx9blj5zx-git-2.16.5/include -I/nix/store/8c30dl4mmgm4rip1l08fvad9gca5sk2j-zlib-1.2.11/include -I/nix/store/9y2f87qb1djmpjs1gxl6smfkpl581waa-gcc-wrapper-7.3.0/include -I/nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/include -L/nix/store/0w330s2s7xiq31api8lfhydbc13896sb-zlib-1.2.11-dev/lib -L/nix/store/3ni1gjg15klcc8x52x71ip5jx9blj5zx-git-2.16.5/lib -L/nix/store/8c30dl4mmgm4rip1l08fvad9gca5sk2j-zlib-1.2.11/lib -L/nix/store/9y2f87qb1djmpjs1gxl6smfkpl581waa-gcc-wrapper-7.3.0/lib -L/nix/store/dpd9k7q08wvb6d1a67h66amcazv5sy39-ghc-8.4.3/lib -L/nix/store/wc2ll61lypsv9yig6mvy73c0lw1dp15a-gmp-6.1.2/lib -package-id=aeson-1.3.1.1-1OkqdtyvGki5l4J1NAv2t2 -package-id=base-4.11.1.0 -package-id=binary-0.8.5.1 -package-id=binary-orphans-0.1.8.0-39x4G6qSmgR8DCEznq5kuk -package-id=bytestring-0.10.8.2 -package-id=directory-1.3.1.5 -package-id=lens-4.16.1-GeAlAh4cVDbGTwh8cjNcYq -package-id=old-locale-1.0.0.7-26K7wLFR2jK44UeOklvTCh -package-id=pretty-simple-2.1.0.1-8ASs0wI9YI68ZBesbmgb1L -package-id=split-0.2.3.3-3fFb67BrTpqAjKImK4FBjR -package-id=stm-2.4.5.1-1n1oRyz2WxkGi5pMiXlR3y -package-id=string-conversions-0.4.0.1-EzMSOHvXmIDwYIHdiF4RR -package-id=text-1.2.3.1-8ApPkOe77J58YHRjtBm7I8 -package-id=time-1.8.0.2 -optP-include -optP/home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/ghci/88aa14ad/cabal_macros.h -ghci-script=/run/user/1000/haskell-stack-ghci/92d62735/ghci-script GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/.ghci [1 of 1] Compiling Main ( /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/src/Main.hs, interpreted ) [flags changed] /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/src/Main.hs:29:9: warning: [-Wname-shadowing] This binding for `z' shadows the existing binding bound at /home/chris/chrishomeold/home/chris/Projects/Haskell/IoEitherApplic/src/Main.hs:28:9 | 29 | let z = ((liftM2 TestForm) <$> ai <*> bi) :: IO (Either () TestForm) | ^ Ok, one module loaded. Loaded GHCi configuration from /run/user/1000/haskell-stack-ghci/92d62735/ghci-script *Main> Leaving GHCi. stack -v ghci app 5.20s user 0.78s system 92% cpu 6.445 total ```

With stack:

``` time stack -v ghci app Version 1.7.1, Git revision 681c800873816c022739ca7ed14755e85a579565 (5807 commits) x86_64 hpack-0.28.2 2018-11-21 18:14:22.743383: [debug] Checking for project config at: /home/chris/Projects/Haskell/IoEitherApplic/stack.yaml @(src/Stack/Config.hs:850:9) 2018-11-21 18:14:22.743548: [debug] Loading project config file stack.yaml @(src/Stack/Config.hs:876:13) 2018-11-21 18:14:22.745000: [debug] Decoding build plan from: /home/chris/.stack/build-plan/lts-12.12.yaml @(src/Stack/Snapshot.hs:164:5) 2018-11-21 18:14:22.745072: [debug] Trying to decode /home/chris/.stack/build-plan-cache/lts-12.12.cache @(src/Stack/Snapshot.hs:156:32) 2018-11-21 18:14:22.750539: [debug] Success decoding /home/chris/.stack/build-plan-cache/lts-12.12.cache @(src/Stack/Snapshot.hs:156:32) 2018-11-21 18:14:22.751094: [debug] Found already installed GHC builds: nopie @(src/Stack/Setup.hs:458:13) 2018-11-21 18:14:22.752045: [debug] Getting global package database location @(src/Stack/GhcPkg.hs:47:5) 2018-11-21 18:14:22.752292: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --no-user-package-db list --global @(src/Stack/GhcPkg.hs:76:10) 2018-11-21 18:14:22.752872: [debug] Getting Cabal package version @(src/Stack/GhcPkg.hs:180:5) 2018-11-21 18:14:22.753033: [debug] Asking GHC for its version @(src/Stack/Setup/Installed.hs:98:13) 2018-11-21 18:14:22.753325: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version @(src/Stack/GhcPkg.hs:76:10) 2018-11-21 18:14:22.754091: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc --numeric-version @(src/Stack/Setup/Installed.hs:99:19) 2018-11-21 18:14:22.778528: [debug] Process finished in 25ms: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version @(src/Stack/GhcPkg.hs:76:10) 2018-11-21 18:14:22.778925: [debug] Process finished in 27ms: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --no-user-package-db list --global @(src/Stack/GhcPkg.hs:76:10) 2018-11-21 18:14:22.794498: [debug] Process finished in 40ms: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc --numeric-version @(src/Stack/Setup/Installed.hs:99:19) 2018-11-21 18:14:22.794611: [debug] GHC version is: ghc-8.4.3 @(src/Stack/Setup/Installed.hs:102:13) 2018-11-21 18:14:22.794700: [debug] Resolving package entries @(src/Stack/Setup.hs:256:5) 2018-11-21 18:14:22.794818: [debug] Trying to decode /home/chris/.stack/loaded-snapshot-cache/x86_64-linux/ghc-8.4.3/lts-12.12.cache @(src/Stack/Snapshot.hs:384:9) 2018-11-21 18:14:22.830508: [debug] Success decoding /home/chris/.stack/loaded-snapshot-cache/x86_64-linux/ghc-8.4.3/lts-12.12.cache @(src/Stack/Snapshot.hs:384:9) 2018-11-21 18:14:22.831623: [debug] Starting to execute command inside EnvConfig @(src/Stack/Runners.hs:171:18) 2018-11-21 18:14:22.831686: [debug] Parsing the targets @(src/Stack/Build/Target.hs:460:3) 2018-11-21 18:14:22.831784: [debug] Running hpack on /home/chris/Projects/Haskell/IoEitherApplic/package.yaml @(src/Stack/Package.hs:1390:9) 2018-11-21 18:14:22.833422: [warn] Warning: /home/chris/Projects/Haskell/IoEitherApplic/app.cabal was modified manually. Ignoring /home/chris/Projects/Haskell/IoEitherApplic/package.yaml in favor of the cabal file. If you want to use the package.yaml file instead of the cabal file, then please delete the cabal file. @(src/Stack/Package.hs:1414:67) 2018-11-21 18:14:22.834402: [debug] Trying to decode /home/chris/.stack/indices/Hackage/01-index.cache @(src/Stack/PackageIndex.hs:407:23) 2018-11-21 18:14:23.013900: [debug] Success decoding /home/chris/.stack/indices/Hackage/01-index.cache @(src/Stack/PackageIndex.hs:407:23) 2018-11-21 18:14:23.037007: [debug] Start: getPackageFiles /home/chris/Projects/Haskell/IoEitherApplic/app.cabal @(src/Stack/Package.hs:332:21) 2018-11-21 18:14:23.038017: [debug] Finished in 1ms: getPackageFiles /home/chris/Projects/Haskell/IoEitherApplic/app.cabal @(src/Stack/Package.hs:332:21) 2018-11-21 18:14:23.038157: [debug] Exception ignored when attempting to load /home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nopie/Cabal-2.2.0.1/stack-build-caches/exe-app: /home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nopie/Cabal-2.2.0.1/stack-build-caches/exe-app: openBinaryFile: does not exist (No such file or directory) @(src/Stack/Build/Cache.hs:134:67) 2018-11-21 18:14:23.039097: [debug] Parsing the targets @(src/Stack/Build/Target.hs:460:3) 2018-11-21 18:14:23.057783: [debug] Parsing the targets @(src/Stack/Build/Target.hs:460:3) 2018-11-21 18:14:23.075318: [debug] Start: getPackageFiles /home/chris/Projects/Haskell/IoEitherApplic/app.cabal @(src/Stack/Package.hs:332:21) 2018-11-21 18:14:23.076392: [debug] Finished in 1ms: getPackageFiles /home/chris/Projects/Haskell/IoEitherApplic/app.cabal @(src/Stack/Package.hs:332:21) 2018-11-21 18:14:23.076530: [debug] Exception ignored when attempting to load /home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nopie/Cabal-2.2.0.1/stack-build-caches/exe-app: /home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nopie/Cabal-2.2.0.1/stack-build-caches/exe-app: openBinaryFile: does not exist (No such file or directory) @(src/Stack/Build/Cache.hs:134:67) 2018-11-21 18:14:23.077405: [debug] Finding out which packages are already installed @(src/Stack/Build/Installed.hs:57:5) 2018-11-21 18:14:23.077559: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.121286: [debug] Process finished in 44ms: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.121664: [debug] Ignoring package stm due to wanting version 2.4.5.1 instead of 2.4.5.0 @(src/Stack/Build/Installed.hs:185:5) 2018-11-21 18:14:23.121873: [debug] Ignoring package haskeline due to wanting version 0.7.4.3 instead of 0.7.4.2 @(src/Stack/Build/Installed.hs:185:5) 2018-11-21 18:14:23.121959: [debug] Ignoring package text due to wanting version 1.2.3.1 instead of 1.2.3.0 @(src/Stack/Build/Installed.hs:185:5) 2018-11-21 18:14:23.122090: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nopie/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.272257: [debug] Process finished in 150ms: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nopie/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.275958: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nopie/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.298198: [debug] Process finished in 22ms: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nopie/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.298595: [debug] Constructing the build plan @(src/Stack/Build/ConstructPlan.hs:186:5) 2018-11-21 18:14:23.303324: [debug] Checking if we are going to build multiple executables with the same name @(src/Stack/Build.hs:177:5) 2018-11-21 18:14:23.303439: [debug] Executing the build plan @(src/Stack/Build/Execute.hs:491:5) 2018-11-21 18:14:23.304128: [debug] Getting global package database location @(src/Stack/GhcPkg.hs:47:5) 2018-11-21 18:14:23.304182: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --no-user-package-db list --global @(src/Stack/GhcPkg.hs:76:10) 2018-11-21 18:14:23.326819: [debug] Process finished in 23ms: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --no-user-package-db list --global @(src/Stack/GhcPkg.hs:76:10) 2018-11-21 18:14:23.327305: [info] Building all executables for `app' once. After a successful build of all of them, only specified executables will be rebuilt. @(src/Stack/Build/Execute.hs:1353:19) 2018-11-21 18:14:23.327720: [info] app-0.1.0.0: initial-build-steps (exe) @(src/Stack/Build/Execute.hs:873:23) 2018-11-21 18:14:23.327893: [debug] Run process within /home/chris/Projects/Haskell/IoEitherApplic/: /home/chris/.stack/setup-exe-cache/x86_64-linux-nopie/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux-nopie/Cabal-2.2.0.1 repl stack-initial-build-steps @(src/Stack/Prelude.hs:96:3) 2018-11-21 18:14:23.370608: [debug] Process finished in 43ms: /home/chris/.stack/setup-exe-cache/x86_64-linux-nopie/Cabal-simple_mPHDZzAJ_2.2.0.1_ghc-8.4.3 --builddir=.stack-work/dist/x86_64-linux-nopie/Cabal-2.2.0.1 repl stack-initial-build-steps @(src/Stack/Prelude.hs:96:3) 2018-11-21 18:14:23.370869: [debug] Finding out which packages are already installed @(src/Stack/Build/Installed.hs:57:5) 2018-11-21 18:14:23.371000: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.405777: [debug] Process finished in 35ms: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.406239: [debug] Ignoring package stm due to wanting version 2.4.5.1 instead of 2.4.5.0 @(src/Stack/Build/Installed.hs:185:5) 2018-11-21 18:14:23.406604: [debug] Ignoring package haskeline due to wanting version 0.7.4.3 instead of 0.7.4.2 @(src/Stack/Build/Installed.hs:185:5) 2018-11-21 18:14:23.406720: [debug] Ignoring package text due to wanting version 1.2.3.1 instead of 1.2.3.0 @(src/Stack/Build/Installed.hs:185:5) 2018-11-21 18:14:23.406934: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nopie/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.565399: [debug] Process finished in 158ms: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/.stack/snapshots/x86_64-linux-nopie/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.568808: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nopie/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.593242: [debug] Process finished in 24ms: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc-pkg --user --no-user-package-db --package-db /home/chris/Projects/Haskell/IoEitherApplic/.stack-work/install/x86_64-linux-nopie/lts-12.12/8.4.3/pkgdb dump --expand-pkgroot @(src/Stack/Prelude.hs:117:3) 2018-11-21 18:14:23.594074: [debug] Start: getPackageFiles /home/chris/Projects/Haskell/IoEitherApplic/app.cabal @(src/Stack/Package.hs:332:21) 2018-11-21 18:14:23.595208: [debug] Finished in 1ms: getPackageFiles /home/chris/Projects/Haskell/IoEitherApplic/app.cabal @(src/Stack/Package.hs:332:21) 2018-11-21 18:14:23.599842: [info] Configuring GHCi with the following packages: app @(src/Stack/Ghci.hs:366:5) 2018-11-21 18:14:23.600160: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc --version @(src/Stack/Ghci.hs:878:3) 2018-11-21 18:14:23.631505: [debug] Process finished in 31ms: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc --version @(src/Stack/Ghci.hs:878:3) 2018-11-21 18:14:23.631609: [info] Using main module: 1. Package `app' component exe:app with main-is file: /home/chris/Projects/Haskell/IoEitherApplic/src/Main.hs @(src/Stack/Ghci.hs:488:28) 2018-11-21 18:14:23.631739: [debug] Run process: /home/chris/.stack/programs/x86_64-linux/ghc-nopie-8.4.3/bin/ghc --interactive -i -odir=/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/odir -hidir=/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/odir -hide-all-packages -i/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nopie/Cabal-2.2.0.1/build/app -i/home/chris/Projects/Haskell/IoEitherApplic/src -i/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nopie/Cabal-2.2.0.1/build/app/autogen -i/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nopie/Cabal-2.2.0.1/build/global-autogen -i/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nopie/Cabal-2.2.0.1/build/app/app-tmp -stubdir=/home/chris/Projects/Haskell/IoEitherApplic/.stack-work/dist/x86_64-linux-nopie/Cabal-2.2.0.1/build -package-id=aeson-1.3.1.1-1OkqdtyvGki5l4J1NAv2t2 -package-id=base-4.11.1.0 -package-id=binary-0.8.5.1 -package-id=binary-orphans-0.1.8.0-39x4G6qSmgR8DCEznq5kuk -package-id=bytestring-0.10.8.2 -package-id=directory-1.3.1.5 -package-id=lens-4.16.1-GeAlAh4cVDbGTwh8cjNcYq -package-id=old-locale-1.0.0.7-26K7wLFR2jK44UeOklvTCh -package-id=pretty-simple-2.1.0.1-8ASs0wI9YI68ZBesbmgb1L -package-id=split-0.2.3.3-3fFb67BrTpqAjKImK4FBjR -package-id=stm-2.4.5.1-1n1oRyz2WxkGi5pMiXlR3y -package-id=string-conversions-0.4.0.1-EzMSOHvXmIDwYIHdiF4RR -package-id=text-1.2.3.1-8ApPkOe77J58YHRjtBm7I8 -package-id=time-1.8.0.2 -optP-include -optP/tmp/haskell-stack-ghci/61970fe5/cabal_macros.h -ghci-script=/tmp/haskell-stack-ghci/49e13fdc/ghci-script @(src/RIO/Process.hs:479:5) GHCi, version 8.4.3: http://www.haskell.org/ghc/ :? for help Loaded GHCi configuration from /home/chris/Projects/Haskell/IoEitherApplic/.ghci Loaded GHCi configuration from /home/chris/.ghci [1 of 1] Compiling Main ( /home/chris/Projects/Haskell/IoEitherApplic/src/Main.hs, interpreted ) [flags changed] /home/chris/Projects/Haskell/IoEitherApplic/src/Main.hs:29:9: warning: [-Wname-shadowing] This binding for ‘z’ shadows the existing binding bound at /home/chris/Projects/Haskell/IoEitherApplic/src/Main.hs:28:9 | 29 | let z = ((liftM2 TestForm) <$> ai <*> bi) :: IO (Either () TestForm) | ^ Ok, one module loaded. Loaded GHCi configuration from /tmp/haskell-stack-ghci/49e13fdc/ghci-script >>> Leaving GHCi. stack -v ghci app 1.05s user 0.22s system 85% cpu 1.485 total ```
dbaynard commented 5 years ago

This is broader than ghci (see #4329)

nh2 commented 5 years ago

Inviting @rikvdkleij from #4329

nh2 commented 5 years ago

Based on @chrissound's latest output, there seem to inded be operations that take longer in his nix-shell than they take outside. For example:

Processes

Nix:

Process finished in 80ms: /nix/...ghc-8.4.3/bin/ghc-pkg --no-user-package-db list --global
Process finished in 92ms: /nix/...ghc-8.4.3/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
Process finished in 97ms: /nix/...ghc-8.4.3/bin/ghc --numeric-version

Stack:

Process finished in 27ms: /home/...ghc-nopie-8.4.3/bin/ghc-pkg --no-user-package-db list --global
Process finished in 25ms: /home/...ghc-nopie-8.4.3/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version
Process finished in 40ms: /home/...ghc-nopie-8.4.3/bin/ghc --numeric-version

The processes finish 2-3x faster when not run inside nix.

Summing up all Process finished ini ... numbers, I get 2193 ms for nix and 622 ms for stack, so there's some ~4x overhead for running the processes in nix.

Decoding

Nix: 350ms for

2018-11-21 19:20:48.497535: [debug] Trying to decode /home/chris/.stack/indices/Hackage/01-index.cache
2018-11-21 19:20:48.846944: [debug] Success decoding /home/chris/.stack/indices/Hackage/01-index.cache

Stack: 179ms for

2018-11-21 18:14:22.834402: [debug] Trying to decode /home/chris/.stack/indices/Hackage/01-index.cache
2018-11-21 18:14:23.013900: [debug] Success decoding /home/chris/.stack/indices/Hackage/01-index.cache

So here even a non-process-spawning operation like decoding a file is 2x slower when stack runs it in nix.

CPU-only operation

Nix: 153ms for

2018-11-21 19:20:50.037666: [debug] Constructing the build plan
2018-11-21 19:20:50.190969: [debug] Checking if we are going to build multiple executables with the same name

Stack: 4ms for:

2018-11-21 18:14:23.298595: [debug] Constructing the build plan
2018-11-21 18:14:23.303324: [debug] Checking if we are going to build multiple executables with the same name

Here the difference is even more absurd, with a ~40x difference for this operation.

Preliminary time analysis

With some rounding and discarding the fact that some things may happen in parallel, we now have a pretty obvious summary of time spent:

                                            nix     |     stack   |  difference
                                         -----------+-------------+------------
Time to ghc invocation                   4.98       |  0.88       |  4.09
  `nix-shell` invocation                      2.18  |       0     |       2.18
  external processes                          2.19  |       0.62  |       1.57
  decoding `index.cache`                      0.35  |       0.18  |       0.17
  constructing build plan                     0.15  |       0.004 |       0.14
  decoding loaded-.../lts-12.12.cache         0.07  |       0.03  |       0.03
The ghc invocation itself                1.46       |  0.59       |  0.86
                                         -----------+-------------+------------
Total                                    6.44       |  1.47       |  4.97

To investigate

Suspicions/ideas


Volunteers needed!

qrilka commented 5 years ago

My current suspicion is that the main hurdle is in Nix itself, in the way it handles dynamic expressions (which Stack constructs on a fly), e.g. using xeno source code I see the following:

stack --nix-shell-file shell.nix -v repl

``` Version 1.9.1, Git revision f9d0042c141660e1d38f797e1d426be4a99b2a3c (6168 commits) x86_64 hpack-0.31.0 2018-12-02 00:27:58.034576: [debug] Checking for project config at: /home/qrilka/ws/h/xeno/stack.yaml 2018-12-02 00:27:58.034753: [debug] Loading project config file stack.yaml 2018-12-02 00:27:58.035902: [debug] Decoding build plan from: /home/qrilka/.stack/build-plan/lts-11.3.yaml 2018-12-02 00:27:58.035961: [debug] Trying to decode /home/qrilka/.stack/build-plan-cache/lts-11.3.cache 2018-12-02 00:27:58.041855: [debug] Success decoding /home/qrilka/.stack/build-plan-cache/lts-11.3.cache 2018-12-02 00:27:58.042359: [debug] Run process: /sbin/ldconfig -p 2018-12-02 00:27:58.044908: [debug] Process finished in 2ms: /sbin/ldconfig -p 2018-12-02 00:27:58.046894: [debug] Did not find shared library libtinfo.so.5 2018-12-02 00:27:58.046965: [debug] Found shared library libtinfo.so.6 in 'ldconfig -p' output 2018-12-02 00:27:58.047057: [debug] Found shared library libncursesw.so.6 in 'ldconfig -p' output 2018-12-02 00:27:58.047142: [debug] Found shared library libgmp.so.10 in 'ldconfig -p' output 2018-12-02 00:27:58.047271: [debug] Did not find shared library libgmp.so.3 2018-12-02 00:27:58.047310: [debug] Potential GHC builds: tinfo6, ncurses6 2018-12-02 00:27:58.047371: [debug] Found already installed GHC builds: tinfo6 2018-12-02 00:27:58.047907: [debug] Getting global package database location 2018-12-02 00:27:58.048000: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --no-user-package-db list --global 2018-12-02 00:27:58.051933: [debug] Getting Cabal package version 2018-12-02 00:27:58.052045: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version 2018-12-02 00:27:58.052320: [debug] Asking GHC for its version 2018-12-02 00:27:58.052459: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc --numeric-version 2018-12-02 00:27:58.069621: [debug] Process finished in 17ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version 2018-12-02 00:27:58.069805: [debug] Process finished in 22ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --no-user-package-db list --global 2018-12-02 00:27:58.081928: [debug] Process finished in 29ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc --numeric-version 2018-12-02 00:27:58.082023: [debug] GHC version is: ghc-8.2.2 2018-12-02 00:27:58.082089: [debug] Resolving package entries 2018-12-02 00:27:58.082187: [debug] Trying to decode /home/qrilka/.stack/loaded-snapshot-cache/x86_64-linux/ghc-8.2.2/lts-11.3.cache 2018-12-02 00:27:58.119276: [debug] Success decoding /home/qrilka/.stack/loaded-snapshot-cache/x86_64-linux/ghc-8.2.2/lts-11.3.cache 2018-12-02 00:27:58.119677: [debug] Starting to execute command inside EnvConfig 2018-12-02 00:27:58.119738: [debug] Parsing the targets 2018-12-02 00:27:58.124050: [debug] Trying to decode /home/qrilka/.stack/indices/Hackage/01-index.cache 2018-12-02 00:27:58.322734: [debug] Success decoding /home/qrilka/.stack/indices/Hackage/01-index.cache 2018-12-02 00:27:58.344484: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:27:58.347768: [debug] Finished in 3ms: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:27:58.348602: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/hexml.cabal 2018-12-02 00:27:58.350026: [debug] Finished in 1ms: getPackageFiles /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/hexml.cabal 2018-12-02 00:27:58.350162: [debug] Exception ignored when attempting to load /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/stack-build-caches/lib: /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/stack-build-caches/lib: openBinaryFile: does not exist (No such file or directory) 2018-12-02 00:27:58.350886: [debug] Parsing the targets 2018-12-02 00:27:58.366730: [debug] Finding out which packages are already installed 2018-12-02 00:27:58.366914: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:27:58.394405: [debug] Process finished in 27ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:27:58.394558: [debug] Ignoring package haskeline due to wanting version 0.7.4.2 instead of 0.7.4.0 2018-12-02 00:27:58.394980: [debug] Ignoring package Cabal due to wanting version 2.0.1.1 instead of 2.0.1.0 2018-12-02 00:27:58.395132: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.421702: [debug] Process finished in 26ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.422051: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.438660: [debug] Process finished in 17ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.439080: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:27:58.442378: [debug] Finished in 3ms: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:27:58.442967: [debug] Parsing the targets 2018-12-02 00:27:58.458396: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:27:58.461711: [debug] Finished in 3ms: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:27:58.462414: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/hexml.cabal 2018-12-02 00:27:58.463816: [debug] Finished in 1ms: getPackageFiles /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/hexml.cabal 2018-12-02 00:27:58.463945: [debug] Exception ignored when attempting to load /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/stack-build-caches/lib: /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/stack-build-caches/lib: openBinaryFile: does not exist (No such file or directory) 2018-12-02 00:27:58.464849: [debug] Finding out which packages are already installed 2018-12-02 00:27:58.464950: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:27:58.492664: [debug] Process finished in 28ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:27:58.492895: [debug] Ignoring package haskeline due to wanting version 0.7.4.2 instead of 0.7.4.0 2018-12-02 00:27:58.493387: [debug] Ignoring package Cabal due to wanting version 2.0.1.1 instead of 2.0.1.0 2018-12-02 00:27:58.493515: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.519105: [debug] Process finished in 26ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.519470: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.536020: [debug] Process finished in 16ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.536348: [debug] Constructing the build plan 2018-12-02 00:27:58.537409: [debug] Checking if we are going to build multiple executables with the same name 2018-12-02 00:27:58.537481: [debug] Executing the build plan 2018-12-02 00:27:58.537821: [debug] Getting global package database location 2018-12-02 00:27:58.537889: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --no-user-package-db list --global 2018-12-02 00:27:58.554208: [debug] Process finished in 16ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --no-user-package-db list --global 2018-12-02 00:27:58.554661: [debug] Finding out which packages are already installed 2018-12-02 00:27:58.554782: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:27:58.582584: [debug] Process finished in 28ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:27:58.582901: [debug] Ignoring package haskeline due to wanting version 0.7.4.2 instead of 0.7.4.0 2018-12-02 00:27:58.583157: [debug] Ignoring package Cabal due to wanting version 2.0.1.1 instead of 2.0.1.0 2018-12-02 00:27:58.583286: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.609196: [debug] Process finished in 26ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.609545: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.626273: [debug] Process finished in 17ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:27:58.626566: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:27:58.629829: [debug] Finished in 3ms: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:27:58.630459: [warn] The following GHC options are incompatible with GHCi and have not been passed to it: -O2 2018-12-02 00:27:58.630516: [info] Configuring GHCi with the following packages: xeno 2018-12-02 00:27:58.630803: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc --version 2018-12-02 00:27:58.659242: [debug] Process finished in 28ms: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc --version 2018-12-02 00:27:58.659469: [debug] Run process: /home/qrilka/.stack/programs/x86_64-linux/ghc-tinfo6-8.2.2/bin/ghc --interactive -i -odir=/home/qrilka/ws/h/xeno/.stack-work/odir -hidir=/home/qrilka/ws/h/xeno/.stack-work/odir -hide-all-packages -i/home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build -i/home/qrilka/ws/h/xeno/src -i/home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/autogen -i/home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/global-autogen -stubdir=/home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build -package-id=base-4.10.1.0 -package-id=bytestring-0.10.8.2 -package-id=vector-0.12.0.1-JlawpRjIcMJIYPJVsWriIA -package-id=deepseq-1.4.3.0 -package-id=array-0.5.2.0 -package-id=mutable-containers-0.3.4-GWNoXux5XcyA1AQoF0whBX -package-id=mtl-2.2.2-8XubxMJDT8QLsstvlNotkc -package-id=hspec-2.4.8-8S5J29axVCKHbj3wvjgswz -Wall -optP-include -optP/home/qrilka/ws/h/xeno/.stack-work/ghci/f24b20c1/cabal_macros.h -ghci-script=/tmp/haskell-stack-ghci/4bb87755/ghci-script GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help ```

Giving 0.62s between the first and the last log lines

and

stack --nix -v repl

``` Version 1.9.1, Git revision f9d0042c141660e1d38f797e1d426be4a99b2a3c (6168 commits) x86_64 hpack-0.31.0 2018-12-02 00:43:35.760815: [debug] Checking for project config at: /home/qrilka/ws/h/xeno/stack.yaml 2018-12-02 00:43:35.760997: [debug] Loading project config file stack.yaml 2018-12-02 00:43:35.762196: [debug] Decoding build plan from: /home/qrilka/.stack/build-plan/lts-11.3.yaml 2018-12-02 00:43:35.762254: [debug] Trying to decode /home/qrilka/.stack/build-plan-cache/lts-11.3.cache 2018-12-02 00:43:35.766653: [debug] Success decoding /home/qrilka/.stack/build-plan-cache/lts-11.3.cache 2018-12-02 00:43:35.766760: [debug] PATH is: Just "/home/qrilka/bin:/home/qrilka/.local/bin:/home/qrilka/.npm-packages/bin:/home/qrilka/.cask/bin:/home/qrilka/.nix-profile/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/opt/bin/:/usr/games/bin:/home/qrilka/.cargo/bin" 2018-12-02 00:43:35.766827: [debug] Using a nix-shell environment with nix packages: haskell.compiler.ghc822, git, gcc, gmp 2018-12-02 00:43:35.766984: [debug] Run process: /home/qrilka/.nix-profile/bin/nix-shell --pure -E "with (import {}); let inputs = [haskell.compiler.ghc822 git gcc gmp]; libPath = lib.makeLibraryPath inputs; stackExtraArgs = lib.concatMap (pkg: [ ''--extra-lib-dirs=${lib.getLib pkg}/lib'' ''--extra-include-dirs=${lib.getDev pkg}/include'' ]) inputs; in runCommand ''myEnv'' { buildInputs = lib.optional stdenv.isLinux glibcLocales ++ inputs; STACK_PLATFORM_VARIANT=''nix''; STACK_IN_NIX_SHELL=1; LD_LIBRARY_PATH = libPath;STACK_IN_NIX_EXTRA_ARGS = stackExtraArgs; } \"\"" --run "'/home/qrilka/bin/stack-1.9.1' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=1.9.1' '--nix' '-v' 'repl'" Version 1.9.1, Git revision f9d0042c141660e1d38f797e1d426be4a99b2a3c (6168 commits) x86_64 hpack-0.31.0 2018-12-02 00:43:37.062476: [debug] Checking for project config at: /home/qrilka/ws/h/xeno/stack.yaml 2018-12-02 00:43:37.062665: [debug] Loading project config file stack.yaml 2018-12-02 00:43:37.064366: [debug] Decoding build plan from: /home/qrilka/.stack/build-plan/lts-11.3.yaml 2018-12-02 00:43:37.064432: [debug] Trying to decode /home/qrilka/.stack/build-plan-cache/lts-11.3.cache 2018-12-02 00:43:37.070047: [debug] Success decoding /home/qrilka/.stack/build-plan-cache/lts-11.3.cache 2018-12-02 00:43:37.070172: [debug] Getting system compiler version 2018-12-02 00:43:37.070329: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc --info 2018-12-02 00:43:37.112041: [debug] Process finished in 42ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc --info 2018-12-02 00:43:37.113365: [debug] Getting global package database location 2018-12-02 00:43:37.113507: [debug] Getting Cabal package version 2018-12-02 00:43:37.113612: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --no-user-package-db list --global 2018-12-02 00:43:37.114081: [debug] Asking GHC for its version 2018-12-02 00:43:37.114549: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version 2018-12-02 00:43:37.115015: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc --numeric-version 2018-12-02 00:43:37.132507: [debug] Process finished in 18ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --no-user-package-db field --simple-output Cabal version 2018-12-02 00:43:37.132703: [debug] Process finished in 19ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --no-user-package-db list --global 2018-12-02 00:43:37.146500: [debug] Process finished in 31ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc --numeric-version 2018-12-02 00:43:37.146625: [debug] GHC version is: ghc-8.2.2 2018-12-02 00:43:37.146705: [debug] Resolving package entries 2018-12-02 00:43:37.146812: [debug] Trying to decode /home/qrilka/.stack/loaded-snapshot-cache/x86_64-linux-nix/ghc-8.2.2/lts-11.3.cache 2018-12-02 00:43:37.185439: [debug] Success decoding /home/qrilka/.stack/loaded-snapshot-cache/x86_64-linux-nix/ghc-8.2.2/lts-11.3.cache 2018-12-02 00:43:37.185882: [debug] Starting to execute command inside EnvConfig 2018-12-02 00:43:37.185949: [debug] Parsing the targets 2018-12-02 00:43:37.190221: [debug] Trying to decode /home/qrilka/.stack/indices/Hackage/01-index.cache 2018-12-02 00:43:37.388659: [debug] Success decoding /home/qrilka/.stack/indices/Hackage/01-index.cache 2018-12-02 00:43:37.412014: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:43:37.414679: [debug] Finished in 3ms: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:43:37.414867: [debug] Exception ignored when attempting to load /home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/stack-build-caches/lib: /home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/stack-build-caches/lib: openBinaryFile: does not exist (No such file or directory) 2018-12-02 00:43:37.415960: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/hexml.cabal 2018-12-02 00:43:37.417503: [debug] Finished in 1ms: getPackageFiles /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/hexml.cabal 2018-12-02 00:43:37.417652: [debug] Exception ignored when attempting to load /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/stack-build-caches/lib: /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/stack-build-caches/lib: openBinaryFile: does not exist (No such file or directory) 2018-12-02 00:43:37.418418: [debug] Parsing the targets 2018-12-02 00:43:37.435984: [debug] Finding out which packages are already installed 2018-12-02 00:43:37.436204: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:43:37.465235: [debug] Process finished in 29ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:43:37.465401: [debug] Ignoring package haskeline due to wanting version 0.7.4.2 instead of 0.7.4.0 2018-12-02 00:43:37.465519: [debug] Ignoring package Cabal due to wanting version 2.0.1.1 instead of 2.0.1.0 2018-12-02 00:43:37.465761: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.497475: [debug] Process finished in 32ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.497848: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.515176: [debug] Process finished in 17ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.515609: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:43:37.518074: [debug] Finished in 2ms: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:43:37.518652: [debug] Parsing the targets 2018-12-02 00:43:37.534278: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:43:37.536710: [debug] Finished in 2ms: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:43:37.536868: [debug] Exception ignored when attempting to load /home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/stack-build-caches/lib: /home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/stack-build-caches/lib: openBinaryFile: does not exist (No such file or directory) 2018-12-02 00:43:37.537854: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/hexml.cabal 2018-12-02 00:43:37.539295: [debug] Finished in 1ms: getPackageFiles /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/hexml.cabal 2018-12-02 00:43:37.539482: [debug] Exception ignored when attempting to load /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/stack-build-caches/lib: /home/qrilka/ws/h/xeno/.stack-work/downloaded/EBMD9UsqNpAl/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/stack-build-caches/lib: openBinaryFile: does not exist (No such file or directory) 2018-12-02 00:43:37.540156: [debug] Finding out which packages are already installed 2018-12-02 00:43:37.540251: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:43:37.569368: [debug] Process finished in 29ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:43:37.569617: [debug] Ignoring package haskeline due to wanting version 0.7.4.2 instead of 0.7.4.0 2018-12-02 00:43:37.569740: [debug] Ignoring package Cabal due to wanting version 2.0.1.1 instead of 2.0.1.0 2018-12-02 00:43:37.569999: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.601565: [debug] Process finished in 31ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.601932: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.619323: [debug] Process finished in 17ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.619628: [debug] Constructing the build plan 2018-12-02 00:43:37.620276: [debug] Checking if we are going to build multiple executables with the same name 2018-12-02 00:43:37.620349: [debug] Executing the build plan 2018-12-02 00:43:37.620714: [debug] Getting global package database location 2018-12-02 00:43:37.620776: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --no-user-package-db list --global 2018-12-02 00:43:37.638075: [debug] Process finished in 17ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --no-user-package-db list --global 2018-12-02 00:43:37.638959: [info] xeno-0.3.4: initial-build-steps (lib) 2018-12-02 00:43:37.639147: [debug] Run process within /home/qrilka/ws/h/xeno/: /home/qrilka/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0 repl stack-initial-build-steps 2018-12-02 00:43:37.681788: [debug] Process finished in 43ms: /home/qrilka/.stack/setup-exe-cache/x86_64-linux-nix/Cabal-simple_mPHDZzAJ_2.0.1.0_ghc-8.2.2 --builddir=.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0 repl stack-initial-build-steps 2018-12-02 00:43:37.682047: [debug] Finding out which packages are already installed 2018-12-02 00:43:37.682164: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:43:37.710624: [debug] Process finished in 28ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --global --no-user-package-db dump --expand-pkgroot 2018-12-02 00:43:37.710792: [debug] Ignoring package haskeline due to wanting version 0.7.4.2 instead of 0.7.4.0 2018-12-02 00:43:37.710928: [debug] Ignoring package Cabal due to wanting version 2.0.1.1 instead of 2.0.1.0 2018-12-02 00:43:37.711188: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.743064: [debug] Process finished in 32ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/.stack/snapshots/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.743426: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.760491: [debug] Process finished in 17ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc-pkg --user --no-user-package-db --package-db /home/qrilka/ws/h/xeno/.stack-work/install/x86_64-linux-nix/lts-11.3/8.2.2/pkgdb dump --expand-pkgroot 2018-12-02 00:43:37.760776: [debug] Start: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:43:37.763138: [debug] Finished in 2ms: getPackageFiles /home/qrilka/ws/h/xeno/xeno.cabal 2018-12-02 00:43:37.763932: [warn] The following GHC options are incompatible with GHCi and have not been passed to it: -O2 2018-12-02 00:43:37.763995: [info] Configuring GHCi with the following packages: xeno 2018-12-02 00:43:37.764285: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc --version 2018-12-02 00:43:37.794427: [debug] Process finished in 30ms: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc --version 2018-12-02 00:43:37.794656: [debug] Run process: /nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/bin/ghc --interactive -i -odir=/home/qrilka/ws/h/xeno/.stack-work/odir -hidir=/home/qrilka/ws/h/xeno/.stack-work/odir -hide-all-packages -i/home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build -i/home/qrilka/ws/h/xeno/src -i/home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/autogen -i/home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build/global-autogen -stubdir=/home/qrilka/ws/h/xeno/.stack-work/dist/x86_64-linux-nix/Cabal-2.0.1.0/build -I/nix/store/10yq7kwlvbc6h658izmrlsspry1g9f3c-gcc-wrapper-7.3.0/include -I/nix/store/an7c3vyadgkq9h5a4xxzdz7xqf3lmyz6-gmp-6.1.2-dev/include -I/nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/include -I/nix/store/zma4ryc9awzsqgslnwxfczgl2b5xmc4v-git-2.19.1/include -L/nix/store/10yq7kwlvbc6h658izmrlsspry1g9f3c-gcc-wrapper-7.3.0/lib -L/nix/store/i4bnfpdjsgdpr0i74kr45825kcmy56yv-ghc-8.2.2/lib -L/nix/store/p0z7zza48ffzcb2riaq26745s02yipfb-gmp-6.1.2/lib -L/nix/store/zma4ryc9awzsqgslnwxfczgl2b5xmc4v-git-2.19.1/lib -package-id=base-4.10.1.0 -package-id=bytestring-0.10.8.2 -package-id=vector-0.12.0.1-JlawpRjIcMJIYPJVsWriIA -package-id=deepseq-1.4.3.0 -package-id=array-0.5.2.0 -package-id=mutable-containers-0.3.4-GWNoXux5XcyA1AQoF0whBX -package-id=mtl-2.2.2-8XubxMJDT8QLsstvlNotkc -package-id=hspec-2.4.8-8S5J29axVCKHbj3wvjgswz -Wall -optP-include -optP/home/qrilka/ws/h/xeno/.stack-work/ghci/23ac454b/cabal_macros.h -ghci-script=/tmp/haskell-stack-ghci/4bb87755/ghci-script GHCi, version 8.2.2: http://www.haskell.org/ghc/ :? for help ```

Giving 2.03s between the first and the last log lines

shell.nix is a trivial one:

{ pkgs ? import <nixpkgs> {} }:
with pkgs;
mkShell {
  buildInputs = [  haskell.compiler.ghc822 gmp ];
}

I guess we could check out if we could just write a nix file somewhere into .stack-work to make Nix integration a bit faster

domenkozar commented 9 months ago

I've switched to using devenv:

{ pkgs, ... }: 

{
  packages = [ 
    pkgs.stack 
  ];

  languages.haskell.enable = true;
  languages.haskell.package = pkgs.haskell.compiler.ghc963;

  pre-commit.hooks.ormolu.enable = true;
}

Which gives me the right HLS and ghc.

I need to do stack.yaml:

system-ghc: true
nix:
  enable: false

The only downside so far is that if the environment changes too much, stack is unable to detect that libraries should be linked with a new version (since it doesn't manage the Nix environment).