nitter: patch source version/rev/url into about

This commit is contained in:
Infinidoge 2022-11-07 17:04:14 -05:00 committed by ehmry
parent 78bc5aad0b
commit b1429a1f70
2 changed files with 27 additions and 0 deletions

View file

@ -2,6 +2,7 @@
, fetchFromGitHub
, nimPackages
, nixosTests
, substituteAll
}:
nimPackages.buildNimPackage rec {
@ -15,6 +16,15 @@ nimPackages.buildNimPackage rec {
hash = "sha256-fdzVfzmEFIej6Kb/K9MQyvbN8aN3hO7RetHL53cD59k=";
};
patches = [
(substituteAll {
src = ./nitter-version.patch;
inherit version;
inherit (src) rev;
url = builtins.replaceStrings [ "archive" ".tar.gz" ] [ "commit" "" ] src.url;
})
];
buildInputs = with nimPackages; [
flatty
jester

View file

@ -0,0 +1,17 @@
diff --git a/src/views/about.nim b/src/views/about.nim
index e7e8de9..54a6050 100644
--- a/src/views/about.nim
+++ b/src/views/about.nim
@@ -3,10 +3,8 @@ import os, strformat
import karax/[karaxdsl, vdom]
const
- date = staticExec("git show -s --format=\"%cd\" --date=format:\"%Y.%m.%d\"")
- hash = staticExec("git show -s --format=\"%h\"")
- link = "https://github.com/zedeus/nitter/commit/" & hash
- version = &"{date}-{hash}"
+ link = "@url@"
+ version = "@version@-@rev@"
var aboutHtml: string