nix-community / gomod2nix

Convert applications using Go modules to Nix expressions [maintainer=@adisbladis]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem: gomod2nix don't call correct version of golang

yihuang opened this issue · comments

The gomod2nix executable included in the overlay is a wrapper script that always uses the prepackaged go 1.17, which causes a problem in go 1.18 projects.

Hi folks, sorry for chiming in.

Had an issue where using shell.nix from the Getting Started document will always result in the following error:

error: go_1_12 has been removed

I also can't seem to "force" it to get Go 1.18 with the following snippet:

{ pkgs ? (
    let
      sources = import ./nix/sources.nix;
    in
    import sources.nixpkgs {
      overlays = [
        (import "${sources.gomod2nix}/overlay.nix")
      ];
    }
  )
}:

pkgs.mkShell {
  packages = [
    pkgs.go_1_18
    pkgs.gomod2nix
    pkgs.niv
  ];
}

Which spews the following error:

error: attribute 'go_1_18' missing
       stack trace...
       Did you mean one of go_1_12, go_1_14, go_1_15, go_1_16 or go_1_17?

On the other hand, changing to pkgs.go will result in the following error:

error: Package ‘ghc-8.10.4’ in /nix/store/hbf592lmpyigxr29563ywlc072kgxpzg-nixpkgs-src/pkgs/development/compilers/ghc/8.10.4.nix:263 is not supported on ‘aarch64-darwin’, refusing to evaluate.

Meanwhile, that issue should've been resolved a year ago, as I can run nix-env -iA nixpkgs.shellcheck just fine (it was the problem in that thread).

Was wondering if this is the same issue?

the haskell dependency is brought in by niv, suggest to use a version of nixpkgs that has binary cache.

attribute 'go_1_18' missing, sounds like nixpkgs too old, can try 22.05 release, or even master branch.