diff --git a/pkgs/tools/misc/uwufetch/default.nix b/pkgs/tools/misc/uwufetch/default.nix new file mode 100644 index 000000000000..4bb4f9446716 --- /dev/null +++ b/pkgs/tools/misc/uwufetch/default.nix @@ -0,0 +1,47 @@ +{ 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 ":" ${lib.makeBinPath [ viu ]} + ''; + + 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 000000000000..e79c2a1fb9d0 --- /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 2257c6b9fd2d..48c6f235c119 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -10125,6 +10125,8 @@ with pkgs; uwsgi = callPackage ../servers/uwsgi { }; + uwufetch = callPackage ../tools/misc/uwufetch { }; + v2ray = callPackage ../tools/networking/v2ray { }; vacuum = callPackage ../applications/networking/instant-messengers/vacuum {};