srid / haskell-template

Haskell project template using Nix + Flakes + VSCode (HLS)
https://srid.ca/haskell-template
MIT License
227 stars 32 forks source link

error: flake haskell-template does not provide attribute 'devShells.x86_64-linux.devShell.x86_64-linux' ... #46

Closed Arsca closed 2 years ago

Arsca commented 2 years ago

Hi,

I'm getting this error when trying to enter nix develop or run the sanity check per instructions:

$ nixos-version
21.11.337526.8b3398bc758 (Porcupine)

$ git clone https://github.com/srid/haskell-template
Cloning into 'haskell-template'...
remote: Enumerating objects: 566, done.
remote: Counting objects: 100% (181/181), done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 566 (delta 147), reused 142 (delta 136), pack-reused 385
Receiving objects: 100% (566/566), 120.24 KiB | 578.00 KiB/s, done.
Resolving deltas: 100% (322/322), done.

$ cd haskell-template/

$ nix develop -i -c haskell-language-server
error: flake 'git+file:///tmp/haskell-template' does not provide attribute 'devShells.x86_64-linux.devShell.x86_64-linux', 'packages.x86_64-linux.devShell.x86_64-linux', 'legacyPackages.x86_64-linux.devShell.x86_64-linux', 'devShell.x86_64-linux' or 'defaultPackage.x86_64-linux'

$ nix develop
error: flake 'git+file:///tmp/haskell-template' does not provide attribute 'devShells.x86_64-linux.devShell.x86_64-linux', 'packages.x86_64-linux.devShell.x86_64-linux', 'legacyPackages.x86_64-linux.devShell.x86_64-linux', 'devShell.x86_64-linux' or 'defaultPackage.x86_64-linux'

$ nix run .
error: cannot find flake attribute 'git+file:///tmp/haskell-template#defaultApp.x86_64-linux'
srid commented 2 years ago

What's your Nix version? nix --version

Arsca commented 2 years ago

❯ nix --version nix (Nix) 2.4

srid commented 2 years ago

That's why; can you update your Nix to the latest released version and see if that resolves it?

Older Nix doesn't support devShells.default etc. style of output attributes.

srid commented 2 years ago

https://nixos.org/manual/nix/stable/release-notes/rl-2.7.html


srid commented 2 years ago

The README also says this (>= 2.8):

image
Arsca commented 2 years ago

Thanks for pinpointing the issue. Upgrading NIX per your instructions resolved it. Currently on NIX 2.10.3/NixOS 21.11