about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLouis Bettens <louis@bettens.info>2021-10-18 18:21:47 +0200
committerLouis Bettens <louis@bettens.info>2021-10-19 15:09:25 +0200
commit467bb0f93ff3e3be2b8229e003f2ddf127b3b161 (patch)
tree69cdbfed0649d0f5dfed100cb60923cb92d30643
parentb1d0758cbe8475a2b0bbc57d2ce3ec9a753a4e13 (diff)
uwufetch: init at 1.7
-rw-r--r--pkgs/tools/misc/uwufetch/default.nix46
-rw-r--r--pkgs/tools/misc/uwufetch/fix-paths.patch22
-rw-r--r--pkgs/top-level/all-packages.nix2
3 files changed, 70 insertions, 0 deletions
diff --git a/pkgs/tools/misc/uwufetch/default.nix b/pkgs/tools/misc/uwufetch/default.nix
new file mode 100644
index 0000000000000..1791e5924158e
--- /dev/null
+++ b/pkgs/tools/misc/uwufetch/default.nix
@@ -0,0 +1,46 @@
+{ lib, stdenv, fetchFromGitHub, fetchpatch, makeWrapper, viu }:
+
+stdenv.mkDerivation rec {
+  pname = "uwufetch";
+  version = "1.7";
+
+  src = fetchFromGitHub {
+    owner = "TheDarkBug";
+    repo = pname;
+    rev = version;
+    hash = "sha256-6yfRWFKdg7wM18hD2Bn095HzpnURhZJtx+SYx8SVBLA=";
+  };
+
+  patches = [
+    # cannot find images in /usr
+    ./fix-paths.patch
+    # https://github.com/TheDarkBug/uwufetch/pull/150
+    (fetchpatch {
+      url = "https://github.com/lourkeur/uwufetch/commit/de561649145b57d8750843555e4ffbc1cbcb01f0.patch";
+      sha256 = "sha256-KR81zxGlmthcadYBdsiVwxa5+lZUtqP7w0O4uFuputE=";
+    })
+  ];
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  installFlags = [
+    "PREFIX=${placeholder "out"}/bin"
+    "LIBDIR=${placeholder "out"}/lib"
+    "MANDIR=${placeholder "out"}/share/man/man1"
+  ];
+
+  postPatch = ''
+    substituteAllInPlace uwufetch.c
+  '';
+
+  postFixup = ''
+    wrapProgram $out/bin/uwufetch --prefix PATH ":" ${viu}/bin
+  '';
+
+  meta = with lib; {
+    description = "A meme system info tool for Linux";
+    homepage = "https://github.com/TheDarkBug/uwufetch";
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ lourkeur ];
+  };
+}
diff --git a/pkgs/tools/misc/uwufetch/fix-paths.patch b/pkgs/tools/misc/uwufetch/fix-paths.patch
new file mode 100644
index 0000000000000..e79c2a1fb9d07
--- /dev/null
+++ b/pkgs/tools/misc/uwufetch/fix-paths.patch
@@ -0,0 +1,22 @@
+diff --git a/uwufetch.c b/uwufetch.c
+index 75863a2..ab31dda 100644
+--- a/uwufetch.c
++++ b/uwufetch.c
+@@ -921,7 +921,7 @@ void print_ascii()
+ 		}
+ 		else
+ 		{
+-			sprintf(ascii_file, "/usr/lib/uwufetch/ascii/%s.txt", version_name);
++			sprintf(ascii_file, "@out@/lib/uwufetch/ascii/%s.txt", version_name);
+ 		}
+ 		file = fopen(ascii_file, "r");
+ 		if (!file)
+@@ -1220,7 +1220,7 @@ void print_image()
+ 		if (strcmp(version_name, "android") == 0)
+ 			sprintf(command, "viu -t -w 18 -h 8 /data/data/com.termux/files/usr/lib/uwufetch/%s.png 2> /dev/null", version_name);
+ 		else
+-			sprintf(command, "viu -t -w 18 -h 8 /usr/lib/uwufetch/%s.png 2> /dev/null", version_name);
++			sprintf(command, "viu -t -w 18 -h 8 @out@/lib/uwufetch/%s.png 2> /dev/null", version_name);
+ 	}
+ 	printf("\n");
+ 	if (system(command) != 0)
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d31c80ac4104e..88d7c627f2ffc 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9987,6 +9987,8 @@ with pkgs;
 
   uwsgi = callPackage ../servers/uwsgi { };
 
+  uwufetch = callPackage ../tools/misc/uwufetch { };
+
   v2ray = callPackage ../tools/networking/v2ray { };
 
   vacuum = callPackage ../applications/networking/instant-messengers/vacuum {};