go: fix GOROOT and GOPATH and add toolings

This commit is contained in:
Tigor Hutasuhut 2024-08-12 21:18:22 +07:00
parent 6ca0ea7b41
commit 186711342c

View file

@ -1,6 +1,17 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.profile.go; cfg = config.profile.go;
impl = pkgs.buildGoModule rec {
pname = "impl";
version = "1.4.0";
src = pkgs.fetchFromGitHub {
owner = "josharian";
repo = "impl";
rev = "v${version}";
sha256 = "sha256-0TSyg7YEPur+h0tkDxI3twr2PzT7tmo3shKgmSSJ6qk=";
};
vendorHash = "sha256-vTqDoM/LK5SHkayLKYig+tCrXLelOoILmQGCxlTWHog=";
};
in in
{ {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
@ -17,6 +28,15 @@ in
gomodifytags gomodifytags
gotests gotests
iferr iferr
gopls
gofumpt
impl
]; ];
# Some toolings will lookup for $GOROOT env.
home.sessionVariables = {
GOROOT = "${pkgs.go}/share/go";
GOPATH = "${config.home.homeDirectory}/go";
};
}; };
} }