diff --git a/pkgs/tools/misc/uwufetch/default.nix b/pkgs/tools/misc/uwufetch/default.nix index 03105b13e4ce..f86320a59b32 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 4869104819d6..000000000000 --- 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) {