input-output-hk / haskell.nix

Alternative Haskell Infrastructure for Nixpkgs
https://input-output-hk.github.io/haskell.nix
Apache License 2.0
550 stars 237 forks source link

Flake template: references non-existent input `haskellNix/flake-utils` #2242

Closed JackKelly-Bellroy closed 1 week ago

JackKelly-Bellroy commented 3 weeks ago

Describe the bug

Now that haskell.nix no longer inputs flake-utils, the flake input should be imported directly and not through a .follows.

Steps To Reproduce


$ nix flake init --template templates#haskell-nix --impure
wrote: ...snip.../nix/hix.nix
wrote: ...snip.../nix
wrote: ...snip.../src/hello.hs
wrote: ...snip.../src
wrote: ...snip.../flake.nix
wrote: ...snip.../hello.cabal
wrote: ...snip.../Setup.hs
wrote: ...snip.../LICENSE

    You just created an haskell.nix template using hix. Read more about it here: https://input-output-hk.github.io/haskell.nix/tutorials/getting-started-flakes.html

$ nix flake show
error:
       … while updating the lock file of flake 'path:...snip...?lastModified=1724043911&narHash=sha256-BA8ZzBjxkRdv7dWGQDP4qrwAkvnTirh%2Bh8x350Se3pQ%3D'

       error: input 'flake-utils' follows a non-existent input 'haskellNix/flake-utils'
Steps for reproducing (try to minimise the size of the code base if possible).

Bonus points if it is in a PR to add a test case.

**Expected behavior**

The template should declare inputs that resolve correctly.

**Additional context**

Add any other context about the problem here.
pingiun commented 2 weeks ago

Just hit this when first trying to use this project using the flake template

lesserfish commented 1 week ago

Hello.

This was caused by this pull request, where the direct link to flake-utils was changed to follow the input of haskellNix (this repository). Unfortunately, this repository does not actually link to flake-utils anywhere.

There are two solutions to this:

  1. Revert the template back to using a direct link
  2. Update this repository to link to flake-utils.

I have submitted a pull request with fix (2) here: #2247

In the meantime, you can fix this by doing the following:

  1. As the tutorial, run

    nix flake init --template templates#haskell-nix
  2. Open the flake.nix file in any text editor. Locate the line

    inputs.flake-utils.follows = "haskellNix/flake-utils";

    and replace it with

    inputs.flake-utils.url = "github:numtide/flake-utils";

I believe this should fix the issue. Please let me know if this works for you!

hamishmack commented 1 week ago

Should be fixed by https://github.com/NixOS/templates/pull/86