summary refs log tree commit diff
path: root/pkgs/tools/networking/corerad/default.nix
diff options
context:
space:
mode:
authorMatt Layher <mdlayher@gmail.com>2020-06-24 23:51:22 -0400
committerMatt Layher <mdlayher@gmail.com>2020-06-25 00:17:37 -0400
commit477cf953befbed96cff392f5550db58852e3ca21 (patch)
treeabaaaf31f7b32f963200e2d0e8f984332718f93f /pkgs/tools/networking/corerad/default.nix
parent10f75b2fed07f417bc7051c725ddba3a9293aba8 (diff)
downloadnixpkgs-477cf953befbed96cff392f5550db58852e3ca21.tar
nixpkgs-477cf953befbed96cff392f5550db58852e3ca21.tar.gz
nixpkgs-477cf953befbed96cff392f5550db58852e3ca21.tar.bz2
nixpkgs-477cf953befbed96cff392f5550db58852e3ca21.tar.lz
nixpkgs-477cf953befbed96cff392f5550db58852e3ca21.tar.xz
nixpkgs-477cf953befbed96cff392f5550db58852e3ca21.tar.zst
nixpkgs-477cf953befbed96cff392f5550db58852e3ca21.zip
corerad: set linkTimestamp from file in repository root
Signed-off-by: Matt Layher <mdlayher@gmail.com>
Diffstat (limited to 'pkgs/tools/networking/corerad/default.nix')
-rw-r--r--pkgs/tools/networking/corerad/default.nix14
1 files changed, 10 insertions, 4 deletions
diff --git a/pkgs/tools/networking/corerad/default.nix b/pkgs/tools/networking/corerad/default.nix
index 85a03e3611b..2b1e94d2c19 100644
--- a/pkgs/tools/networking/corerad/default.nix
+++ b/pkgs/tools/networking/corerad/default.nix
@@ -13,10 +13,16 @@ buildGoModule rec {
 
   vendorSha256 = "19hp8xqr50v8h9vblihalvkb9ll8c0v4p071j9j1zkbjhnb07rca";
 
-  buildFlagsArray = ''
-    -ldflags=
-    -X github.com/mdlayher/corerad/internal/build.linkTimestamp=1593050100
-    -X github.com/mdlayher/corerad/internal/build.linkVersion=v${version}
+  # Since the tarball pulled from GitHub doesn't contain git tag information,
+  # we fetch the expected tag's timestamp from a file in the root of the
+  # repository.
+  preBuild = ''
+    buildFlagsArray=(
+      -ldflags="
+        -X github.com/mdlayher/corerad/internal/build.linkTimestamp=$(<.gittagtime)
+        -X github.com/mdlayher/corerad/internal/build.linkVersion=v${version}
+      "
+    )
   '';
 
   passthru.tests = {