commercialhaskell / commercialhaskell/stack

nix add-gc-roots does not work under nixos?

Open
#4,673 10 comments 0 reactions 0 assignees View on GitHub
component: build component: nix type: bug
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments

When I build by stack project under nixos, it re-downloads GHC every time I do garbage collection.

### Steps to reproduce

```
$ git clone git@github.com:turion/rhine.git
[...]
$ cd rhine/rhine
$ git checkout stack_nix_gc_roots_bug
[...]
$ cat stack.yaml
resolver: lts-12.26
nix:
enable: true
add-gc-roots: true

$ stack build
[...]
$ find . -name "*gc*"

$ nix-collect-garbage
finding garbage collector roots...
deleting garbage...
deleting '/nix/store/d9syi687jirk386a9hgr96yqhw6mx243-ghc-8.4.4'
deleting '/nix/store/s7p0wfbdfbq307zgifhnh6w8sfjvy64y-patchelf-0.9'
deleting '/nix/store/4r7rxlb5ingbcwr57aziswmyscpbgjj7-ghc-8.4.4-doc'
deleting '/nix/store/9z1b1ldrhxh7brsi6fxnyjm7gk8kiynv-bash-interactive-4.4-p23-dev'
deleting '/nix/store/c3kwd2jyv11ng84lrxgs3pfascl9bwr2-ghc-8.4.4-src.tar.xz.drv'
deleting '/nix/store/trash'
deleting unused links...
note: currently hard linking saves -0.00 MiB
5 store paths deleted, 1549.44 MiB freed

$ stack build
these paths will be fetched (114.69 MiB download, 1535.52 MiB unpacked):
/nix/store/4r7rxlb5ingbcwr57aziswmyscpbgjj7-ghc-8.4.4-doc
/nix/store/9z1b1ldrhxh7brsi6fxnyjm7gk8kiynv-bash-interactive-4.4-p23-dev
/nix/store/d9syi687jirk386a9hgr96yqhw6mx243-ghc-8.4.4
/nix/store/s7p0wfbdfbq307zgifhnh6w8sfjvy64y-patchelf-0.9
/nix/store/y83grpq99ssdd3n53q9zfid8slxrankg-stdenv-linux
copying path '/nix/store/9z1b1ldrhxh7brsi6fxnyjm7gk8kiynv-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/s7p0wfbdfbq307zgifhnh6w8sfjvy64y-patchelf-0.9' from 'https://cache.nixos.org'...
copying path '/nix/store/4r7rxlb5ingbcwr57aziswmyscpbgjj7-ghc-8.4.4-doc' from 'https://cache.nixos.org'...
copying path '/nix/store/y83grpq99ssdd3n53q9zfid8slxrankg-stdenv-linux' from 'https://cache.nixos.org'...
copying path '/nix/store/d9syi687jirk386a9hgr96yqhw6mx243-ghc-8.4.4' from 'https://cache.nixos.org'...
```

I use nixos-unstable.

```
$ stack --version
1.9.3 x86_64 hpack-0.31.2
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.