summary refs log tree commit diff
path: root/pkgs/tools/misc/uwufetch
diff options
context:
space:
mode:
authorrewine <lhongxu@outlook.com>2023-02-15 01:11:52 +0800
committerrewine <lhongxu@outlook.com>2023-02-21 11:24:22 +0800
commitc7c8258c27c4b7fb22aa862c016e74f83c4b9812 (patch)
tree85ce08f8fa2fcd8e6f8199e69942b73ec0d2dbb4 /pkgs/tools/misc/uwufetch
parent349eefb89ff88450659384b34596bc3b9f91d6a9 (diff)
downloadnixpkgs-c7c8258c27c4b7fb22aa862c016e74f83c4b9812.tar
nixpkgs-c7c8258c27c4b7fb22aa862c016e74f83c4b9812.tar.gz
nixpkgs-c7c8258c27c4b7fb22aa862c016e74f83c4b9812.tar.bz2
nixpkgs-c7c8258c27c4b7fb22aa862c016e74f83c4b9812.tar.lz
nixpkgs-c7c8258c27c4b7fb22aa862c016e74f83c4b9812.tar.xz
nixpkgs-c7c8258c27c4b7fb22aa862c016e74f83c4b9812.tar.zst
nixpkgs-c7c8258c27c4b7fb22aa862c016e74f83c4b9812.zip
uwufetch: 2.0 -> 2.1
Diffstat (limited to 'pkgs/tools/misc/uwufetch')
-rw-r--r--pkgs/tools/misc/uwufetch/default.nix32
-rw-r--r--pkgs/tools/misc/uwufetch/fix-paths.patch28
2 files changed, 20 insertions, 40 deletions
diff --git a/pkgs/tools/misc/uwufetch/default.nix b/pkgs/tools/misc/uwufetch/default.nix
index 03105b13e4c..f86320a59b3 100644
--- a/pkgs/tools/misc/uwufetch/default.nix
+++ b/pkgs/tools/misc/uwufetch/default.nix
@@ -1,20 +1,31 @@
-{ lib, stdenv, fetchFromGitHub, fetchpatch, makeWrapper, viu }:
+{ lib, stdenv, fetchFromGitHub, makeWrapper, viu }:
 
 stdenv.mkDerivation rec {
   pname = "uwufetch";
-  version = "2.0";
+  version = "2.1";
 
   src = fetchFromGitHub {
     owner = "TheDarkBug";
     repo = pname;
     rev = version;
-    hash = "sha256-2kktKdQ1xjQRIQR2auwveHgNWGaX1jdJsdlgWrH6l2g=";
+    hash = "sha256-cA8sajh+puswyKikr0Jp9ei+EpVkH+vhEp+pTerkUqA=";
   };
 
-  patches = [
-    # cannot find images in /usr
-    ./fix-paths.patch
-  ];
+  postPatch = ''
+    substituteInPlace uwufetch.c \
+      --replace "/usr/lib/uwufetch" "$out/lib/uwufetch" \
+      --replace "/usr/local/lib/uwufetch" "$out/lib/uwufetch" \
+      --replace "/etc/uwufetch/config" "$out/etc/uwufetch/config"
+    # fix command_path for package manager (nix-store)
+    substituteInPlace fetch.c \
+      --replace "/usr/bin" "/run/current-system/sw/bin"
+  '' + lib.optionalString stdenv.isDarwin ''
+    substituteInPlace Makefile \
+      --replace "local/bin" "bin" \
+      --replace "local/lib" "lib" \
+      --replace "local/include" "include" \
+      --replace "local/share" "share"
+  '';
 
   nativeBuildInputs = [ makeWrapper ];
 
@@ -24,13 +35,9 @@ stdenv.mkDerivation rec {
 
   installFlags = [
     "DESTDIR=${placeholder "out"}"
-    "ETC_DIR=${placeholder "out"}"
+    "ETC_DIR=${placeholder "out"}/etc"
   ];
 
-  postPatch = ''
-    substituteAllInPlace uwufetch.c
-  '';
-
   postFixup = ''
     wrapProgram $out/bin/uwufetch \
       --prefix PATH ":" ${lib.makeBinPath [ viu ]}
@@ -40,6 +47,7 @@ stdenv.mkDerivation rec {
     description = "A meme system info tool for Linux";
     homepage = "https://github.com/TheDarkBug/uwufetch";
     license = licenses.gpl3Plus;
+    platforms = platforms.unix;
     maintainers = with maintainers; [ lourkeur ];
   };
 }
diff --git a/pkgs/tools/misc/uwufetch/fix-paths.patch b/pkgs/tools/misc/uwufetch/fix-paths.patch
deleted file mode 100644
index 4869104819d..00000000000
--- a/pkgs/tools/misc/uwufetch/fix-paths.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-diff --git a/uwufetch.c b/uwufetch.c
-index f2d7857..8191888 100644
---- a/uwufetch.c
-+++ b/uwufetch.c
-@@ -160,9 +160,9 @@ void print_image(struct info* user_info) {
- 		if (strcmp(user_info->os_name, "android") == 0)
- 			sprintf(command, "viu -t -w 18 -h 8 /data/data/com.termux/files/usr/lib/uwufetch/%s.png 2> /dev/null", user_info->os_name); // image command for android
- 		else if (strcmp(user_info->os_name, "macos") == 0)
--			sprintf(command, "viu -t -w 18 -h 8 /usr/local/lib/uwufetch/%s.png 2> /dev/null", user_info->os_name);
-+			sprintf(command, "viu -t -w 18 -h 8 @out@/lib/uwufetch/%s.png 2> /dev/null", user_info->os_name);
- 		else
--			sprintf(command, "viu -t -w 18 -h 8 /usr/lib/uwufetch/%s.png 2> /dev/null", user_info->os_name); // image command for other systems
-+			sprintf(command, "viu -t -w 18 -h 8 @out@/lib/uwufetch/%s.png 2> /dev/null", user_info->os_name); // image command for other systems
- 	}
- 	printf("\n");
- 	if (system(command) != 0) // if viu is not installed or the image is missing
-@@ -587,9 +587,9 @@ void print_ascii(struct info* user_info) {
- 		if (strcmp(user_info->os_name, "android") == 0)
- 			sprintf(ascii_file, "/data/data/com.termux/files/usr/lib/uwufetch/ascii/%s.txt", user_info->os_name);
- 		else if (strcmp(user_info->os_name, "macos") == 0)
--			sprintf(ascii_file, "/usr/local/lib/uwufetch/ascii/%s.txt", user_info->os_name);
-+			sprintf(ascii_file, "@out@/lib/uwufetch/ascii/%s.txt", user_info->os_name);
- 		else
--			sprintf(ascii_file, "/usr/lib/uwufetch/ascii/%s.txt", user_info->os_name);
-+			sprintf(ascii_file, "@out@/lib/uwufetch/ascii/%s.txt", user_info->os_name);
- 
- 		file = fopen(ascii_file, "r");
- 		if (!file) {