Go: Difference between revisions

imported>Milahu
remove the outdated go2nix, replace with vgo2nix and gomod2nix
imported>Milahu
add note: go.mod file must be in the source root
Line 4: Line 4:
There are helper tools such as [https://github.com/nix-community/vgo2nix vgo2nix] and [https://github.com/tweag/gomod2nix gomod2nix], however the nixpkgs library function '''buildGoModule''' does an absolutely fantastic job in packaging standard go modules.
There are helper tools such as [https://github.com/nix-community/vgo2nix vgo2nix] and [https://github.com/tweag/gomod2nix gomod2nix], however the nixpkgs library function '''buildGoModule''' does an absolutely fantastic job in packaging standard go modules.
See [https://nixos.org/manual/nixpkgs/stable/#sec-language-go nixpkgs manual '''Language: Go''']
See [https://nixos.org/manual/nixpkgs/stable/#sec-language-go nixpkgs manual '''Language: Go''']
=== go.mod file ===
the <tt>go.mod</tt> file must be in the source root for <tt>buildGoModule</tt>.
to change the source root, use
<syntaxhighlight lang=nix>
  some-package = buildGoModule {
    src = fetchFromGitHub {
      # ...
    } + "/path/to/module";
    # ...
  };
</syntaxhighlight>


==Install using Home Manger==
==Install using Home Manger==