From 31e19529525a725edf4e5d0d940c638fd1f15d1b Mon Sep 17 00:00:00 2001 From: Aaron Jheng Date: Wed, 4 Jan 2023 06:17:12 +0000 Subject: argo: build staticfiles with buildGoModule --- pkgs/applications/networking/cluster/argo/default.nix | 18 ++++++++++++++---- .../networking/cluster/argo/staticfiles.go.mod | 3 +++ 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 pkgs/applications/networking/cluster/argo/staticfiles.go.mod diff --git a/pkgs/applications/networking/cluster/argo/default.nix b/pkgs/applications/networking/cluster/argo/default.nix index f02b6e416c3..ab2d1bd3d3f 100644 --- a/pkgs/applications/networking/cluster/argo/default.nix +++ b/pkgs/applications/networking/cluster/argo/default.nix @@ -12,16 +12,25 @@ let # We build the CLI without the static server for simplicity, but the tool is still required for # compilation to succeed. # See: https://github.com/argoproj/argo/blob/d7690e32faf2ac5842468831daf1443283703c25/Makefile#L117 - staticfiles = pkgsBuildBuild.buildGoPackage rec { + staticfiles = pkgsBuildBuild.buildGoModule rec { name = "staticfiles"; + src = fetchFromGitHub { owner = "bouk"; repo = "staticfiles"; rev = "827d7f6389cd410d0aa3f3d472a4838557bf53dd"; - sha256 = "0xarhmsqypl8036w96ssdzjv3k098p2d4mkmw5f6hkp1m3j67j61"; + hash = "sha256-wchj5KjhTmhc4XVW0sRFCcyx5W9am8TNAIhej3WFWXU="; }; - goPackagePath = "bou.ke/staticfiles"; + vendorHash = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo="; + + excludedPackages = [ "./example" ]; + + preBuild = '' + cp ${./staticfiles.go.mod} go.mod + ''; + + ldflags = [ "-s" "-w" ]; }; in buildGoModule rec { @@ -55,7 +64,8 @@ buildGoModule rec { ''; ldflags = [ - "-s" "-w" + "-s" + "-w" "-X github.com/argoproj/argo-workflows/v3.buildDate=unknown" "-X github.com/argoproj/argo-workflows/v3.gitCommit=${src.rev}" "-X github.com/argoproj/argo-workflows/v3.gitTag=${src.rev}" diff --git a/pkgs/applications/networking/cluster/argo/staticfiles.go.mod b/pkgs/applications/networking/cluster/argo/staticfiles.go.mod new file mode 100644 index 00000000000..952de850dc7 --- /dev/null +++ b/pkgs/applications/networking/cluster/argo/staticfiles.go.mod @@ -0,0 +1,3 @@ +module bou.ke/staticfiles + +go 1.18 -- cgit 1.4.1