summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/ip/ipfetch/package.nix
blob: 79d6705899512f41e0665a1a65c92d5c6fcf1aa6 (plain)
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
{
  stdenv,
  lib,
  fetchFromGitHub,
  wget,
  makeWrapper,
}:

stdenv.mkDerivation {
  pname = "ipfetch";
  version = "0-unstable-2024-12-15";

  src = fetchFromGitHub {
    owner = "trakBan";
    repo = "ipfetch";
    rev = "a9cf53c17946fe1cfd786c5edf4cc88e903d80ce";
    hash = "sha256-EYGVDb8FY8aOSg7AD+2YuFI8BTr9QVGqmzpLHqUw5tI=";
  };

  strictDeps = true;

  nativeBuildInputs = [ makeWrapper ];

  postPatch = ''
    patchShebangs --host ipfetch-wget
    # The original script hard-coded "/usr/share/ipfetch/$flags", doing replace.
    substituteInPlace ./ipfetch-wget --replace-fail /usr/share/ipfetch $out/share/ipfetch/flags
  '';

  installPhase = ''
    mkdir -p $out/bin
    mkdir -p $out/share/ipfetch/
    cp -r flags $out/share/ipfetch/
    cp ipfetch-wget $out/bin/ipfetch
    wrapProgram $out/bin/ipfetch --prefix PATH : ${
      lib.makeBinPath [
        wget
      ]
    }
  '';

  meta = {
    description = "Neofetch but for ip addresses";
    mainProgram = "ipfetch";
    homepage = "https://github.com/trakBan/ipfetch";
    license = lib.licenses.gpl3Only;
    platforms = lib.platforms.all;
    maintainers = with lib.maintainers; [
      annaaurora
      VZstless
    ];
  };
}