commercialhaskell / commercialhaskell/stack
Performance overhead with nix integration
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
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
* Nixos's `stack` package
Contributor guide
Assessment
This issue has not been assessed yet.