Open chrissound opened 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.
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:
nix
's evaluation faster (not a Stack problem)nix-shell -E
expression that's generated by the stack --nix
integration in a better way that makes the current nix
's evaluation faster somehow. I don't know if it is possible.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.
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:
With stack:
This is broader than ghci (see #4329)
Inviting @rikvdkleij from #4329
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:
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.
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.
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.
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
strace -fe execve
how the processes are started; do they have more parameters, or environment variables (strace
's -v -s3000
or similar is needed to show env vars)glibc
are slower than the host Linux's, perhaps things like memcpy
being slower can explain stack's own operations being slower (also check whether in fact different glibcs are in use)-v
to see what it's doingVolunteers needed!
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:
``` 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
```
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
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
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).
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:
Method of installation
stack
package