!QCCCSJHEsTIfozrZxz:nixos.org

Nix + Go

152 Members
Go packaging for and with Nixpkgs. | Be excellent to each other.41 Servers

Load older messages


SenderMessageTime
10 May 2024
@fractivore:cyberia.clubSYMYƧ wait.... It's actually building with encryption support in the VM without adding CGO_ENABLED=1; or gcc or anything. I'm confused, but I guess it's a quirk with my local system after all.
Even so, the program does use CGO, and it's not like adding that attribute breaks the build, so should I submit the PR anyway?
02:44:32
@diamondburned:matrix.orgDiamond (it/she)verify that your VM has the same nixpkgs input first02:54:01
@brumik1:matrix.org@brumik1:matrix.org joined the room.07:54:38
@cequal:matrix.orgCequal joined the room.12:26:08
11 May 2024
@brumik1:matrix.org@brumik1:matrix.org

Hello, bit new here (with nix too). I would like to ask if somebody could clarify for me how do I add a runtimeInput to a go package? I understand that this is not a Go issue as per-say, but rather more flakes/derivation problem.

I use gomod2nix with flake. All works good except that I have a cmd line tool that my go program needs to call. I would like my flake to specify this dependency just like writeShellApplication does. Maybe somebody could help me out or at least give some pointers?

08:03:58
@brumik1:matrix.org@brumik1:matrix.org *

Hello, bit new here (with nix too). I would like to ask if somebody could clarify for me how do I add a runtimeInput to a go package? I understand that this is not a Go issue as per-say, but rather more flakes/derivation problem.

I use gomod2nix with flake. All works good except that I have a cmd line tool that my go program needs to call. I would like my flake to specify this dependency just like writeShellApplication does. Maybe somebody could help me out or at least give some pointers?

Edit: the project: https://github.com/brumik/bw-setup-secrets/

08:05:22
@diamondburned:matrix.orgDiamond (it/she)
In reply to @brumik1:matrix.org

Hello, bit new here (with nix too). I would like to ask if somebody could clarify for me how do I add a runtimeInput to a go package? I understand that this is not a Go issue as per-say, but rather more flakes/derivation problem.

I use gomod2nix with flake. All works good except that I have a cmd line tool that my go program needs to call. I would like my flake to specify this dependency just like writeShellApplication does. Maybe somebody could help me out or at least give some pointers?

Edit: the project: https://github.com/brumik/bw-setup-secrets/

you want to add a hook that calls wrapProgram on your binary to wrap it around a shell script that appends the PATH variable appropriately
09:52:33
@diamondburned:matrix.orgDiamond (it/she)you may want to try using postInstall maybe 09:54:14
@brumik1:matrix.org@brumik1:matrix.org

Thank you for the answer!

PostInstall is part of mkDerivation right? Can I do there writeShellApplication? Some approximate example would help me greatly in my failing attempts

10:10:31
@diamondburned:matrix.orgDiamond (it/she) `nix
buildGoModule {
// ...
shellHook =
}
23:26:15
@diamondburned:matrix.orgDiamond (it/she)omg23:26:17
@diamondburned:matrix.orgDiamond (it/she)
buildGoModule {
    # ...

	nativeBuildInputs = with pkgs; [
		makeWrapper
	];

    shellHook = ''
		wrapProgram $out/bin/progname --set PATH ${lib.makeBinPath with pkgs; [
			# runtime packages go here
		]}
	'';
}
23:27:48
@diamondburned:matrix.orgDiamond (it/she)
buildGoModule {
  # ...

  nativeBuildInputs = with pkgs; [
    makeWrapper
  ];

  shellHook = ''
    wrapProgram $out/bin/progname --set PATH ${lib.makeBinPath with pkgs; [
      # runtime packages go here
    ]}
  '';
}
23:28:15
@reese:cyberia.club@reese:cyberia.club left the room.23:30:54
@dnrix:matrix.orgdnrI like to do this by having the go program run things by absolute path. You can set this up by taking the binary name from a global and then overriding it with linker flags23:45:28
@dnrix:matrix.orgdnre.g. https://github.com/dnr/nix-sandwich/blob/main/default.nix#L14-L2023:45:36
12 May 2024
@diamondburned:matrix.orgDiamond (it/she)woah00:02:50
@diamondburned:matrix.orgDiamond (it/she)why?00:02:50
@diamondburned:matrix.orgDiamond (it/she)this is a really cool project though00:03:34
@brumik1:matrix.org@brumik1:matrix.orgI might be mistaken here, but shellHook isnt supposed to be run when entering the shell instead when you build the package? 09:32:57
@brumik1:matrix.org@brumik1:matrix.orgI do agree the project is really cool dnr! 09:34:27
@brumik1:matrix.org@brumik1:matrix.org I ended up with using postFixup. I hope it is not antipattern 09:47:03
@dnrix:matrix.orgdnr
In reply to @diamondburned:matrix.org
why?
You mean why do it that way? It just seems cleaner to me than using a wrapper. There's just one binary and no script. The disadvantage I guess is that you can't override things by messing with PATH and calling the wrapped binary directly
19:05:41
@dnrix:matrix.orgdnrAnd thanks. I've actually been working on an even better version of that idea. I'm planning to announce it soon19:07:55
13 May 2024
@frederic:scs.ems.hostFrédéric Christ changed their display name from Frédéric Christ 🌴 29.04.-13.05. to Frédéric Christ.14:45:38
14 May 2024
@kaya:catnip.eekaya joined the room.07:25:31
@azahi:azahi.ccazahi joined the room.10:31:33
@kaya:catnip.eekaya changed their profile picture.10:49:24
15 May 2024
@raboof:matrix.orgraboof joined the room.12:00:55
@raboof:matrix.orgraboof hi! I'm trying to run guac. made a first stab at it in https://github.com/raboof/guac/commit/b4251b9719e98e2a8b689088d71304d36250019d , but building it gives me some errors like cannot find module providing package github.com/aws/aws-sdk-go-v2/aws/protocol/xml: import lookup disabled by -mod=vendor. Indeed they don't seem to be in the gomod2nix.toml generated by gomod2nix generate. Any ideas what could be the matter? 12:02:48

Show newer messages


Back to Room ListRoom Version: 9