minio: set CopyrightYear for cli ui

This commit is contained in:
Enno Richter 2023-10-27 06:18:25 +02:00
parent c585eaf8d8
commit d51db98b2b

View File

@ -12,6 +12,12 @@ let
splitTS = builtins.elemAt (builtins.split "(.*)(T.*)" version) 1; splitTS = builtins.elemAt (builtins.split "(.*)(T.*)" version) 1;
in in
builtins.concatStringsSep "" [ (builtins.elemAt splitTS 0) (builtins.replaceStrings [ "-" ] [ ":" ] (builtins.elemAt splitTS 1)) ]; builtins.concatStringsSep "" [ (builtins.elemAt splitTS 0) (builtins.replaceStrings [ "-" ] [ ":" ] (builtins.elemAt splitTS 1)) ];
# CopyrightYear will be printed to the CLI UI.
# Example:
# versionToYear "2021-04-22T15-44-28Z"
# => "2021"
versionToYear = version: builtins.elemAt (lib.splitString "-" version) 0;
in in
buildGoModule rec { buildGoModule rec {
pname = "minio"; pname = "minio";
@ -35,7 +41,12 @@ buildGoModule rec {
tags = [ "kqueue" ]; tags = [ "kqueue" ];
ldflags = let t = "github.com/minio/minio/cmd"; in [ ldflags = let t = "github.com/minio/minio/cmd"; in [
"-s" "-w" "-X ${t}.Version=${versionToTimestamp version}" "-X ${t}.ReleaseTag=RELEASE.${version}" "-X ${t}.CommitID=${src.rev}" "-s"
"-w"
"-X ${t}.Version=${versionToTimestamp version}"
"-X ${t}.CopyrightYear=${versionToYear version}"
"-X ${t}.ReleaseTag=RELEASE.${version}"
"-X ${t}.CommitID=${src.rev}"
]; ];
passthru.tests.minio = nixosTests.minio; passthru.tests.minio = nixosTests.minio;