Home > Back-end >  NIX - go: modules disabled by GO111MODULE=off;
NIX - go: modules disabled by GO111MODULE=off;

Time:02-02

I'm trying to download and build a project written in golang using nix

My nix file:

buildGoPackage {      
  name = "site";     
  goPackagePath = "[email protected]:username/rep.git";    
  src = fetchGit{      
       url = "[email protected]:username/rep.git";     
  }; 
}

run:

nix build -f test3.nix

error log:

last 8 log lines:        
 > unpacking sources       
 > unpacking source archive /nix/store/l1gsllgg693s46sk7b7qiwbnjysnbbz6-source        
 > source root is source        
 > patching sources        
 > configuring       
 > building        
 > Building subPackage [email protected]:user/rep.git        
 > go: modules disabled by GO111MODULE=off; see 'go help modules'

CodePudding user response:

I think you should be using buildGoModule instead of buildGoPackage, as buildGoPackage is deprecated, according to the nixpkgs documentation for go.

Additionally, buildGoModule doesn't seem to set GO111MODULE=off.

  • Related