about summary refs log tree commit diff
path: root/pkgs/tools/misc/uwufetch/default.nix
blob: 4dba7dac8038e72597f233ba1e8b60e0f612d9cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
{ lib, stdenv, fetchFromGitHub, makeWrapper, viu }:

stdenv.mkDerivation rec {
  pname = "uwufetch";
  version = "2.1";

  src = fetchFromGitHub {
    owner = "TheDarkBug";
    repo = pname;
    rev = version;
    hash = "sha256-cA8sajh+puswyKikr0Jp9ei+EpVkH+vhEp+pTerkUqA=";
  };

  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 ];

  makeFlags = [
    "UWUFETCH_VERSION=${version}"
  ];

  installFlags = [
    "DESTDIR=${placeholder "out"}"
    "ETC_DIR=${placeholder "out"}/etc"
  ];

  postFixup = ''
    wrapProgram $out/bin/uwufetch \
      --prefix PATH ":" ${lib.makeBinPath [ viu ]}
  '';

  meta = with lib; {
    description = "Meme system info tool for Linux";
    homepage = "https://github.com/TheDarkBug/uwufetch";
    license = licenses.gpl3Plus;
    platforms = platforms.unix;
    maintainers = with maintainers; [ bbjubjub ];
    mainProgram = "uwufetch";
  };
}