1{ stdenv, lib, fetchFromGitHub, bash, wget, makeWrapper }:
2
3stdenv.mkDerivation rec {
4 pname = "ipfetch";
5 version = "unstable-2022-03-24";
6
7 src = fetchFromGitHub {
8 owner = "trakBan";
9 repo = "ipfetch";
10 rev = "fc295bfda4f9fea6eee9f6f3f2dabc26b6f25be4";
11 sha256 = "sha256-YKQ9pRBj2hgPg2ShCqWGxzHs/n7kNhKRNyElRDwHDBU=";
12 };
13
14 strictDeps = true;
15 buildInputs = [ bash wget ];
16 nativeBuildInputs = [ makeWrapper ];
17 postPatch = ''
18 patchShebangs --host ipfetch
19 # Not only does `/usr` have to be replaced but also `/flags` needs to be added because with Nix the script is broken without this. The `/flags` is somehow not needed if you install via the install script in the source repository.
20 substituteInPlace ./ipfetch --replace /usr/share/ipfetch $out/usr/share/ipfetch/flags
21 '';
22 installPhase = ''
23 mkdir -p $out/bin
24 mkdir -p $out/usr/share/ipfetch/
25 cp -r flags $out/usr/share/ipfetch/
26 cp ipfetch $out/bin/ipfetch
27 wrapProgram $out/bin/ipfetch --prefix PATH : ${
28 lib.makeBinPath [ bash wget ]
29 }
30 '';
31
32 meta = with lib; {
33 description = "Neofetch but for ip addresses";
34 license = licenses.gpl3Only;
35 platforms = platforms.all;
36 maintainers = with maintainers; [ annaaurora ];
37 };
38}