Improve version sub-cmd output

This commit is contained in:
Brian Picciano 2022-11-22 12:57:27 +01:00
parent e96fccae1b
commit ca003eaf85

View File

@ -28,7 +28,7 @@ in rec {
buildInputs = [ pkgs.git pkgs.go ]; buildInputs = [ pkgs.git pkgs.go ];
src = ./.; src = ./.;
inherit bootstrap releaseName; inherit releaseName;
nixPkgsVersion = pkgsAttrs.version; nixPkgsVersion = pkgsAttrs.version;
nixPkgsRev = pkgsAttrs.rev; nixPkgsRev = pkgsAttrs.rev;
builtByUser = builtins.getEnv "USER"; builtByUser = builtins.getEnv "USER";
@ -40,15 +40,10 @@ in rec {
cp -r "$src" srcCp cp -r "$src" srcCp
if [ "$bootstrap" != "" ]; then
hostName=$(tar -xzf "$bootstrap" --to-stdout ./hostname)
echo "Built for host: $hostName" >> "$versionFile"
fi
echo "Release: $releaseName" >> "$versionFile" echo "Release: $releaseName" >> "$versionFile"
echo "Git Revision: $(cd srcCp && git rev-parse HEAD)" >> "$versionFile"
echo "Build date: $(date) ($(date +%s))" >> "$versionFile" echo "Build date: $(date) ($(date +%s))" >> "$versionFile"
echo "Built by: $builtByUser" >> "$versionFile" echo "Built by: $builtByUser" >> "$versionFile"
echo "Git rev: $(cd srcCp && git describe --always --long --dirty=' (dirty)')" >> "$versionFile"
echo "Go version: $(go version)" >> "$versionFile" echo "Go version: $(go version)" >> "$versionFile"
echo "Nixpkgs version: $nixPkgsVersion ($nixPkgsRev)" >> "$versionFile" echo "Nixpkgs version: $nixPkgsVersion ($nixPkgsRev)" >> "$versionFile"