summary refs log tree commit diff
path: root/pkgs/applications/misc/mission-center/default.nix
blob: 71055e694668c12dfc1c4f94955d4a642a937bc2 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{ lib
, stdenv
, fetchFromGitLab
, fetchFromGitHub
, cargo
, libxml2
, meson
, ninja
, pkg-config
, python311
, rustPlatform
, symlinkJoin
, rustc
, wrapGAppsHook4
, appstream-glib
, blueprint-compiler
, cairo
, cmake
, desktop-file-utils
, dmidecode
, gdk-pixbuf
, gettext
, glib
, graphene
, gtk4
, libadwaita
, libdrm
, mesa
, pango
, sqlite
, udev
, wayland
}:

let
  nvtop = fetchFromGitHub {
    owner = "Syllo";
    repo = "nvtop";
    rev = "be47f8c560487efc6e6a419d59c69bfbdb819324";
    hash = "sha256-MdaZYLxCuVX4LvbwBYNfHHoJWqZAy4J8NBK7Guh2whc=";
  };
in
stdenv.mkDerivation rec {
  pname = "mission-center";
  version = "0.3.2";

  src = fetchFromGitLab {
    owner = "mission-center-devs";
    repo = "mission-center";
    rev = "v${version}";
    hash = "sha256-KuaVivW/i+1Pw6ShpvBYbwPMUHsEJ7FR80is0DBMbXM=";
  };

  cargoDeps = symlinkJoin {
    name = "cargo-vendor-dir";
    paths = [
      (rustPlatform.importCargoLock {
        lockFile = ./Cargo.lock;
        outputHashes = {
          "pathfinder_canvas-0.5.0" = "sha256-k2Sj69hWA0UzRfv91aG1TAygVIuOX3gmipcDbuZxxc8=";
        };
      })
      (rustPlatform.importCargoLock {
        lockFile = ./gatherer-Cargo.lock;
      })
    ];
  };


  nativeBuildInputs = [
    blueprint-compiler
    cargo
    libxml2
    meson
    ninja
    pkg-config
    python311
    rustPlatform.cargoSetupHook
    rustc
    wrapGAppsHook4
  ];

  buildInputs = [
    appstream-glib
    blueprint-compiler
    cairo
    cmake
    desktop-file-utils
    dmidecode
    gdk-pixbuf
    gettext
    glib
    graphene
    gtk4
    libadwaita
    libdrm
    mesa
    pango
    sqlite
    udev
    wayland
  ];

  postPatch = ''
    echo -e "[wrap-file]\ndirectory = nvtop-src\n[provide]\ndependency_names = nvtop" > ./subprojects/nvtop.wrap
    cp -r --no-preserve=mode,ownership "${nvtop}" ./subprojects/nvtop-src
    cd ./subprojects/nvtop-src
    mkdir -p include/libdrm
    for patchfile in $(ls ../packagefiles/nvtop*.patch); do
      patch -p1 < $patchfile
    done
    cd ../..
    patchShebangs data/hwdb/generate_hwdb.py
  '';

  postInstall = ''
    wrapProgram $out/bin/missioncenter --prefix PATH : $out/bin:${dmidecode}/bin
  '';

  meta = with lib; {
    description = "Monitor your CPU, Memory, Disk, Network and GPU usage";
    homepage = "https://gitlab.com/mission-center-devs/mission-center";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ GaetanLepage ];
    platforms = platforms.linux;
    mainProgram = "missioncenter";
  };
}