From 2a3d3814cfaa486bb70b10060c828cba97749074 Mon Sep 17 00:00:00 2001 From: Dev380 <49997896+Dev380@users.noreply.github.com> Date: Tue, 20 May 2025 01:39:57 -0400 Subject: [PATCH] nohang: init at 0.2.0 nohang: use installFlags instead of manually running make Co-authored-by: Leah Amelia Chen 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 --- pkgs/by-name/no/nohang/package.nix | 50 ++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 pkgs/by-name/no/nohang/package.nix diff --git a/pkgs/by-name/no/nohang/package.nix b/pkgs/by-name/no/nohang/package.nix new file mode 100644 index 000000000000..08c6a2e99ccf --- /dev/null +++ b/pkgs/by-name/no/nohang/package.nix @@ -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 ]; + }; +})