Merge pull request #135041 from qowoz/go-buildflags

This commit is contained in:
Sandro 2021-08-21 20:40:18 +02:00 committed by GitHub
commit a7a97c9a97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 56 additions and 56 deletions

View file

@ -16,9 +16,9 @@ buildGoModule rec {
vendorSha256 = "sha256-XBfTVd3X3IDxLCAaNnijf6E5bw+AZ94UdOG9w7BOdBU="; vendorSha256 = "sha256-XBfTVd3X3IDxLCAaNnijf6E5bw+AZ94UdOG9w7BOdBU=";
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-s -w -X github.com/achannarasappa/ticker/cmd.Version=v${version}") "-s" "-w" "-X github.com/achannarasappa/ticker/cmd.Version=v${version}"
''; ];
# Tests require internet # Tests require internet
doCheck = false; doCheck = false;

View file

@ -17,10 +17,10 @@ buildGoModule rec {
excludedPackages = "\\(tools\\|docgen\\)"; excludedPackages = "\\(tools\\|docgen\\)";
preBuild = let t = "github.com/rancher/k3d/v4/version"; in ldflags = let t = "github.com/rancher/k3d/v4/version"; in
'' [
buildFlagsArray+=("-ldflags" "-s -w -X ${t}.Version=v${version} -X ${t}.K3sVersion=v${k3sVersion}") "-s" "-w" "-X ${t}.Version=v${version}" "-X ${t}.K3sVersion=v${k3sVersion}"
''; ];
doCheck = false; doCheck = false;

View file

@ -13,9 +13,9 @@ buildGoModule rec {
vendorSha256 = "sha256-EM0lPwwWJuLD+aqZWshz1ILaeEtUU4wJ0Puwv1Ikgf4="; vendorSha256 = "sha256-EM0lPwwWJuLD+aqZWshz1ILaeEtUU4wJ0Puwv1Ikgf4=";
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-s -w") "-s" "-w"
''; ];
meta = with lib; { meta = with lib; {
homepage = "https://github.com/aquasecurity/starboard-octant-plugin"; homepage = "https://github.com/aquasecurity/starboard-octant-plugin";

View file

@ -16,9 +16,9 @@ buildGoModule rec {
# Don't build and check the integration tests # Don't build and check the integration tests
excludedPackages = "itest"; excludedPackages = "itest";
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-s -w -X main.version=v${version}") "-s" "-w" "-X main.version=v${version}"
''; ];
preCheck = '' preCheck = ''
# Remove test that requires networking # Remove test that requires networking

View file

@ -9,9 +9,9 @@ buildGoModule rec {
doCheck = false; doCheck = false;
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-X main.version=${version}") "-X main.version=${version}"
''; ];
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "drone"; owner = "drone";

View file

@ -16,9 +16,9 @@ buildGoModule rec {
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ];
buildInputs = [ btrfs-progs lvm2 ]; buildInputs = [ btrfs-progs lvm2 ];
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-s -w -X main.version=${version}") "-s" "-w" "-X main.version=${version}"
''; ];
preCheck = '' preCheck = ''
# Remove tests that use networking # Remove tests that use networking

View file

@ -19,9 +19,9 @@ buildGoModule rec {
nativeBuildInputs = [ installShellFiles ]; nativeBuildInputs = [ installShellFiles ];
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags=-s -w -X main.version=${version} -X main.commit=v${version} -X main.date=19700101-00:00:00") "-s" "-w" "-X main.version=${version}" "-X main.commit=v${version}" "-X main.date=19700101-00:00:00"
''; ];
postInstall = '' postInstall = ''
for shell in bash zsh; do for shell in bash zsh; do

View file

@ -18,9 +18,9 @@ buildGoModule rec {
vendorSha256 = "sha256-J48ezMi9+PxohDKFhBpbcu6fdojlZPXnQQw2IcyimTA="; vendorSha256 = "sha256-J48ezMi9+PxohDKFhBpbcu6fdojlZPXnQQw2IcyimTA=";
proxyVendor = true; proxyVendor = true;
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags=-w -s -X main.version=${version}") "-w" "-s" "-X main.version=${version}"
''; ];
passthru.tests = { inherit (nixosTests) telegraf; }; passthru.tests = { inherit (nixosTests) telegraf; };

View file

@ -15,9 +15,9 @@ buildGoModule rec {
excludedPackages = "misc"; excludedPackages = "misc";
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-s -w -X main.version=v${version}") "-s" "-w" "-X main.version=v${version}"
''; ];
doInstallCheck = true; doInstallCheck = true;
installCheckPhase = '' installCheckPhase = ''

View file

@ -14,10 +14,10 @@ buildGoPackage rec {
sha256 = "1wdlblj127skgynf9amk7waabc3abbyxys9dvyc6c72zpcpdy5nc"; sha256 = "1wdlblj127skgynf9amk7waabc3abbyxys9dvyc6c72zpcpdy5nc";
}; };
preBuild = '' # TODO: is there a way to get the commit ref so we can set main.buildCommit?
# TODO: is there a way to get the commit ref so we can set main.buildCommit? ldflags = [
buildFlagsArray+=("-ldflags" "-X main.buildDate=1970-01-01T00:00:00+0000 -X main.buildVersion=${version}") "-X main.buildDate=1970-01-01T00:00:00+0000" "-X main.buildVersion=${version}"
''; ];
meta = { meta = {
description = "A go rewrite of envdir"; description = "A go rewrite of envdir";

View file

@ -14,9 +14,9 @@ buildGoModule rec {
vendorSha256 = "1lyqjkwj8hybj5swyrv6357hs8sxmf4wim0c8yhfb9mv7fsxhrv7"; vendorSha256 = "1lyqjkwj8hybj5swyrv6357hs8sxmf4wim0c8yhfb9mv7fsxhrv7";
CGO_ENABLED = 0; CGO_ENABLED = 0;
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-s -w -X main.version=v${version}") "-s" "-w" "-X main.version=v${version}"
''; ];
meta = with lib; { meta = with lib; {
homepage = "https://github.com/aelsabbahy/goss/"; homepage = "https://github.com/aelsabbahy/goss/";

View file

@ -16,9 +16,9 @@ buildGoPackage rec {
goPackagePath = "github.com/variadico/noti"; goPackagePath = "github.com/variadico/noti";
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-X ${goPackagePath}/internal/command.Version=${version}") "-X ${goPackagePath}/internal/command.Version=${version}"
''; ];
postInstall = '' postInstall = ''
install -Dm444 -t $out/share/man/man1 $src/docs/man/*.1 install -Dm444 -t $out/share/man/man1 $src/docs/man/*.1

View file

@ -20,9 +20,9 @@ buildGoModule rec {
doCheck = false; doCheck = false;
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-s -w -X moul.io/assh/v2/pkg/version.Version=${version}") "-s" "-w" "-X moul.io/assh/v2/pkg/version.Version=${version}"
''; ];
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ makeWrapper ];

View file

@ -16,9 +16,9 @@ buildGoModule rec {
vendorSha256 = "sha256-Cc4DJPpOMHxDcH22S7znYo7QHNRXv8jOJhznu09kaE4="; vendorSha256 = "sha256-Cc4DJPpOMHxDcH22S7znYo7QHNRXv8jOJhznu09kaE4=";
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-s -w -X github.com/zricethezav/gitleaks/v${lib.versions.major version}/version.Version=${version}") "-s" "-w" "-X github.com/zricethezav/gitleaks/v${lib.versions.major version}/version.Version=${version}"
''; ];
meta = with lib; { meta = with lib; {
description = "Scan git repos (or files) for secrets"; description = "Scan git repos (or files) for secrets";

View file

@ -19,9 +19,9 @@ buildGoModule rec {
propagatedBuildInputs = [ docker ]; propagatedBuildInputs = [ docker ];
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-s -w -X github.com/anchore/grype/internal/version.version=${version}") "-s" "-w" "-X github.com/anchore/grype/internal/version.version=${version}"
''; ];
# Tests require a running Docker instance # Tests require a running Docker instance
doCheck = false; doCheck = false;

View file

@ -16,9 +16,9 @@ buildGoModule rec {
vendorSha256 = "1nczzzsnh38qi949ki5268y39ggkwncanc1pv7727qpwllzl62vy"; vendorSha256 = "1nczzzsnh38qi949ki5268y39ggkwncanc1pv7727qpwllzl62vy";
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-s -w -X github.com/assetnote/kiterunner/cmd/kiterunner/cmd.Version=${version}") "-s" "-w" "-X github.com/assetnote/kiterunner/cmd/kiterunner/cmd.Version=${version}"
''; ];
subPackages = [ "./cmd/kiterunner" ]; subPackages = [ "./cmd/kiterunner" ];

View file

@ -18,9 +18,9 @@ buildGoPackage rec {
goPackagePath = "github.com/starkandwayne/safe"; goPackagePath = "github.com/starkandwayne/safe";
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-X main.Version=${version}") "-X main.Version=${version}"
''; ];
meta = with lib; { meta = with lib; {
description = "A Vault CLI"; description = "A Vault CLI";

View file

@ -16,9 +16,9 @@ buildGoModule rec {
vendorSha256 = "sha256-TQjwPem+RMuoF5T02CL/CTvBS6W7Q786gTvYUFIvxjE="; vendorSha256 = "sha256-TQjwPem+RMuoF5T02CL/CTvBS6W7Q786gTvYUFIvxjE=";
preBuild = '' ldflags = [
buildFlagsArray+=("-ldflags" "-s -w -X ktbs.dev/teler/common.Version=${version}") "-s" "-w" "-X ktbs.dev/teler/common.Version=${version}"
''; ];
# test require internet access # test require internet access
doCheck = false; doCheck = false;