From 950b52dec0e9d7066d14a7842e2cfd308677141c Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:47 +1000 Subject: [PATCH 01/18] ticker: buildFlagsArray -> ldflags --- pkgs/applications/misc/ticker/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/misc/ticker/default.nix b/pkgs/applications/misc/ticker/default.nix index a3e2dc11c6f7..8e70a70423b9 100644 --- a/pkgs/applications/misc/ticker/default.nix +++ b/pkgs/applications/misc/ticker/default.nix @@ -16,9 +16,9 @@ buildGoModule rec { vendorSha256 = "sha256-XBfTVd3X3IDxLCAaNnijf6E5bw+AZ94UdOG9w7BOdBU="; - preBuild = '' - buildFlagsArray+=("-ldflags" "-s -w -X github.com/achannarasappa/ticker/cmd.Version=v${version}") - ''; + ldflags = [ + "-s" "-w" "-X github.com/achannarasappa/ticker/cmd.Version=v${version}" + ]; # Tests require internet doCheck = false; From ae31e8b1997662919847f9012cb8d54538b91743 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:47 +1000 Subject: [PATCH 02/18] kube3d: buildFlagsArray -> ldflags --- pkgs/applications/networking/cluster/kube3d/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/applications/networking/cluster/kube3d/default.nix b/pkgs/applications/networking/cluster/kube3d/default.nix index e565657a5cbd..3652405194f5 100644 --- a/pkgs/applications/networking/cluster/kube3d/default.nix +++ b/pkgs/applications/networking/cluster/kube3d/default.nix @@ -17,10 +17,10 @@ buildGoModule rec { excludedPackages = "\\(tools\\|docgen\\)"; - preBuild = let t = "github.com/rancher/k3d/v4/version"; in - '' - buildFlagsArray+=("-ldflags" "-s -w -X ${t}.Version=v${version} -X ${t}.K3sVersion=v${k3sVersion}") - ''; + ldflags = let t = "github.com/rancher/k3d/v4/version"; in + [ + "-s" "-w" "-X ${t}.Version=v${version}" "-X ${t}.K3sVersion=v${k3sVersion}" + ]; doCheck = false; From 6042373b60168a57dca4a5435df2087e73bbbf58 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:47 +1000 Subject: [PATCH 03/18] starboard-octant-plugin: buildFlagsArray -> ldflags --- .../cluster/octant/plugins/starboard-octant-plugin.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/cluster/octant/plugins/starboard-octant-plugin.nix b/pkgs/applications/networking/cluster/octant/plugins/starboard-octant-plugin.nix index 7dc1a3c7d9cf..9679f5bd2e03 100644 --- a/pkgs/applications/networking/cluster/octant/plugins/starboard-octant-plugin.nix +++ b/pkgs/applications/networking/cluster/octant/plugins/starboard-octant-plugin.nix @@ -13,9 +13,9 @@ buildGoModule rec { vendorSha256 = "sha256-EM0lPwwWJuLD+aqZWshz1ILaeEtUU4wJ0Puwv1Ikgf4="; - preBuild = '' - buildFlagsArray+=("-ldflags" "-s -w") - ''; + ldflags = [ + "-s" "-w" + ]; meta = with lib; { homepage = "https://github.com/aquasecurity/starboard-octant-plugin"; From e69c632fce9f6c5c10e1fcb4f1545b6fad9b31a6 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:47 +1000 Subject: [PATCH 04/18] starboard: buildFlagsArray -> ldflags --- pkgs/applications/networking/cluster/starboard/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/applications/networking/cluster/starboard/default.nix b/pkgs/applications/networking/cluster/starboard/default.nix index d92518c0b4cc..066b70e8e254 100644 --- a/pkgs/applications/networking/cluster/starboard/default.nix +++ b/pkgs/applications/networking/cluster/starboard/default.nix @@ -16,9 +16,9 @@ buildGoModule rec { # Don't build and check the integration tests excludedPackages = "itest"; - preBuild = '' - buildFlagsArray+=("-ldflags" "-s -w -X main.version=v${version}") - ''; + ldflags = [ + "-s" "-w" "-X main.version=v${version}" + ]; preCheck = '' # Remove test that requires networking From 380ddb56e51a0442b9ed8bc63f4b11d9cd3a061a Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:48 +1000 Subject: [PATCH 05/18] drone-cli: buildFlagsArray -> ldflags --- .../tools/continuous-integration/drone-cli/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/continuous-integration/drone-cli/default.nix b/pkgs/development/tools/continuous-integration/drone-cli/default.nix index 4534298d395e..21dbbcf0b72c 100644 --- a/pkgs/development/tools/continuous-integration/drone-cli/default.nix +++ b/pkgs/development/tools/continuous-integration/drone-cli/default.nix @@ -9,9 +9,9 @@ buildGoModule rec { doCheck = false; - preBuild = '' - buildFlagsArray+=("-ldflags" "-X main.version=${version}") - ''; + ldflags = [ + "-X main.version=${version}" + ]; src = fetchFromGitHub { owner = "drone"; From 69c7777320a584e119e613064e0396bddc242102 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:48 +1000 Subject: [PATCH 06/18] dockle: buildFlagsArray -> ldflags --- pkgs/development/tools/dockle/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/dockle/default.nix b/pkgs/development/tools/dockle/default.nix index 437f7f2da581..084f5eea21d3 100644 --- a/pkgs/development/tools/dockle/default.nix +++ b/pkgs/development/tools/dockle/default.nix @@ -16,9 +16,9 @@ buildGoModule rec { nativeBuildInputs = [ pkg-config ]; buildInputs = [ btrfs-progs lvm2 ]; - preBuild = '' - buildFlagsArray+=("-ldflags" "-s -w -X main.version=${version}") - ''; + ldflags = [ + "-s" "-w" "-X main.version=${version}" + ]; preCheck = '' # Remove tests that use networking From b42bac858d7feed1005cddfc328d202b87e2e72c Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:48 +1000 Subject: [PATCH 07/18] golangci-lint: buildFlagsArray -> ldflags --- pkgs/development/tools/golangci-lint/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/development/tools/golangci-lint/default.nix b/pkgs/development/tools/golangci-lint/default.nix index 4e7711926eac..3512c1bf087c 100644 --- a/pkgs/development/tools/golangci-lint/default.nix +++ b/pkgs/development/tools/golangci-lint/default.nix @@ -19,9 +19,9 @@ buildGoModule rec { nativeBuildInputs = [ installShellFiles ]; - preBuild = '' - buildFlagsArray+=("-ldflags=-s -w -X main.version=${version} -X main.commit=v${version} -X main.date=19700101-00:00:00") - ''; + ldflags = [ + "-s" "-w" "-X main.version=${version}" "-X main.commit=v${version}" "-X main.date=19700101-00:00:00" + ]; postInstall = '' for shell in bash zsh; do From 6c6db4237877af469d4a2b357d2bb1b84130094e Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:48 +1000 Subject: [PATCH 08/18] telegraf: buildFlagsArray -> ldflags --- pkgs/servers/monitoring/telegraf/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/monitoring/telegraf/default.nix b/pkgs/servers/monitoring/telegraf/default.nix index 27563a05104e..d92219ea71d8 100644 --- a/pkgs/servers/monitoring/telegraf/default.nix +++ b/pkgs/servers/monitoring/telegraf/default.nix @@ -18,9 +18,9 @@ buildGoModule rec { vendorSha256 = "sha256-J48ezMi9+PxohDKFhBpbcu6fdojlZPXnQQw2IcyimTA="; proxyVendor = true; - preBuild = '' - buildFlagsArray+=("-ldflags=-w -s -X main.version=${version}") - ''; + ldflags = [ + "-w" "-s" "-X main.version=${version}" + ]; passthru.tests = { inherit (nixosTests) telegraf; }; From aea56b0189d550f481176b027fee5cee65cd0813 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:49 +1000 Subject: [PATCH 09/18] trivy: buildFlagsArray -> ldflags --- pkgs/tools/admin/trivy/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/admin/trivy/default.nix b/pkgs/tools/admin/trivy/default.nix index 50ca76f0d6d3..c3b90d99bafb 100644 --- a/pkgs/tools/admin/trivy/default.nix +++ b/pkgs/tools/admin/trivy/default.nix @@ -15,9 +15,9 @@ buildGoModule rec { excludedPackages = "misc"; - preBuild = '' - buildFlagsArray+=("-ldflags" "-s -w -X main.version=v${version}") - ''; + ldflags = [ + "-s" "-w" "-X main.version=v${version}" + ]; doInstallCheck = true; installCheckPhase = '' From 8f311a36b0832dcde041169dca6beb40ce3a26a4 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:49 +1000 Subject: [PATCH 10/18] envdir-go: buildFlagsArray -> ldflags --- pkgs/tools/misc/envdir-go/default.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/misc/envdir-go/default.nix b/pkgs/tools/misc/envdir-go/default.nix index eafc71030ac8..8f847df3d5d1 100644 --- a/pkgs/tools/misc/envdir-go/default.nix +++ b/pkgs/tools/misc/envdir-go/default.nix @@ -14,10 +14,10 @@ buildGoPackage rec { sha256 = "1wdlblj127skgynf9amk7waabc3abbyxys9dvyc6c72zpcpdy5nc"; }; - preBuild = '' - # TODO: is there a way to get the commit ref so we can set main.buildCommit? - buildFlagsArray+=("-ldflags" "-X main.buildDate=1970-01-01T00:00:00+0000 -X main.buildVersion=${version}") -''; + # TODO: is there a way to get the commit ref so we can set main.buildCommit? + ldflags = [ + "-X main.buildDate=1970-01-01T00:00:00+0000" "-X main.buildVersion=${version}" + ]; meta = { description = "A go rewrite of envdir"; From 7a3be5761abf6ab87416f4f6cc7ac994ac63bd35 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:49 +1000 Subject: [PATCH 11/18] goss: buildFlagsArray -> ldflags --- pkgs/tools/misc/goss/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/misc/goss/default.nix b/pkgs/tools/misc/goss/default.nix index bbe947ecd120..c4396bfae9fb 100644 --- a/pkgs/tools/misc/goss/default.nix +++ b/pkgs/tools/misc/goss/default.nix @@ -14,9 +14,9 @@ buildGoModule rec { vendorSha256 = "1lyqjkwj8hybj5swyrv6357hs8sxmf4wim0c8yhfb9mv7fsxhrv7"; CGO_ENABLED = 0; - preBuild = '' - buildFlagsArray+=("-ldflags" "-s -w -X main.version=v${version}") - ''; + ldflags = [ + "-s" "-w" "-X main.version=v${version}" + ]; meta = with lib; { homepage = "https://github.com/aelsabbahy/goss/"; From d6b39de4294e1ae820e076b9d4162632a6de174d Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:50 +1000 Subject: [PATCH 12/18] noti: buildFlagsArray -> ldflags --- pkgs/tools/misc/noti/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/misc/noti/default.nix b/pkgs/tools/misc/noti/default.nix index 9bfc7e259d5b..c964a8872f83 100644 --- a/pkgs/tools/misc/noti/default.nix +++ b/pkgs/tools/misc/noti/default.nix @@ -16,9 +16,9 @@ buildGoPackage rec { goPackagePath = "github.com/variadico/noti"; - preBuild = '' - buildFlagsArray+=("-ldflags" "-X ${goPackagePath}/internal/command.Version=${version}") - ''; + ldflags = [ + "-X ${goPackagePath}/internal/command.Version=${version}" + ]; postInstall = '' install -Dm444 -t $out/share/man/man1 $src/docs/man/*.1 From 0a1ab79b9da2ad122af4202d7f6b6bdf84634b04 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:50 +1000 Subject: [PATCH 13/18] assh: buildFlagsArray -> ldflags --- pkgs/tools/networking/assh/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/networking/assh/default.nix b/pkgs/tools/networking/assh/default.nix index 7d3c662b368f..5bbedf0f7e5b 100644 --- a/pkgs/tools/networking/assh/default.nix +++ b/pkgs/tools/networking/assh/default.nix @@ -20,9 +20,9 @@ buildGoModule rec { doCheck = false; - preBuild = '' - buildFlagsArray+=("-ldflags" "-s -w -X moul.io/assh/v2/pkg/version.Version=${version}") - ''; + ldflags = [ + "-s" "-w" "-X moul.io/assh/v2/pkg/version.Version=${version}" + ]; nativeBuildInputs = [ makeWrapper ]; From 666145832436ff9da4ea1ae99e34ce7be1add659 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:50 +1000 Subject: [PATCH 14/18] gitleaks: buildFlagsArray -> ldflags --- pkgs/tools/security/gitleaks/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/security/gitleaks/default.nix b/pkgs/tools/security/gitleaks/default.nix index 3cd4ae69b9f9..13c44c49c61e 100644 --- a/pkgs/tools/security/gitleaks/default.nix +++ b/pkgs/tools/security/gitleaks/default.nix @@ -16,9 +16,9 @@ buildGoModule rec { vendorSha256 = "sha256-Cc4DJPpOMHxDcH22S7znYo7QHNRXv8jOJhznu09kaE4="; - preBuild = '' - buildFlagsArray+=("-ldflags" "-s -w -X github.com/zricethezav/gitleaks/v${lib.versions.major version}/version.Version=${version}") - ''; + ldflags = [ + "-s" "-w" "-X github.com/zricethezav/gitleaks/v${lib.versions.major version}/version.Version=${version}" + ]; meta = with lib; { description = "Scan git repos (or files) for secrets"; From 26ee35867ba66b9f966a17cac9a4f5a2dbc78006 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:50 +1000 Subject: [PATCH 15/18] grype: buildFlagsArray -> ldflags --- pkgs/tools/security/grype/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/security/grype/default.nix b/pkgs/tools/security/grype/default.nix index c24515dd1bbb..571bf03d1b06 100644 --- a/pkgs/tools/security/grype/default.nix +++ b/pkgs/tools/security/grype/default.nix @@ -19,9 +19,9 @@ buildGoModule rec { propagatedBuildInputs = [ docker ]; - preBuild = '' - buildFlagsArray+=("-ldflags" "-s -w -X github.com/anchore/grype/internal/version.version=${version}") - ''; + ldflags = [ + "-s" "-w" "-X github.com/anchore/grype/internal/version.version=${version}" + ]; # Tests require a running Docker instance doCheck = false; From bf13a63bda87c63abb02faa8c14973fe80ea9b66 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:51 +1000 Subject: [PATCH 16/18] kiterunner: buildFlagsArray -> ldflags --- pkgs/tools/security/kiterunner/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/security/kiterunner/default.nix b/pkgs/tools/security/kiterunner/default.nix index a553202b6c1b..a455c17d717c 100644 --- a/pkgs/tools/security/kiterunner/default.nix +++ b/pkgs/tools/security/kiterunner/default.nix @@ -16,9 +16,9 @@ buildGoModule rec { vendorSha256 = "1nczzzsnh38qi949ki5268y39ggkwncanc1pv7727qpwllzl62vy"; - preBuild = '' - buildFlagsArray+=("-ldflags" "-s -w -X github.com/assetnote/kiterunner/cmd/kiterunner/cmd.Version=${version}") - ''; + ldflags = [ + "-s" "-w" "-X github.com/assetnote/kiterunner/cmd/kiterunner/cmd.Version=${version}" + ]; subPackages = [ "./cmd/kiterunner" ]; From 4235c6e4f0ede0d3083d0b4663c7b74aa5c438b3 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:51 +1000 Subject: [PATCH 17/18] safe: buildFlagsArray -> ldflags --- pkgs/tools/security/safe/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/security/safe/default.nix b/pkgs/tools/security/safe/default.nix index 503cfbd9e868..747528b0ac4e 100644 --- a/pkgs/tools/security/safe/default.nix +++ b/pkgs/tools/security/safe/default.nix @@ -18,9 +18,9 @@ buildGoPackage rec { goPackagePath = "github.com/starkandwayne/safe"; - preBuild = '' - buildFlagsArray+=("-ldflags" "-X main.Version=${version}") - ''; + ldflags = [ + "-X main.Version=${version}" + ]; meta = with lib; { description = "A Vault CLI"; From c2995424bb3520207d9565f8acfc05abe6a47d11 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sat, 21 Aug 2021 18:23:51 +1000 Subject: [PATCH 18/18] teler: buildFlagsArray -> ldflags --- pkgs/tools/security/teler/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/security/teler/default.nix b/pkgs/tools/security/teler/default.nix index a4bcc87eedf9..ffcab3a41877 100644 --- a/pkgs/tools/security/teler/default.nix +++ b/pkgs/tools/security/teler/default.nix @@ -16,9 +16,9 @@ buildGoModule rec { vendorSha256 = "sha256-TQjwPem+RMuoF5T02CL/CTvBS6W7Q786gTvYUFIvxjE="; - preBuild = '' - buildFlagsArray+=("-ldflags" "-s -w -X ktbs.dev/teler/common.Version=${version}") - ''; + ldflags = [ + "-s" "-w" "-X ktbs.dev/teler/common.Version=${version}" + ]; # test require internet access doCheck = false;