Describe the bug
I installed ghc and stack using NixOS 19.09. When I try to use stack, it looks for GHC 8.8.3. However, the version of ghc installed is 8.6.5.
To Reproduce
Steps to reproduce the behavior:
ghc and stack in packages list.nixos-rebuild switch --upgradestack new helloworld new-templateExpected behavior
A new project called "helloworld" should be created.
Screenshots
$ stack new helloworld new-template
error: attribute 'ghc883' missing, at (string):1:43
(use '--show-trace' to show detailed location information)
Additional context
Possibly related to #21470?
Metadata
$ nix-shell -p nix-info --run "nix-info -m"
these paths will be fetched (0.05 MiB download, 0.28 MiB unpacked):
/nix/store/5h35s50503spks8gkxdv3kk4szz8vx9g-bash-interactive-4.4-p23-dev
copying path '/nix/store/5h35s50503spks8gkxdv3kk4szz8vx9g-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...
- system: `"x86_64-linux"`
- host os: `Linux 4.19.114, NixOS, 19.09.2395.02f2241354a (Loris)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.3.3`
- channels(amy): `"nixpkgs-18.09.1676.7e88992a8c7"`
- channels(root): `"nixos-19.09.2395.02f2241354a"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
Maintainer information:
# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
The problem here is that the derivation for GHC-8.8.3 just hasn't been backported to 19.09.
GHC-8.8.3 is available on both 20.03 and unstable:
$ nix repl channel:nixos-20.03
nix-repl> haskell.compiler.ghc883
芦derivation /nix/store/2x4c3qxlc722yhjihw6jgdwl3nsn4q6z-ghc-8.8.3.drv禄
$ nix repl channel:nixos-unstable
nix-repl> haskell.compiler.ghc883
芦derivation /nix/store/00zjmk3xxv4a8gi3s4y2g74s9r1xy823-ghc-8.8.3.drv禄
Please feel free to open up a PR backporting ghc883 to the 19.09 release.
Your other option is to use an older stackage resolver that uses ghc882 or ghc865. I think LTS-15.1 or so uses ghc882 instead of ghc883. Also, LTS-14 uses ghc865.
Note: I've upgraded to 20.03 now, and deleted ~/.stack, but the bug persists.
$ stack new amy
Writing implicit global project config file to: /home/amy/.stack/global-project/stack.yaml
Note: You can change the snapshot via the resolver field there.
Using latest snapshot resolver: lts-15.8
error: attribute 'ghc883' missing, at (string):1:43
(use '--show-trace' to show detailed location information)
# nix-shell -p nix-info --run "nix-info -m"
- system: `"x86_64-linux"`
- host os: `Linux 4.19.114, NixOS, 20.03beta1301.708cb6b307b (Markhor)`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.3.4`
- channels(amy): `"nixpkgs-18.09.1676.7e88992a8c7"`
- channels(root): `"nixos-20.03beta1320.9f0f06ac8be"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
I don't think using a different stackage resolver could help this particular problem. This error occurs when creating a brand new project, before you create the yaml files that would specify which resolver to use. I believe it's looking for ghc883 to run Stack itself.
$ which stack
/run/current-system/sw/bin/stack
$ stack --version
2.1.3.1 x86_64 hpack-0.33.0
@mhwombat Hmm, I'm not able to reproduce this locally.
My guess is that your 20.03 checkout is just too old? Can you try running sudo nix-channel --update and trying again?
On my 19.09 system, stack can't find ghc883 and I get a similar error to you:
$ stack new amy --verbose --resolver lts-15.8
2.1.3.1 x86_64 hpack-0.32.0
2020-04-16 10:49:09.432728: [debug] No project config file found, using defaults.
2020-04-16 10:49:09.436541: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-04-15 01:49:09.436515796 UTC]
2020-04-16 10:49:09.436921: [debug] Using resolver: lts-15.8 specified on command line
2020-04-16 10:49:09.439162: [debug] Run from outside a project, using implicit global project config
2020-04-16 10:49:09.439493: [debug] Using package location completions from a lock file
2020-04-16 10:49:09.547812: [debug] PATH is: Just "/home/illabout/bin:/run/wrappers/bin:/home/illabout/.nix-profile/bin:/etc/profiles/per-user/illabout/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/illabout/docs/code/bin:/home/illabout/filesystem/vbox-start-vm/bin:/home/illabout/filesystem/vbox-vm-status/bin:/home/illabout/.local/bin"
2020-04-16 10:49:09.547881: [debug] Using a nix-shell environment with nix packages: haskell.compiler.ghc883, git, gcc, gmp
2020-04-16 10:49:09.548038: [debug] Run process: /run/current-system/sw/bin/nix-shell -E "with (import <nixpkgs> {}); let inputs = [haskell.compiler.ghc883 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; LANG=\"en_US.UTF-8\";} \"\"" --run "'/nix/store/6lzdpxshx78281vy056lbk553ijsdr44-stack-2.1.3.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=2.1.3.1' 'new' 'amy' '--verbose' '--resolver' 'lts-15.8'"
error: attribute 'ghc883' missing, at (string):1:43
However, if I explicitly use the latest 20.03 channel, it works:
$ stack --nix-path nixpkgs=channel:nixos-20.03 new amy --verbose --resolver lts-15.8
2.1.3.1 x86_64 hpack-0.32.0
2020-04-16 10:49:16.059878: [debug] No project config file found, using defaults.
2020-04-16 10:49:16.063517: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-04-15 01:49:16.063491859 UTC]
2020-04-16 10:49:16.066337: [debug] Using resolver: lts-15.8 specified on command line
2020-04-16 10:49:16.066388: [debug] Run from outside a project, using implicit global project config
2020-04-16 10:49:16.066731: [debug] Using package location completions from a lock file
2020-04-16 10:49:16.171368: [debug] PATH is: Just "/home/illabout/bin:/run/wrappers/bin:/home/illabout/.nix-profile/bin:/etc/profiles/per-user/illabout/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/home/illabout/docs/code/bin:/home/illabout/filesystem/vbox-start-vm/bin:/home/illabout/filesystem/vbox-vm-status/bin:/home/illabout/.local/bin"
2020-04-16 10:49:16.171436: [debug] Using a nix-shell environment with nix packages: haskell.compiler.ghc883, git, gcc, gmp
2020-04-16 10:49:16.171582: [debug] Run process: /run/current-system/sw/bin/nix-shell -I nixpkgs=channel:nixos-20.03 -E "with (import <nixpkgs> {}); let inputs = [haskell.compiler.ghc883 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; LANG=\"en_US.UTF-8\";} \"\"" --run "'/nix/store/6lzdpxshx78281vy056lbk553ijsdr44-stack-2.1.3.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=2.1.3.1' '--nix-path' 'nixpkgs=channel:nixos-20.03' 'new' 'amy' '--verbose' '--resolver' 'lts-15.8'"
unpacking 'https://nixos.org/channels/nixos-20.03/nixexprs.tar.xz'...
these paths will be fetched (235.18 MiB download, 2511.80 MiB unpacked):
/nix/store/0infa8sv151a1j6zz6lizbpmwv4ksh67-gcc-9.2.0-lib
/nix/store/0lz7rh46shm3cmd4ac8xxc4j1cav7rwa-db-4.8.30
/nix/store/0rbnlnd1pvlpii8p72ybvvg672j2wc2f-bash-interactive-4.4-p23-dev
...
copying path '/nix/store/hx63qkip16i4wifaqgxwrrmxj4az53h1-git-2.25.0' from 'https://cache.nixos.org'...
copying path '/nix/store/1v0410l20p343l6cvpijz8bi4if2ysh6-gcc-wrapper-9.2.0' from 'https://cache.nixos.org'...
copying path '/nix/store/j8nvpnyrprcffjd2hjm09dmv3842ndvp-ghc-8.8.3' from 'https://cache.nixos.org'...
2.1.3.1 x86_64 hpack-0.32.0
2020-04-16 10:52:41.887163: [debug] No project config file found, using defaults.
2020-04-16 10:52:41.894235: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-04-15 01:52:41.894208889 UTC]
2020-04-16 10:52:41.894853: [debug] Opening local template: "new-template.hsfiles"
2020-04-16 10:52:41.895008: [info] Downloading template "new-template" to create project "amy" in amy/ ...
2020-04-16 10:52:41.895048: [debug] Downloading /commercialhaskell/stack-templates/master/new-template.hsfiles
2020-04-16 10:52:42.637539: [debug] Opening local template: "/home/illabout/.stack/templates/new-template.hsfiles"
2020-04-16 10:52:42.644131: [info]
The following parameters were needed by the template but not provided: category
You can provide them in /home/illabout/.stack/config.yaml, like this:
templates:
params:
category: value
Or you can pass each one as parameters like this:
stack new amy new-template -p "category:value"
2020-04-16 10:52:42.647703: [info] Looking for .cabal or package.yaml files to use to init the project.
2020-04-16 10:52:42.648714: [info] Using cabal packages:
2020-04-16 10:52:42.648975: [info] - amy/
2020-04-16 10:52:42.649182: [debug] Running hpack on /home/illabout/temp/amy/package.yaml
2020-04-16 10:52:42.654990: [debug] hpack generated a modified version of /home/illabout/temp/amy/amy.cabal
2020-04-16 10:52:42.773742: [info] Could not find local global hints for ghc-8.8.3, forcing a redownload
2020-04-16 10:52:42.773838: [debug] Downloading /fpco/stackage-content/master/stack/global-hints.yaml
2020-04-16 10:52:43.159984: [info] Selected resolver: lts-15.8
2020-04-16 10:52:43.162304: [info] Initialising configuration using resolver: lts-15.8
2020-04-16 10:52:43.162409: [info] Total number of user packages considered: 1
2020-04-16 10:52:43.162469: [info] Writing configuration to file: amy/stack.yaml
2020-04-16 10:52:43.162959: [info] All done.
$ cd amy/
$ stack --nix-path nixpkgs=channel:nixos-20.03 build
Stack has not been tested with GHC versions above 8.6, and using 8.8.3, this may fail
Stack has not been tested with Cabal versions above 2.4, but version 3.0.1.0 was found, this may fail
[1 of 2] Compiling Main ( /home/illabout/.stack/setup-exe-src/setup-mPHDZzAJ.hs, /home/illabout/.stack/setup-exe-src/setup-mPHDZzAJ.o )
[2 of 2] Compiling StackSetupShim ( /home/illabout/.stack/setup-exe-src/setup-shim-mPHDZzAJ.hs, /home/illabout/.stack/setup-exe-src/setup-shim-mPHDZzAJ.o )
Linking /home/illabout/.stack/setup-exe-cache/x86_64-linux-nix/tmp-Cabal-simple_mPHDZzAJ_3.0.1.0_ghc-8.8.3 ...
Building all executables for `amy' once. After a successful build of all of them, only specified executables will be rebuilt.
amy> configure (lib + exe)
Configuring amy-0.1.0.0...
amy> build (lib + exe)
Preprocessing library for amy-0.1.0.0..
Building library for amy-0.1.0.0..
[1 of 2] Compiling Lib
[2 of 2] Compiling Paths_amy
Preprocessing executable 'amy-exe' for amy-0.1.0.0..
Building executable 'amy-exe' for amy-0.1.0.0..
[1 of 2] Compiling Main
[2 of 2] Compiling Paths_amy
Linking .stack-work/dist/x86_64-linux-nix/Cabal-3.0.1.0/build/amy-exe/amy-exe ...
amy> copy/register
Installing library in /home/illabout/temp/amy/.stack-work/install/x86_64-linux-nix/9a9a894d1b56ea1bb5f06427f64aa5825608a54b62989de56245cc86e933e9e8/8.8.3/lib/x86_64-linux-ghc-8.8.3/amy-0.1.0.0-IHQiHzGCnZ02eIMWqu1a4F
Installing executable amy-exe in /home/illabout/temp/amy/.stack-work/install/x86_64-linux-nix/9a9a894d1b56ea1bb5f06427f64aa5825608a54b62989de56245cc86e933e9e8/8.8.3/bin
Registering library for amy-0.1.0.0..
Also, make sure you pass stack the --verbose flag.
You'll get a log message about how exactly stack is trying to run nix-shell. This is really helpful in debugging what is going on.
For example, in one of my commands above, I got the following message:
Run process: /run/current-system/sw/bin/nix-shell -E "with (import <nixpkgs> {}); let inputs = [haskell.compiler.ghc883 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; LANG=\"en_US.UTF-8\";} \"\"" --run "'/nix/store/6lzdpxshx78281vy056lbk553ijsdr44-stack-2.1.3.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=2.1.3.1' 'new' 'amy' '--verbose' '--resolver' 'lts-15.8'"
You can see exactly what arguments stack is passing to nix-shell.
TL;DR: Adding --nix-path nixpkgs=channel:nixos-20.03 as suggested by @cdepillabout solves the problem. Thank you!
# nix-channel --update
unpacking channels...
created 1 symlinks in user environment
Without any extra command line attributes:
$ stack new amy --verbose
2.1.3.1 x86_64 hpack-0.33.0
2020-04-16 13:24:45.574877: [debug] No project config file found, using defaults.
2020-04-16 13:24:45.579140: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-04-15 12:24:45.579103957 UTC]
2020-04-16 13:24:45.579538: [debug] Run from outside a project, using implicit global project config
2020-04-16 13:24:45.579804: [debug] Using resolver: lts-15.8 from implicit global project's config file: /home/amy/.stack/global-project/stack.yaml
2020-04-16 13:24:45.579902: [debug] Using package location completions from a lock file
2020-04-16 13:24:45.696585: [debug] PATH is: Just "/home/amy/.conda/condabin:/home/amy/wain-tools:/home/amy/bin:/home/amy/.local/bin:/home/amy/.cabal/bin:/home/amy/bin:/run/wrappers/bin:/home/amy/.nix-profile/bin:/etc/profiles/per-user/amy/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
2020-04-16 13:24:45.696752: [debug] Using a nix-shell environment with nix packages: haskell.compiler.ghc883, git, gcc, gmp
2020-04-16 13:24:45.696951: [debug] Run process: /run/current-system/sw/bin/nix-shell --pure -E "with (import <nixpkgs> {}); let inputs = [haskell.compiler.ghc883 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; LANG=\"en_US.UTF-8\";} \"\"" --run "'/nix/store/h5v845ybgqiix516jsmq3dycpjm9gp2f-stack-2.1.3.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=2.1.3.1' 'new' 'amy' '--verbose'"
error: attribute 'ghc883' missing, at (string):1:43
(use '--show-trace' to show detailed location information)
With both the nix-path and resolver command line attributes:
$ stack --nix-path nixpkgs=channel:nixos-20.03 new amy --verbose --resolver lts-15.8
2.1.3.1 x86_64 hpack-0.33.0
2020-04-16 13:25:28.097708: [debug] No project config file found, using defaults.
2020-04-16 13:25:28.101618: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-04-15 12:25:28.101581954 UTC]
2020-04-16 13:25:28.102243: [debug] Using resolver: lts-15.8 specified on command line
2020-04-16 13:25:28.102302: [debug] Run from outside a project, using implicit global project config
2020-04-16 13:25:28.102566: [debug] Using package location completions from a lock file
2020-04-16 13:25:28.216099: [debug] PATH is: Just "/home/amy/.conda/condabin:/home/amy/wain-tools:/home/amy/bin:/home/amy/.local/bin:/home/amy/.cabal/bin:/home/amy/bin:/run/wrappers/bin:/home/amy/.nix-profile/bin:/etc/profiles/per-user/amy/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
2020-04-16 13:25:28.216165: [debug] Using a nix-shell environment with nix packages: haskell.compiler.ghc883, git, gcc, gmp
2020-04-16 13:25:28.216336: [debug] Run process: /run/current-system/sw/bin/nix-shell --pure -I nixpkgs=channel:nixos-20.03 -E "with (import <nixpkgs> {}); let inputs = [haskell.compiler.ghc883 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; LANG=\"en_US.UTF-8\";} \"\"" --run "'/nix/store/h5v845ybgqiix516jsmq3dycpjm9gp2f-stack-2.1.3.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=2.1.3.1' '--nix-path' 'nixpkgs=channel:nixos-20.03' 'new' 'amy' '--verbose' '--resolver' 'lts-15.8'"
unpacking 'https://nixos.org/channels/nixos-20.03/nixexprs.tar.xz'...
these paths will be fetched (134.39 MiB download, 1864.41 MiB unpacked):
/nix/store/0rbnlnd1pvlpii8p72ybvvg672j2wc2f-bash-interactive-4.4-p23-dev
/nix/store/16m4ybbdjpvcw4dawfid0xnnqgkpqss8-ghc-8.8.3-doc
/nix/store/7azp14fh9dy5jfbhl5c2fk1gd1hkd7ja-patchelf-0.9
/nix/store/gsij8yk5rw93q6fmpj4bgc4b750hj5z9-stdenv-linux
/nix/store/j8nvpnyrprcffjd2hjm09dmv3842ndvp-ghc-8.8.3
copying path '/nix/store/0rbnlnd1pvlpii8p72ybvvg672j2wc2f-bash-interactive-4.4-p23-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/16m4ybbdjpvcw4dawfid0xnnqgkpqss8-ghc-8.8.3-doc' from 'https://cache.nixos.org'...
copying path '/nix/store/7azp14fh9dy5jfbhl5c2fk1gd1hkd7ja-patchelf-0.9' from 'https://cache.nixos.org'...
copying path '/nix/store/gsij8yk5rw93q6fmpj4bgc4b750hj5z9-stdenv-linux' from 'https://cache.nixos.org'...
copying path '/nix/store/j8nvpnyrprcffjd2hjm09dmv3842ndvp-ghc-8.8.3' from 'https://cache.nixos.org'...
2.1.3.1 x86_64 hpack-0.33.0
2020-04-16 13:27:19.987071: [debug] No project config file found, using defaults.
2020-04-16 13:27:19.990658: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-04-15 12:27:19.990629116 UTC]
2020-04-16 13:27:19.991071: [debug] Opening local template: "new-template.hsfiles"
2020-04-16 13:27:19.991178: [info] Downloading template "new-template" to create project "amy" in amy/ ...
2020-04-16 13:27:19.991225: [debug] Downloading /commercialhaskell/stack-templates/master/new-template.hsfiles
2020-04-16 13:27:20.322156: [debug] Opening local template: "/home/amy/.stack/templates/new-template.hsfiles"
2020-04-16 13:27:20.324995: [info]
The following parameters were needed by the template but not provided: author-name
You can provide them in /home/amy/.stack/config.yaml, like this:
templates:
params:
author-name: value
Or you can pass each one as parameters like this:
stack new amy new-template -p "author-name:value"
2020-04-16 13:27:20.327039: [info]
The following parameters were needed by the template but not provided: author-email, author-name, category, copyright, github-username
You can provide them in /home/amy/.stack/config.yaml, like this:
templates:
params:
author-email: value
author-name: value
category: value
copyright: value
github-username: value
Or you can pass each one as parameters like this:
stack new amy new-template -p "author-email:value" -p "author-name:value" -p "category:value" -p "copyright:value" -p "github-username:value"
2020-04-16 13:27:20.329610: [info] Looking for .cabal or package.yaml files to use to init the project.
2020-04-16 13:27:20.330453: [info] Using cabal packages:
2020-04-16 13:27:20.330562: [info] - amy/
2020-04-16 13:27:20.330684: [debug] Running hpack on /home/amy/dev-using-stack/amy/package.yaml
2020-04-16 13:27:20.339691: [debug] hpack generated a modified version of /home/amy/dev-using-stack/amy/amy.cabal
2020-04-16 13:27:20.456613: [debug] Downloading /fpco/stackage-content/master/stack/global-hints.yaml
2020-04-16 13:27:20.659653: [info] Selected resolver: lts-15.8
2020-04-16 13:27:20.661416: [info] Initialising configuration using resolver: lts-15.8
2020-04-16 13:27:20.661484: [info] Total number of user packages considered: 1
2020-04-16 13:27:20.661526: [info] Writing configuration to file: amy/stack.yaml
2020-04-16 13:27:20.661894: [info] All done.
With just the nix-path attribute:
$ rm -rf amy
$ stack --nix-path nixpkgs=channel:nixos-20.03 new amy --verbose
2.1.3.1 x86_64 hpack-0.33.0
2020-04-16 13:32:42.385136: [debug] No project config file found, using defaults.
2020-04-16 13:32:42.389245: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-04-15 12:32:42.389210078 UTC]
2020-04-16 13:32:42.389636: [debug] Run from outside a project, using implicit global project config
2020-04-16 13:32:42.389896: [debug] Using resolver: lts-15.8 from implicit global project's config file: /home/amy/.stack/global-project/stack.yaml
2020-04-16 13:32:42.390142: [debug] Using package location completions from a lock file
2020-04-16 13:32:42.506719: [debug] PATH is: Just "/home/amy/.conda/condabin:/home/amy/wain-tools:/home/amy/bin:/home/amy/.local/bin:/home/amy/.cabal/bin:/home/amy/bin:/run/wrappers/bin:/home/amy/.nix-profile/bin:/etc/profiles/per-user/amy/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
2020-04-16 13:32:42.506807: [debug] Using a nix-shell environment with nix packages: haskell.compiler.ghc883, git, gcc, gmp
2020-04-16 13:32:42.506971: [debug] Run process: /run/current-system/sw/bin/nix-shell --pure -I nixpkgs=channel:nixos-20.03 -E "with (import <nixpkgs> {}); let inputs = [haskell.compiler.ghc883 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; LANG=\"en_US.UTF-8\";} \"\"" --run "'/nix/store/h5v845ybgqiix516jsmq3dycpjm9gp2f-stack-2.1.3.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=2.1.3.1' '--nix-path' 'nixpkgs=channel:nixos-20.03' 'new' 'amy' '--verbose'"
2.1.3.1 x86_64 hpack-0.33.0
2020-04-16 13:32:43.511006: [debug] No project config file found, using defaults.
2020-04-16 13:32:43.514271: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-04-15 12:32:43.514238334 UTC]
2020-04-16 13:32:43.514644: [debug] Opening local template: "new-template.hsfiles"
2020-04-16 13:32:43.514749: [info] Downloading template "new-template" to create project "amy" in amy/ ...
2020-04-16 13:32:43.514793: [debug] Downloading /commercialhaskell/stack-templates/master/new-template.hsfiles
2020-04-16 13:32:43.852056: [debug] Opening local template: "/home/amy/.stack/templates/new-template.hsfiles"
2020-04-16 13:32:43.854679: [info]
The following parameters were needed by the template but not provided: author-name
You can provide them in /home/amy/.stack/config.yaml, like this:
templates:
params:
author-name: value
Or you can pass each one as parameters like this:
stack new amy new-template -p "author-name:value"
2020-04-16 13:32:43.856757: [info]
The following parameters were needed by the template but not provided: author-email, author-name, category, copyright, github-username
You can provide them in /home/amy/.stack/config.yaml, like this:
templates:
params:
author-email: value
author-name: value
category: value
copyright: value
github-username: value
Or you can pass each one as parameters like this:
stack new amy new-template -p "author-email:value" -p "author-name:value" -p "category:value" -p "copyright:value" -p "github-username:value"
2020-04-16 13:32:43.859347: [info] Looking for .cabal or package.yaml files to use to init the project.
2020-04-16 13:32:43.860130: [info] Using cabal packages:
2020-04-16 13:32:43.860238: [info] - amy/
2020-04-16 13:32:43.860383: [debug] Running hpack on /home/amy/dev-using-stack/amy/package.yaml
2020-04-16 13:32:43.864232: [debug] hpack generated a modified version of /home/amy/dev-using-stack/amy/amy.cabal
2020-04-16 13:32:43.871637: [debug] Downloading snapshot versions file from https://s3.amazonaws.com/haddock.stackage.org/snapshots.json
2020-04-16 13:32:44.376088: [debug] Done downloading and parsing snapshot versions file
2020-04-16 13:32:44.376246: [info] Selecting the best among 17 snapshots...
2020-04-16 13:32:44.509933: [info] * Matches lts-15.8
2020-04-16 13:32:44.510027: [info]
2020-04-16 13:32:44.510071: [info] Selected resolver: lts-15.8
2020-04-16 13:32:44.510210: [info] Initialising configuration using resolver: lts-15.8
2020-04-16 13:32:44.510257: [info] Total number of user packages considered: 1
2020-04-16 13:32:44.510295: [info] Writing configuration to file: amy/stack.yaml
2020-04-16 13:32:44.510619: [info] All done.
With just the resolver attribute:
$ rm -rf amy
$ stack new amy --verbose --resolver lts-15.8
2.1.3.1 x86_64 hpack-0.33.0
2020-04-16 13:33:45.178485: [debug] No project config file found, using defaults.
2020-04-16 13:33:45.182333: [debug] SELECT COUNT(*) FROM "last_performed" WHERE ("action"=?) AND ("timestamp">=?); [PersistInt64 1,PersistUTCTime 2020-04-15 12:33:45.182296127 UTC]
2020-04-16 13:33:45.182907: [debug] Using resolver: lts-15.8 specified on command line
2020-04-16 13:33:45.182974: [debug] Run from outside a project, using implicit global project config
2020-04-16 13:33:45.183248: [debug] Using package location completions from a lock file
2020-04-16 13:33:45.299865: [debug] PATH is: Just "/home/amy/.conda/condabin:/home/amy/wain-tools:/home/amy/bin:/home/amy/.local/bin:/home/amy/.cabal/bin:/home/amy/bin:/run/wrappers/bin:/home/amy/.nix-profile/bin:/etc/profiles/per-user/amy/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin"
2020-04-16 13:33:45.299934: [debug] Using a nix-shell environment with nix packages: haskell.compiler.ghc883, git, gcc, gmp
2020-04-16 13:33:45.300097: [debug] Run process: /run/current-system/sw/bin/nix-shell --pure -E "with (import <nixpkgs> {}); let inputs = [haskell.compiler.ghc883 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; LANG=\"en_US.UTF-8\";} \"\"" --run "'/nix/store/h5v845ybgqiix516jsmq3dycpjm9gp2f-stack-2.1.3.1/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=2.1.3.1' 'new' 'amy' '--verbose' '--resolver' 'lts-15.8'"
error: attribute 'ghc883' missing, at (string):1:43
(use '--show-trace' to show detailed location information)
is there any way to fix this without having to switch to nixos 20?
is there any way to fix this without having to switch to nixos 20?
Yes, you can use @mpickering's NUR repository that contains all GHC versions.
Setup NUR as described on https://github.com/nix-community/NUR.
Then put the following into a shell.nix file next to your stack.yaml (replace GHC version as indicated in the comment):
with (import <nixpkgs> {});
let
# Needs NUR from https://github.com/nix-community/NUR
ghc = nur.repos.mpickering.ghc.ghc863; # Keep in sync with the GHC version defined by stack.yaml!
in
haskell.lib.buildStackProject {
inherit ghc;
name = "myEnv";
# Put compile-time system depenencies of your project in here:
nativeBuildInputs = [ ];
# Put run-time system depenencies of your project in here:
buildInputs = [ ];
}
@mhwombat
is there any way to fix this without having to switch to nixos 20?
@nh2's suggestion is what most people do. Use a shell.nix file for stack. There are directions in the Stack documentation about how to do this.
The other solution is just to open a PR backporting ghc883 to the to 19.09 branch. This would help the most people in the Nix community.
If you're not sure how to do this, the easiest thing would be to look for a PR adding ghc883 to the master branch, and then do that same thing but to the release-19.09 branch.
If you send this PR, I'll merge it in.
@cdepillabout @nh2 thanks for the suggestions
So, it's my first time using stack so I just wanted to create a project with stack new, so I don't have any version declared in my config.
I have acces to NUR and I'll try adding the needed ghcs from there to my overlay, but I don't really get how stack can't find version 8.8.3 when I have 8.8.3 as my global ghc version (installed from the unstable channel)
I will look into opening a PR
@cdepillabout
So would opening a copy of this: https://github.com/NixOS/nixpkgs/pull/80975 into the 19.09 branch do the job?
@Mateiadrielrafael Yes, that should hopefully work!
I believe the issue has been resolved insofar as that we know what's causing it and how it can be fixed. My understanding is that @Mateiadrielrafael will submit an appropriate PR. Until then, I'll close this bug.