1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 bash,
6 wget,
7 makeWrapper,
8}:
9
10stdenv.mkDerivation {
11 pname = "ipfetch";
12 version = "0-unstable-2024-02-02";
13
14 src = fetchFromGitHub {
15 owner = "trakBan";
16 repo = "ipfetch";
17 rev = "09b61e0d1d316dbcfab798dd00bc3f9ceb02431d";
18 sha256 = "sha256-RlbNIDRuf4sFS2zw4fIkTu0mB7xgJfPMDIk1I3UYXLk=";
19 };
20
21 strictDeps = true;
22 buildInputs = [
23 bash
24 wget
25 ];
26 nativeBuildInputs = [ makeWrapper ];
27 postPatch = ''
28 patchShebangs --host ipfetch
29 # 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.
30 substituteInPlace ./ipfetch --replace /usr/share/ipfetch $out/usr/share/ipfetch/flags
31 '';
32 installPhase = ''
33 mkdir -p $out/bin
34 mkdir -p $out/usr/share/ipfetch/
35 cp -r flags $out/usr/share/ipfetch/
36 cp ipfetch $out/bin/ipfetch
37 wrapProgram $out/bin/ipfetch --prefix PATH : ${
38 lib.makeBinPath [
39 bash
40 wget
41 ]
42 }
43 '';
44
45 meta = with lib; {
46 description = "Neofetch but for ip addresses";
47 mainProgram = "ipfetch";
48 homepage = "https://github.com/trakBan/ipfetch";
49 license = licenses.gpl3Only;
50 platforms = platforms.all;
51 maintainers = with maintainers; [ annaaurora ];
52 };
53}