fix: add version override for nix

This commit is contained in:
Daylin Morgan 2024-09-16 18:00:44 -05:00
parent 516d5ae814
commit 5991d93bcb
Signed by: daylin
GPG key ID: 950D13E9719334AD
3 changed files with 15 additions and 6 deletions

View file

@ -39,11 +39,14 @@
};
});
packages = forAllSystems (pkgs: {
tsm = pkgs.buildNimblePackage {
tsm = pkgs.buildNimblePackage rec {
pname = "tsm";
version = "2024.1001";
version = "2024.1001-unstable";
src = ../.;
nimbleDepsHash = "sha256-ugu+bNCWukWSALzD0/i73d0O2kty85J824tHsmfWRDI=";
nimbleDepsHash = "sha256-1J0Wt/XjFiSN1MTfgg9tE5dY3GnXH/UgG3zCL19GgpU=";
nimFlags = [
"-d:TsmVersion=v${version}"
];
};
default = self.packages.${pkgs.system}.tsm;
});

View file

@ -1,4 +1,4 @@
import std/[os, sequtils, strformat, strutils, parsecfg, tables]
import std/[os, sequtils, strformat, strutils, tables]
import usu
import term

View file

@ -14,10 +14,16 @@ proc tsm(open: bool = false) =
else:
tmux.attach project.name
proc getVersion(): string =
const tsmVersion {.strdefine.} = "unknown"
const gitVersion = staticExec "git describe --tags --always HEAD --match 'v*'"
when tsmVersion != "unknown": tsmVersion
else: gitVersion
when isMainModule:
import cligen
const vsn = staticExec "git describe --tags --always HEAD --match 'v*'"
clCfg.version = vsn
clCfg.version = getVersion()
if clCfg.helpAttr.len == 0:
clCfg.helpAttr =