mirror of
https://github.com/daylinmorgan/tsm.git
synced 2024-12-22 05:00:44 -06:00
fix: add version override for nix
This commit is contained in:
parent
516d5ae814
commit
5991d93bcb
3 changed files with 15 additions and 6 deletions
|
@ -39,11 +39,14 @@
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
packages = forAllSystems (pkgs: {
|
packages = forAllSystems (pkgs: {
|
||||||
tsm = pkgs.buildNimblePackage {
|
tsm = pkgs.buildNimblePackage rec {
|
||||||
pname = "tsm";
|
pname = "tsm";
|
||||||
version = "2024.1001";
|
version = "2024.1001-unstable";
|
||||||
src = ../.;
|
src = ../.;
|
||||||
nimbleDepsHash = "sha256-ugu+bNCWukWSALzD0/i73d0O2kty85J824tHsmfWRDI=";
|
nimbleDepsHash = "sha256-1J0Wt/XjFiSN1MTfgg9tE5dY3GnXH/UgG3zCL19GgpU=";
|
||||||
|
nimFlags = [
|
||||||
|
"-d:TsmVersion=v${version}"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
default = self.packages.${pkgs.system}.tsm;
|
default = self.packages.${pkgs.system}.tsm;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import std/[os, sequtils, strformat, strutils, parsecfg, tables]
|
import std/[os, sequtils, strformat, strutils, tables]
|
||||||
import usu
|
import usu
|
||||||
import term
|
import term
|
||||||
|
|
||||||
|
|
10
src/tsm.nim
10
src/tsm.nim
|
@ -14,10 +14,16 @@ proc tsm(open: bool = false) =
|
||||||
else:
|
else:
|
||||||
tmux.attach project.name
|
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:
|
when isMainModule:
|
||||||
import cligen
|
import cligen
|
||||||
const vsn = staticExec "git describe --tags --always HEAD --match 'v*'"
|
clCfg.version = getVersion()
|
||||||
clCfg.version = vsn
|
|
||||||
|
|
||||||
if clCfg.helpAttr.len == 0:
|
if clCfg.helpAttr.len == 0:
|
||||||
clCfg.helpAttr =
|
clCfg.helpAttr =
|
||||||
|
|
Loading…
Reference in a new issue