NIX_System_Configurations/common/modules/resources.nix

77 lines
1.7 KiB
Nix
Raw Normal View History

2023-11-26 21:32:14 +00:00
{ lib
, stdenv
, fetchFromGitHub
, appstream-glib
, cargo
, desktop-file-utils
, meson
, ninja
, pkg-config
, rustPlatform
, rustc
, wrapGAppsHook4
, glib
, gtk4
, libadwaita
2023-12-21 20:48:41 +00:00
, dmidecode
, util-linux
2023-11-26 21:32:14 +00:00
}:
2023-12-21 20:48:41 +00:00
stdenv.mkDerivation (finalAttrs: {
2023-11-26 21:32:14 +00:00
pname = "resources";
version = "1.2.1";
src = fetchFromGitHub {
owner = "nokyan";
2023-12-21 20:48:41 +00:00
repo = "resources";
rev = "refs/tags/v${finalAttrs.version}";
2023-11-26 21:32:14 +00:00
hash = "sha256-OVz1vsmOtH/5sEuyl2BfDqG2/9D1HGtHA0FtPntKQT0=";
};
cargoDeps = rustPlatform.fetchCargoTarball {
2023-12-21 20:48:41 +00:00
inherit (finalAttrs) src;
name = "resources-${finalAttrs.version}";
hash = "sha256-MNYKfvbLQPWm7MKS5zYGrc+aoC9WeU5FTftkCrogZg0=";
2023-11-26 21:32:14 +00:00
};
nativeBuildInputs = [
appstream-glib
desktop-file-utils
meson
ninja
pkg-config
wrapGAppsHook4
rustPlatform.cargoSetupHook
cargo
rustc
];
buildInputs = [
glib
gtk4
libadwaita
];
2023-12-21 20:48:41 +00:00
postPatch = ''
substituteInPlace src/utils/memory.rs \
--replace '"dmidecode"' '"${dmidecode}/bin/dmidecode"'
substituteInPlace src/utils/cpu.rs \
--replace '"lscpu"' '"${util-linux}/bin/lscpu"'
substituteInPlace src/utils/memory.rs \
--replace '"pkexec"' '"/run/wrappers/bin/pkexec"'
'';
2023-11-26 21:32:14 +00:00
mesonFlags = [
2023-12-21 20:48:41 +00:00
(lib.mesonOption "profile" "default")
2023-11-26 21:32:14 +00:00
];
meta = {
2023-12-21 20:48:41 +00:00
changelog = "https://github.com/nokyan/resources/releases/tag/${finalAttrs.version}";
description = "Monitor your system resources and processes";
2023-11-26 21:32:14 +00:00
homepage = "https://github.com/nokyan/resources";
license = lib.licenses.gpl3Only;
2023-12-21 20:48:41 +00:00
mainProgram = "resources";
maintainers = with lib.maintainers; [ lukas-heiligenbrunner ewuuwe ];
platforms = lib.platforms.linux;
2023-11-26 21:32:14 +00:00
};
2023-12-21 20:48:41 +00:00
})