!QCCCSJHEsTIfozrZxz:nixos.org

Nix + Go

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

Load older messages


SenderMessageTime
10 Jul 2025
@diamondburned:matrix.orgDiamond (it/she)i've done it before20:48:41
@jrick:zettaport.comjrickpie without cgo doesn't really work. static pie is a thing, but go doesn't produce those20:50:31
@jrick:zettaport.comjrickwell it can, but i haven't tried to cross compile them20:50:58
@jrick:zettaport.comjrickerr, i have tried, and failed lol20:51:54
@nazarewk:matrix.orgkdn yeah, CGO_ENABLED=0 go build works fine on NixOS 20:52:15
@diamondburned:matrix.orgDiamond (it/she)yeah for the explicit purpose of cross-building i wouldn't bother with PIE20:55:57
@diamondburned:matrix.orgDiamond (it/she)or i guess just build a Nix OCI container instead20:56:14
@jrick:zettaport.comjrickthe issue with building static pie executables is that you need the target platform's ld.so and essentially embed it into the final binary20:57:05
@jrick:zettaport.comjrickit works if you have the file and can set the appropriate go flags to link with it20:57:45
@jrick:zettaport.comjrickbut makes cross compiling a nightmare20:57:49
@nazarewk:matrix.orgkdnI'd love to, but the team uses goreleaser to build for few-teen targets including different architectures, containers & operating systems20:58:28
@diamondburned:matrix.orgDiamond (it/she)hm ic21:00:36
@nazarewk:matrix.orgkdnI just wanted to adjust my local build to whatever they're running so I can make a proper entrypoint21:01:08
@diamondburned:matrix.orgDiamond (it/she)i mean in terms of building containers for usage, whether it's Nix-built or FROM alpine Dockerfile-built doesn't matter too much21:02:58
@diamondburned:matrix.orgDiamond (it/she)i mean the whole point of OCI containers is that it has that level of portability21:03:06
@diamondburned:matrix.orgDiamond (it/she)i was gonna say if this tool is just dragged into the container as a build step then you can definitely have it build an image and use that in Dockerfile i think?21:03:40
@diamondburned:matrix.orgDiamond (it/she)but idrk what you're doing21:03:47
@nazarewk:matrix.orgkdnI've no clue either how the whole thing is set up, my guess is that the binary artifact is somewhat carried over from previous steps in the CI/GoReleaser21:05:55
11 Jul 2025
@aerunakai:matrix.org@aerunakai:matrix.org removed their profile picture.16:40:26
@aerunakai:matrix.org@aerunakai:matrix.org removed their display name aerunakai.16:40:31
@aerunakai:matrix.org@aerunakai:matrix.org left the room.16:40:39
@elitewhale75:matrix.orgelitewhale75 joined the room.17:39:15
@elitewhale75:matrix.orgelitewhale75 changed their display name from Vignesh Guruswami to elitewhale75.17:39:46
@elitewhale75:matrix.orgelitewhale75 set a profile picture.17:39:56
12 Jul 2025
@plan9better:matrix.orgplan9better joined the room.11:06:12
@sleroq:sleroq.linksleroq left the room.14:02:56
19 Jul 2025
@xgwq:nerdberg.dexgwq joined the room.18:06:28
@xgwq:nerdberg.dexgwq

Hi, I currrently try to package a go package that fetches the version from Buildinfo like this

func GetVersion() (ret string) {
	if b, ok := debug.ReadBuildInfo(); ok && len(b.Main.Version) > 0 {
		ret = b.Main.Version
	} else {
		ret = "unknown"
	}
	return
}

Building that with nix gets (devel) as version, how can I set the version to the real package version?

18:12:15
@diamondburned:matrix.orgDiamond (it/she)you could look into fetchgit with preserving .git22:14:48
@diamondburned:matrix.orgDiamond (it/she)https://discourse.nixos.org/t/keep-git-folder-in-when-fetching-a-git-repo/859022:15:04

Show newer messages


Back to Room ListRoom Version: 9