From f42a0cddb4a597f76c8b6c0cfcc1f46b166177e6 Mon Sep 17 00:00:00 2001 From: adisbladis Date: Tue, 14 Jun 2022 18:58:51 +0800 Subject: [PATCH] buildGoApplication: add `tags` argument Simpler method of setting tags rather than using some combination of buildFlags, buildFlagsArray, preBuild, etc Using `lib.concatStringsSep ","` as space separated tags are deprecated in go. This is a port of https://github.com/NixOS/nixpkgs/commit/b60dde0c1eadd1e62a5e26adb4c4b6c4e03050d2 --- builder/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builder/default.nix b/builder/default.nix index ad38ed4..7300482 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -180,6 +180,7 @@ let , allowGoReference ? false , meta ? { } , passthru ? { } + , tags ? [ ] , ... }@attrs: let @@ -260,7 +261,7 @@ let echo "$d" | grep -q "\(/_\|examples\|Godeps\|testdata\)" && return 0 [ -n "$excludedPackages" ] && echo "$d" | grep -q "$excludedPackages" && return 0 local OUT - if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then + if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${tags:+-tags=${lib.concatStringsSep "," tags}} ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then if echo "$OUT" | grep -qE 'imports .*?: no Go files in'; then echo "$OUT" >&2 return 1