overrideAttrs and GO query

I am struggling with overriding the version in a netbird derivation and get the error below.

I am not sure if my override is incorrect, or something else is going on with GO (a GO noob)

Anyone with more experience of either would be a great help, thanks.

  modifications = final: prev: {
    netbird = prev.netbird.overrideAttrs (_old: rec {
      pname = "netbird";
      version = "0.28.8";
      #vendorHash = lib.fakeSha256;
      vendorHash = "sha256-CqknRMijAkWRLXCcIjRBX2wB64+RivD/mXq28TqzNjg=";
      src = prev.fetchFromGitHub {
        owner = "netbirdio";
        repo = "netbird";
        rev = "v${version}";
        hash = "sha256-DfY8CVBHgE/kLALKNzSgmUxM0flWLesU0XAgVsHHLKc=";
      };
    });
   };

Error ;

error: builder for '/nix/store/cr17vi8ln8pxc54p4nh16r624siw7kq5-netbird-0.28.8.drv' failed with exit code 1;
       last 25 log lines:
       >         golang.org/x/tools@v0.21.1-0.20240508182429-e35e4ccd0d2d: is explicitly required in go.mod, but not marked as explicit in vendor/modules.txt
       >   fyne.io/fyne/v2@v2.1.4: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >     github.com/BurntSushi/toml@v1.3.2: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >  github.com/fredbi/uri@v0.0.0-20181227131451-3dcfdacbaaf3: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >   github.com/fsnotify/fsnotify@v1.6.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >        github.com/getlantern/context@v0.0.0-20190109183933-c447772a6520: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >   github.com/getlantern/errors@v0.0.0-20190325191628-abdb3e3e36f7: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >    github.com/getlantern/golog@v0.0.0-20190830074920-4ef2e798c2d7: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >     github.com/getlantern/hex@v0.0.0-20190417191902-c6586a6fe0b7: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >       github.com/getlantern/hidden@v0.0.0-20190325191715-f02dbb02be55: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >    github.com/getlantern/ops@v0.0.0-20190325191751-d70cb0d6f85f: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >       github.com/getlantern/systray@v1.2.1: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >       github.com/go-gl/gl@v0.0.0-20210813123233-e4099ee2221f: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >     github.com/go-gl/glfw/v3.3/glfw@v0.0.0-20211024062804-40e447a793be: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >         github.com/go-stack/stack@v1.8.0: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >   github.com/goki/freetype@v0.0.0-20181231101311-fa8a33aabaff: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >        github.com/oxtoacart/bpool@v0.0.0-20190530202638-03653db5a59c: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >      github.com/srwiley/oksvg@v0.0.0-20200311192757-870daf9aa564: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >        github.com/srwiley/rasterx@v0.0.0-20200120212402-85cb7272f5e9: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >      github.com/yuin/goldmark@v1.4.13: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >   golang.org/x/mobile@v0.0.0-20190719004257-d2bd2a29d028: is marked as explicit in vendor/modules.txt, but not explicitly required in go.mod
       >
       >    To ignore the vendor directory, use -mod=readonly or -mod=mod.
       >         To sync the vendor directory, run:
       >             go mod vendor
       For full logs, run 'nix log /nix/store/cr17vi8ln8pxc54p4nh16r624siw7kq5-netbird-0.28.8.drv'.
error: 1 dependencies of derivation '/nix/store/g9dyjihdvkcddpsyksiqbfh8nxpdm4li-man-paths.drv' failed to build
error: 1 dependencies of derivation '/nix/store/30jd4jmcj72rwc62y923cx7vm0z7iv0n-netbird-0.28.8_fish-completions.drv' failed to build

There was a PR to make overriding go modules easier, and was merged into staging 5 days ago: https://github.com/NixOS/nixpkgs/pull/225051. It may take 1~3 weeks to reach nixos-unstable. You can track its status here: Nixpkgs-tracker.

We may still have some measures to workaround it in the current codebase, though, but I haven’t learned any.

CC @shamrocklee

3 Likes