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