Merge pull request #133071 from qowoz/go-tags

This commit is contained in:
Sandro 2021-08-08 04:46:39 +02:00 committed by GitHub
commit 6d84ed4252
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 18 deletions

View file

@ -29,9 +29,7 @@ buildGoModule rec {
buildInputs = optional pamSupport pam; buildInputs = optional pamSupport pam;
buildFlags = [ "-tags" ]; tags =
buildFlagsArray =
( optional sqliteSupport "sqlite" ( optional sqliteSupport "sqlite"
++ optional pamSupport "pam"); ++ optional pamSupport "pam");

View file

@ -16,9 +16,7 @@ buildGoModule rec {
sha256 = "sha256-MKV5kor+Wm9cuIFFcjSNyCgVKtY+/B9sgBOXMMRvMPI="; sha256 = "sha256-MKV5kor+Wm9cuIFFcjSNyCgVKtY+/B9sgBOXMMRvMPI=";
}; };
preBuild = '' tags = lib.optionals (!enableUnfree) [ "oss" "nolimit" ];
buildFlagsArray+=( "-tags" "${lib.optionalString (!enableUnfree) "oss nolimit"}" )
'';
meta = with lib; { meta = with lib; {
maintainers = with maintainers; [ elohmeier vdemeester ]; maintainers = with maintainers; [ elohmeier vdemeester ];

View file

@ -47,21 +47,19 @@ buildGoModule rec {
ln -s ${webui} web/ui/static/react ln -s ${webui} web/ui/static/react
''; '';
buildFlags = "-tags=builtinassets"; tags = [ "builtinassets" ];
buildFlagsArray =
ldflags =
let let
t = "${goPackagePath}/vendor/github.com/prometheus/common/version"; t = "${goPackagePath}/vendor/github.com/prometheus/common/version";
in in
[ [
'' "-X ${t}.Version=${version}"
-ldflags= "-X ${t}.Revision=unknown"
-X ${t}.Version=${version} "-X ${t}.Branch=unknown"
-X ${t}.Revision=unknown "-X ${t}.BuildUser=nix@nixpkgs"
-X ${t}.Branch=unknown "-X ${t}.BuildDate=unknown"
-X ${t}.BuildUser=nix@nixpkgs "-X ${t}.GoVersion=${lib.getVersion go}"
-X ${t}.BuildDate=unknown
-X ${t}.GoVersion=${lib.getVersion go}
''
]; ];
# only run this in the real build, not during the vendor build # only run this in the real build, not during the vendor build

View file

@ -18,7 +18,7 @@ buildGoPackage rec {
nativeBuildInputs = optional withSystemdSupport makeWrapper; nativeBuildInputs = optional withSystemdSupport makeWrapper;
buildInputs = optional withSystemdSupport systemd; buildInputs = optional withSystemdSupport systemd;
buildFlags = optional (!withSystemdSupport) "-tags nosystemd"; tags = optional (!withSystemdSupport) "nosystemd";
goDeps = ./postfix-exporter-deps.nix; goDeps = ./postfix-exporter-deps.nix;
extraSrcs = optionals withSystemdSupport [ extraSrcs = optionals withSystemdSupport [