!QCCCSJHEsTIfozrZxz:nixos.org

Nix + Go

229 Members
Go packaging for and with Nixpkgs. | Be excellent to each other.48 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
4 Jun 2025
@hedgemage:unredacted.org@hedgemage:unredacted.org joined the room.19:23:35
@awwpotato:envs.net@awwpotato:envs.net having some trouble in https://github.com/NixOS/nixpkgs/pull/414070, I'm trying to get the version command to work correctly but it's still not despite me adding the ldflags from the goreleaser 22:05:15
5 Jun 2025
@s_r:matrix.org@s_r:matrix.org

What workflow do you typically use to develop in a nix shell? I have some minor trouble with the dependencies:

If I just go in a dev shell (i.e. with nix develop) and run go build it will fail because it expects the dependencies in vendor.

  • I can run go mod vendor and then things work.
  • Or I can run runPhase configurePhase and get the vendor directory from nix, that also works.

The other minor issue is that I need to change the vendorHash every time I change a dependency, or I'd get a stale ~vendor~ directory and nix build fails (which took me a while to figure out, because I was doing go mod vendor to develop in my shell.

From this experience, it seems that running the configure phase is a better approach, but it contradicts a bit what me and @jrick discussed a few days ago, from which I understood (perhaps wrongly) that using go tools directly was preferred.

Curious about what other people are doing :)

04:46:00
@alisonjenkins:matrix.orgAlison JenkinsHas anyone got a decent solution to build go projects with private dependencies? 05:03:22
@diamondburned:matrix.orgdiamond (it/its) how are you making the devShell? if you use it directly via a package, that's gonna happen 05:55:30
@diamondburned:matrix.orgdiamond (it/its)when you're packaging, you won't really be able to avoid the vendorHash unless you actually automate it away05:55:51
@diamondburned:matrix.orgdiamond (it/its) it's not really because of go mod vendor (if anything, vendor actually frees you from needing to update that hash) 05:56:11
@diamondburned:matrix.orgdiamond (it/its) i asked this on the discourse 6 years ago! https://discourse.nixos.org/t/git-buildgomodule-private-repositories/5167 05:56:38

Show newer messages


Back to Room ListRoom Version: 9