evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / by-name / mi / mission-center / package.nix
blobb21baead3379656c68db010681e63b0c14111ed3
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   fetchFromGitLab,
6   rustPlatform,
7   symlinkJoin,
9   # nativeBuildInputs
10   blueprint-compiler,
11   cargo,
12   libxml2,
13   meson,
14   ninja,
15   pkg-config,
16   python3,
17   rustc,
18   wrapGAppsHook4,
20   # buildInputs
21   appstream-glib,
22   cairo,
23   cmake,
24   dbus,
25   desktop-file-utils,
26   gdk-pixbuf,
27   gettext,
28   glib,
29   graphene,
30   gtk4,
31   libGL,
32   libadwaita,
33   libdrm,
34   mesa,
35   pango,
36   sqlite,
37   udev,
38   wayland,
40   vulkan-loader,
42   versionCheckHook,
45 # UPDATE PROCESS:
46 # 1) Get the nvtop commit hash (`source-url` in `nvtop.json`):
47 #     https://gitlab.com/mission-center-devs/mission-center/-/blob/v<VERSION>/src/sys_info_v2/gatherer/3rdparty/nvtop/nvtop.json?ref_type=tags
48 # 2) Update the version of the main derivation
49 # 3) Get the main `Cargo.lock` and copy it to `Cargo.lock`:
50 #     https://gitlab.com/mission-center-devs/mission-center/-/blob/v<VERSION>/Cargo.lock?ref_type=tags
51 # 4) Get the gatherer `Cargo.lock` and copy it to `gatherer-Cargo.lock`:
52 #     https://gitlab.com/mission-center-devs/mission-center/-/blob/v<VERSION>/src/sys_info_v2/gatherer/Cargo.lock?ref_type=tags
53 # 5) Refresh both the `nvtop` and `src` hashes
55 let
56   nvtop = fetchFromGitHub {
57     owner = "Syllo";
58     repo = "nvtop";
59     rev = "20ea55dbd1eeb4342ff0112fae3ee2a0bfe352ea";
60     hash = "sha256-8lNvxmNAqkmBPFeiYIGtpW0hYXA9N0l4HURew5loj+g=";
61   };
63 stdenv.mkDerivation rec {
64   pname = "mission-center";
65   version = "0.6.2";
67   src = fetchFromGitLab {
68     owner = "mission-center-devs";
69     repo = "mission-center";
70     rev = "v${version}";
71     hash = "sha256-PvHIvWyhGovlLaeHk2WMp3yRz4VxvvINzX1oqkFgVuQ=";
72   };
74   cargoDeps = symlinkJoin {
75     name = "cargo-vendor-dir";
76     paths = [
77       (rustPlatform.importCargoLock { lockFile = ./Cargo.lock; })
78       (rustPlatform.importCargoLock { lockFile = ./gatherer-Cargo.lock; })
79     ];
80   };
82   nativeBuildInputs = [
83     blueprint-compiler
84     cargo
85     libxml2
86     meson
87     ninja
88     pkg-config
89     python3
90     rustPlatform.cargoSetupHook
91     rustc
92     wrapGAppsHook4
93   ];
95   buildInputs = [
96     appstream-glib
97     blueprint-compiler
98     cairo
99     cmake
100     dbus
101     desktop-file-utils
102     gdk-pixbuf
103     gettext
104     glib
105     graphene
106     gtk4
107     libGL
108     libadwaita
109     libdrm
110     mesa
111     pango
112     sqlite
113     udev
114     wayland
115   ];
117   postPatch = ''
118     substituteInPlace src/sys_info_v2/gatherer.rs \
119       --replace-fail '"missioncenter-gatherer"' '"${placeholder "out"}/bin/missioncenter-gatherer"'
121     substituteInPlace $cargoDepsCopy/gl_loader-*/src/glad.c \
122       --replace-fail "libGL.so.1" "${libGL}/lib/libGL.so.1"
124     substituteInPlace $cargoDepsCopy/ash-*/src/entry.rs \
125       --replace-fail '"libvulkan.so.1"' '"${vulkan-loader}/lib/libvulkan.so.1"'
127     SRC_GATHERER=$NIX_BUILD_TOP/source/src/sys_info_v2/gatherer
128     SRC_GATHERER_NVTOP=$SRC_GATHERER/3rdparty/nvtop
130     substituteInPlace $SRC_GATHERER_NVTOP/nvtop.json \
131       --replace-fail "nvtop-${nvtop.rev}" "nvtop-src"
133     GATHERER_BUILD_DEST=$NIX_BUILD_TOP/source/build/src/sys_info_v2/gatherer/src/debug/build/native
134     mkdir -p $GATHERER_BUILD_DEST
135     NVTOP_SRC=$GATHERER_BUILD_DEST/nvtop-src
137     cp -r --no-preserve=mode,ownership "${nvtop}" $NVTOP_SRC
138     pushd $NVTOP_SRC
139     mkdir -p include/libdrm
140     for patchfile in $(ls $SRC_GATHERER_NVTOP/patches/nvtop*.patch); do
141       patch -p1 < $patchfile
142     done
143     popd
145     patchShebangs data/hwdb/generate_hwdb.py
146   '';
148   nativeInstallCheckInputs = [
149     versionCheckHook
150   ];
151   versionCheckProgram = "${builtins.placeholder "out"}/bin/${meta.mainProgram}";
152   doInstallCheck = true;
154   meta = {
155     description = "Monitor your CPU, Memory, Disk, Network and GPU usage";
156     homepage = "https://gitlab.com/mission-center-devs/mission-center";
157     changelog = "https://gitlab.com/mission-center-devs/mission-center/-/releases/v${version}";
158     license = lib.licenses.gpl3Only;
159     maintainers = with lib.maintainers; [ GaetanLepage ];
160     platforms = lib.platforms.linux;
161     mainProgram = "missioncenter";
162   };