Merge pull request #242309 from Artturin/ananicyextraxadd

Artturi d1abbbd9 3afe31e0

Changed files
+93 -22
nixos
doc
manual
release-notes
modules
services
pkgs
misc
ananicy
ananicy-rules-cachyos
top-level
+2
nixos/doc/manual/release-notes/rl-2311.section.md
···
- `getent` has been moved from `glibc`'s `bin` output to its own dedicated output, reducing closure size for many dependents. Dependents using the `getent` alias should not be affected; others should move from using `glibc.bin` or `getBin glibc` to `getent` (which also improves compatibility with non-glibc platforms).
+
- The `services.ananicy.extraRules` option now has the type of `listOf attrs` instead of `string`.
+
- `etcd` has been updated to 3.5, you will want to read the [3.3 to 3.4](https://etcd.io/docs/v3.5/upgrades/upgrade_3_4/) and [3.4 to 3.5](https://etcd.io/docs/v3.5/upgrades/upgrade_3_5/) upgrade guides
- `consul` has been updated to `1.16.0`. See the [release note](https://github.com/hashicorp/consul/releases/tag/v1.16.0) for more details. Once a new Consul version has started and upgraded its data directory, it generally cannot be downgraded to the previous version.
+54 -13
nixos/modules/services/misc/ananicy.nix
···
let
cfg = config.services.ananicy;
configFile = pkgs.writeText "ananicy.conf" (generators.toKeyValue { } cfg.settings);
-
extraRules = pkgs.writeText "extraRules" cfg.extraRules;
+
extraRules = pkgs.writeText "extraRules" (concatMapStringsSep "\n" (l: builtins.toJSON l) cfg.extraRules);
+
extraTypes = pkgs.writeText "extraTypes" (concatMapStringsSep "\n" (l: builtins.toJSON l) cfg.extraTypes);
+
extraCgroups = pkgs.writeText "extraCgroups" (concatMapStringsSep "\n" (l: builtins.toJSON l) cfg.extraCgroups);
servicename = if ((lib.getName cfg.package) == (lib.getName pkgs.ananicy-cpp)) then "ananicy-cpp" else "ananicy";
in
{
···
'';
};
+
rulesProvider = mkOption {
+
type = types.package;
+
default = pkgs.ananicy;
+
defaultText = literalExpression "pkgs.ananicy";
+
example = literalExpression "pkgs.ananicy-cpp";
+
description = lib.mdDoc ''
+
Which package to copy default rules,types,cgroups from.
+
'';
+
};
+
settings = mkOption {
type = with types; attrsOf (oneOf [ int bool str ]);
default = { };
···
};
extraRules = mkOption {
-
type = types.str;
-
default = "";
+
type = with types; listOf attrs;
+
default = [ ];
description = lib.mdDoc ''
-
Extra rules in json format on separate lines. See:
+
Rules to write in 'nixRules.rules'. See:
<https://github.com/Nefelim4ag/Ananicy#configuration>
<https://gitlab.com/ananicy-cpp/ananicy-cpp/#global-configuration>
'';
-
example = literalExpression ''
-
'''
-
{ "name": "eog", "type": "Image-View" }
-
{ "name": "fdupes", "type": "BG_CPUIO" }
-
'''
+
example = [
+
{ name = "eog"; type = "Image-Viewer"; }
+
{ name = "fdupes"; type = "BG_CPUIO"; }
+
];
+
};
+
extraTypes = mkOption {
+
type = with types; listOf attrs;
+
default = [ ];
+
description = lib.mdDoc ''
+
Types to write in 'nixTypes.types'. See:
+
<https://gitlab.com/ananicy-cpp/ananicy-cpp/#types>
+
'';
+
example = [
+
{ type = "my_type"; nice = 19; other_parameter = "value"; }
+
{ type = "compiler"; nice = 19; sched = "batch"; ioclass = "idle"; }
+
];
+
};
+
extraCgroups = mkOption {
+
type = with types; listOf attrs;
+
default = [ ];
+
description = lib.mdDoc ''
+
Cgroups to write in 'nixCgroups.cgroups'. See:
+
<https://gitlab.com/ananicy-cpp/ananicy-cpp/#cgroups>
'';
-
+
example = [
+
{ cgroup = "cpu80"; CPUQuota = 80; }
+
];
};
};
};
···
etc."ananicy.d".source = pkgs.runCommandLocal "ananicyfiles" { } ''
mkdir -p $out
# ananicy-cpp does not include rules or settings on purpose
-
cp -r ${pkgs.ananicy}/etc/ananicy.d/* $out
-
rm $out/ananicy.conf
+
if [[ -d "${cfg.rulesProvider}/etc/ananicy.d/00-default" ]]; then
+
cp -r ${cfg.rulesProvider}/etc/ananicy.d/* $out
+
else
+
cp -r ${cfg.rulesProvider}/* $out
+
fi
+
+
# configured through .setings
+
rm -f $out/ananicy.conf
cp ${configFile} $out/ananicy.conf
-
${optionalString (cfg.extraRules != "") "cp ${extraRules} $out/nixRules.rules"}
+
${optionalString (cfg.extraRules != [ ]) "cp ${extraRules} $out/nixRules.rules"}
+
${optionalString (cfg.extraTypes != [ ]) "cp ${extraTypes} $out/nixTypes.types"}
+
${optionalString (cfg.extraCgroups != [ ]) "cp ${extraCgroups} $out/nixCgroups.cgroups"}
'';
};
···
# https://gitlab.com/ananicy-cpp/ananicy-cpp/-/blob/master/src/config.cpp#L12
loglevel = mkOD "warn"; # default is info but its spammy
cgroup_realtime_workaround = mkOD config.systemd.enableUnifiedCgroupHierarchy;
+
log_applied_rule = mkOD false;
} else {
# https://github.com/Nefelim4ag/Ananicy/blob/master/ananicy.d/ananicy.conf
check_disks_schedulers = mkOD true;
+32
pkgs/misc/ananicy-rules-cachyos/default.nix
···
+
{ lib, stdenv, fetchFromGitHub }:
+
+
stdenv.mkDerivation rec {
+
pname = "ananicy";
+
version = "unstable-2023-06-28";
+
+
src = fetchFromGitHub {
+
owner = "CachyOS";
+
repo = "ananicy-rules";
+
rev = "b2b4342d769bc3c6abc4ce77bd53d6ca06d659e5";
+
sha256 = "sha256-TGX7GlfSeKu68mVM71/kdJH31gzMmhzCAqA390aEq8U=";
+
};
+
+
dontConfigure = true;
+
dontBuild = true;
+
+
installPhase = ''
+
runHook preBuild
+
mkdir -p $out
+
cp -r * $out
+
rm $out/README.md
+
runHook postBuild
+
'';
+
+
meta = with lib; {
+
homepage = "https://github.com/CachyOS/ananicy-rules";
+
description = "ananicy-cpp-rules for CachyOS ";
+
license = licenses.gpl3Only;
+
platforms = platforms.linux;
+
maintainers = with maintainers; [ artturin ];
+
};
+
}
+3 -9
pkgs/misc/ananicy/default.nix
···
stdenv.mkDerivation rec {
pname = "ananicy";
-
version = "unstable-2021-11-05";
+
version = "unstable-2023-03-21";
src = fetchFromGitHub {
owner = "nefelim4ag";
repo = "ananicy";
-
rev = "b8968e9b32b0e4e6a01dc2314e43de8fee9da691";
-
sha256 = "sha256-tlPY81xdUpZrDYdApXooZ0Mst0n7ARVHyUrmymqg0rk=";
+
rev = "1e2cc9a62ba3b6793e59da66aa0039f89e1ad49f";
+
sha256 = "sha256-nHp47eYI36edka+cBMzayPHEflAzpgLx0VehhsyYpwI=";
};
patches = [
···
sha256 = "sha256-vMcJxekg2QUbm253CLAv3tmo5kedSlw+/PI/LamNWwc=";
# only used for debian packaging. lets exclude it so the patch applies even when that file is changed
excludes = [ "package.sh" ];
-
})
-
# https://github.com/Nefelim4ag/Ananicy/pull/439
-
# fix syntax error
-
(fetchpatch {
-
url = "https://github.com/Nefelim4ag/Ananicy/commit/0f8b809298ccfd88d0e2ab952d6e4131865246da.patch";
-
sha256 = "sha256-PWE4F0G97gecgc9HnG7ScA78+QVc8u8aF9u74qVChX0=";
})
];
+2
pkgs/top-level/all-packages.nix
···
ananicy-cpp = callPackage ../misc/ananicy-cpp { };
+
ananicy-rules-cachyos = callPackage ../misc/ananicy-rules-cachyos { };
+
andagii = callPackage ../data/fonts/andagii { };
andika = callPackage ../data/fonts/andika { };