lol
1{
2 lib,
3 stdenv,
4 python3,
5 fetchFromGitHub,
6 makeWrapper,
7 schedtool,
8 sysctl,
9 util-linux,
10 fetchpatch,
11}:
12
13stdenv.mkDerivation {
14 pname = "ananicy";
15 version = "unstable-2023-03-21";
16
17 src = fetchFromGitHub {
18 owner = "nefelim4ag";
19 repo = "ananicy";
20 rev = "1e2cc9a62ba3b6793e59da66aa0039f89e1ad49f";
21 sha256 = "sha256-nHp47eYI36edka+cBMzayPHEflAzpgLx0VehhsyYpwI=";
22 };
23
24 patches = [
25 # https://github.com/Nefelim4ag/Ananicy/pull/437
26 # fix makefile destinations
27 (fetchpatch {
28 url = "https://github.com/Nefelim4ag/Ananicy/commit/dbda0f50670de3f249991706ef1cc107c5197a2f.patch";
29 sha256 = "sha256-vMcJxekg2QUbm253CLAv3tmo5kedSlw+/PI/LamNWwc=";
30 # only used for debian packaging. lets exclude it so the patch applies even when that file is changed
31 excludes = [ "package.sh" ];
32 })
33 ];
34
35 nativeBuildInputs = [ makeWrapper ];
36 buildInputs = [ python3 ];
37
38 makeFlags = [
39 "PREFIX=$(out)"
40 "SYSCONFDIR=${placeholder "out"}/etc"
41 ];
42
43 dontConfigure = true;
44 dontBuild = true;
45
46 postInstall = ''
47 wrapProgram $out/bin/ananicy \
48 --prefix PATH : ${
49 lib.makeBinPath [
50 schedtool
51 util-linux
52 ]
53 }
54
55 substituteInPlace $out/lib/systemd/system/ananicy.service \
56 --replace "/sbin/sysctl" "${sysctl}/bin/sysctl" \
57 --replace "/usr/bin/ananicy" "$out/bin/ananicy"
58 '';
59
60 meta = with lib; {
61 homepage = "https://github.com/Nefelim4ag/Ananicy";
62 description = "Another auto nice daemon, with community rules support";
63 license = licenses.gpl3Only;
64 platforms = platforms.linux;
65 maintainers = with maintainers; [ artturin ];
66 mainProgram = "ananicy";
67 };
68}