nix-community / gomod2nix

Convert applications using Go modules to Nix expressions [maintainer=]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pass tags to go build?

dko1905 opened this issue · 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?

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.

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"
  ];
};

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

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.

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.