Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zsh: command not found: gomod2nix #100

Open
erikc96 opened this issue Dec 15, 2022 · 1 comment
Open

zsh: command not found: gomod2nix #100

erikc96 opened this issue Dec 15, 2022 · 1 comment

Comments

@erikc96
Copy link

erikc96 commented Dec 15, 2022

Quick question here, as I'm new to this tool and Nix.

I followed the instructions to set up the tool like this:

nix flake init -t github:tweag/gomod2nix#app
nix develop # (also tried nix shell)
nix build
go get github.com/mattn/go-sqlite3
gomod2nix

But even though I've opened the dev environment, it's not finding gomod2nix in my path.

Can anyone point me to a way of troubleshooting this?

Here's the output of nix flake metadata

Resolved URL:  git+file:///Users/erikc96/Projects/golang/nix
Locked URL:    git+file:///Users/erick96/Projects/golang/nix?ref=refs%2fheads%2fmain&rev=cb3bdd84986c85a2d0e52bd7e53efabafc57b967
Description:   A basic gomod2nix flake
Path:          /nix/store/q645qa21ynhxmfl949ymrpmbc9wzwi6l-source
Revision:      cb3bdd84986c85a2d0e52bd7e53efabafc57b967
Revisions:     1
Last modified: 2022-12-14 20:47:30
Inputs:
├───flake-utils: github:numtide/flake-utils/5aed5285a952e0b949eb3ba02c12fa4fcfef535f
├───gomod2nix: github:nix-community/gomod2nix/89cd0675b96775aa3ee86e7c0cf5bc238dd27976
│   ├───nixpkgs: github:NixOS/nixpkgs/5342fc6fb59d0595d26883c3cadff16ce58e44f3
│   └───utils: github:numtide/flake-utils/1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1
└───nixpkgs: github:NixOS/nixpkgs/1710ed1f6f8ceb75cf7d1cf55ee0cc21760e1c7a

Edit:

I have the same issue if I go the niv route.

@yangm97
Copy link

yangm97 commented Sep 14, 2023

Turns out pkgs.gomod2nix is being shadowed by inputs.gomod2nix, even if you use with pkgs;. I believe this is the issue the template is running into.

To workaround you need to either change the input name or be explicit and use pkgs.gomod2nix to build your devShell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants