nohang: init at 0.2.0

nohang: use installFlags instead of manually running make

Co-authored-by: Leah Amelia Chen <github@acc.pluie.me>

nohang: fix substituteInPlace not substituting

src/* was too broad so --replace-fail made it fail since only the main
python file actually needs substituting

nohang: substitute "env" program too

nixosTests.nohang: only build test for linux

Co-authored-by: Leah Amelia Chen <github@acc.pluie.me>
This commit is contained in:
Dev380
2025-12-29 13:00:54 +02:00
committed by Doron Behar
co-authored by Leah Amelia Chen
parent 352b240ab7
commit 2a3d3814cf
+50
View File
@@ -0,0 +1,50 @@
{
lib,
stdenv,
fetchFromGitHub,
python3,
sudo,
libnotify,
coreutils,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "nohang";
version = "0.2.0";
src = fetchFromGitHub {
owner = "hakavlad";
repo = "nohang";
tag = "v${finalAttrs.version}";
hash = "sha256-aRiBGnJHdtQ5euvJ4DSuCZO5i5OJVRiCesaatrIARmg=";
};
postPatch = ''
patchShebangs src
substituteInPlace src/nohang \
--replace-fail 'notify-send' '${lib.getExe libnotify}' \
--replace-fail 'sudo' '${lib.getExe sudo}' \
--replace-fail "'env'" "'${lib.getExe' coreutils "env"}'"
'';
buildInputs = [ python3 ];
dontBuild = true;
installTargets = [ "base" ];
installFlags = [
"DESTDIR=${placeholder "out"}"
"PREFIX=/"
"SBINDIR=/sbin"
"SYSCONFDIR=/etc"
"SYSTEMDUNITDIR=/lib/systemd/system"
];
meta = {
homepage = "https://github.com/hakavlad/nohang";
description = "Sophisticated low memory handler for Linux";
license = with lib.licenses; [ mit ];
mainProgram = "nohang";
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ Dev380 ];
};
})