all repos — nixfiles @ 8fe9908fe7a4c6ea9d67984045b612e660afc20e

System and user configuration, managed by nix and home-manager

user/settings/development/golang.nix (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{ pkgs, ... }:
{
  home.packages = with pkgs; [
    go
    gopls
    gotools
    golines
    delve
    gomodifytags
    golangci-lint
    golangci-lint-langserver
  ];
  home.sessionPath = [
    "$HOME/go/bin"
  ];
  home.shellAliases = {
    gom = "go mod";
    gomt = "go mod tidy";
    gomd = "go mod download";
    gog = "go get";
    gogu = "go get -u";
  };
  home.sessionVariables.GOTOOLCHAIN = "local"; # use installed go tools
  programs.emacs.extraPackages =
    epkgs:
    (with epkgs; [
      go-eldoc
      go-tag
      templ-ts-mode
      (treesit-grammars.with-grammars (
        grammars: with grammars; [
          tree-sitter-go
          tree-sitter-gowork
          tree-sitter-gomod
          tree-sitter-templ
        ]
      ))
    ]);
  programs.nixvim.plugins.lsp.servers = {
    gopls.enable = true;
    golangci_lint_ls.enable = true;
  };
}