Move to setting version info explicitly in linker flags
Some checks failed
/ golint (push) Failing after 12s
Some checks failed
/ golint (push) Failing after 12s
We don't have go built-in VCS information in a nix build because the git repository isn't present. After struggling to build an overlay that would provide it, I decided this path is easier of just injecting in the data that we need. Issue: #5
This commit is contained in:
parent
81826f853e
commit
d4cbfb960e
8 changed files with 119 additions and 79 deletions
17
default.nix
17
default.nix
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs ? import <nixpkgs> { }, proj ? pkgs.proj }:
|
||||
{ ldflags, version, pkgs ? import <nixpkgs> { }, proj ? pkgs.proj }:
|
||||
|
||||
let
|
||||
# Get commit timestamp at eval time (pure)
|
||||
|
|
@ -12,24 +12,12 @@ let
|
|||
else "0";
|
||||
in
|
||||
pkgs.buildGoModule rec {
|
||||
inherit ldflags version;
|
||||
pname = "nidus-sync";
|
||||
version = "0.0.12";
|
||||
src = ./.;
|
||||
|
||||
gitRevision =
|
||||
if builtins.pathExists ./.git
|
||||
then pkgs.lib.commitIdFromGitRepo ./.git
|
||||
else "unknown";
|
||||
|
||||
buildTime = getCommitTime;
|
||||
|
||||
ldflags = [
|
||||
"-s"
|
||||
"-w"
|
||||
"-X main.Version=${version}"
|
||||
"-X main.Commit=${gitRevision}"
|
||||
"-X main.BuildTime=${buildTime}"
|
||||
];
|
||||
meta = {
|
||||
description = "Nidus Sync";
|
||||
homepage = "https://github.com/Gleipnir-Technology/nidus-sync";
|
||||
|
|
@ -74,4 +62,5 @@ pkgs.buildGoModule rec {
|
|||
cp -r vite/rmo/static/gen/rmo $out/share/frontend/
|
||||
cp -r vite/rmo/static/gen/sync $out/share/frontend/
|
||||
'';
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue