gomod2nix icon indicating copy to clipboard operation
gomod2nix copied to clipboard

Pass tags to go build?

Open dko1905 opened this issue 2 years ago • 4 comments

I've searched the previous issues for "build tags" and couldn't find anything. I have a project with go-sqlite3, and I require the 'sqlite_math_functions' tag. I usually add --tags sqlite_math_functions to go build, how do I do so using buildGoApplication in my nix flake?

dko1905 avatar Feb 22 '23 14:02 dko1905

Have you tried the tags attribute? [The documentation does not mention this attribute, but you can see how they're passed if you look at builder.nix.

peterldowns avatar Feb 24 '23 17:02 peterldowns

Confirmed, tags works as expected. Every string you include in the tags array will be passed to the go build command:

default = pkgs.buildGoApplication {
  checkPhase = false;
  pname = "demo";
  version = "0.0.1";
  src = ./.;
  modules = ./gomod2nix.toml;
  tags = [
    "sqlite_math_functions"
  ];
};

peterldowns avatar Feb 24 '23 17:02 peterldowns

Hi, thanks. Any reason it isn't in the documentation?

dko1905 avatar Feb 26 '23 17:02 dko1905

Unfortunately I don't know, I'm not a maintainer. My guess is it's an honest oversight and that you could probably submit a PR to fix it if you'd like.

peterldowns avatar Feb 27 '23 01:02 peterldowns

I know this is a year old issue, but I had the problem. Small PR to add the documentation you mentioned @peterldowns to help the next guy.

jtcarnes avatar Aug 04 '24 22:08 jtcarnes