0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-14 06:00:33 +03:00

nixos/ananicy: take listOf attrs instead of string

This commit is contained in:
Artturin 2023-07-12 20:12:10 +03:00
parent 1b1f25312d
commit 4cf8006173
2 changed files with 28 additions and 32 deletions

View file

@ -46,6 +46,8 @@
- `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). - `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 - `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. - `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.

View file

@ -5,9 +5,9 @@ with lib;
let let
cfg = config.services.ananicy; cfg = config.services.ananicy;
configFile = pkgs.writeText "ananicy.conf" (generators.toKeyValue { } cfg.settings); 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" cfg.extraTypes; extraTypes = pkgs.writeText "extraTypes" (concatMapStringsSep "\n" (l: builtins.toJSON l) cfg.extraTypes);
extraCgroups = pkgs.writeText "extraCgroups" cfg.extraCgroups; 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"; servicename = if ((lib.getName cfg.package) == (lib.getName pkgs.ananicy-cpp)) then "ananicy-cpp" else "ananicy";
in in
{ {
@ -47,46 +47,40 @@ in
}; };
extraRules = mkOption { extraRules = mkOption {
type = types.str; type = with types; listOf attrs;
default = ""; default = [ ];
description = lib.mdDoc '' 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://github.com/Nefelim4ag/Ananicy#configuration>
<https://gitlab.com/ananicy-cpp/ananicy-cpp/#global-configuration> <https://gitlab.com/ananicy-cpp/ananicy-cpp/#global-configuration>
''; '';
example = literalExpression '' example = [
''' { name = "eog"; type = "Image-Viewer"; }
{ "name": "eog", "type": "Image-Viewer" } { name = "fdupes"; type = "BG_CPUIO"; }
{ "name": "fdupes", "type": "BG_CPUIO" } ];
'''
'';
}; };
extraTypes = mkOption { extraTypes = mkOption {
type = types.str; type = with types; listOf attrs;
default = ""; default = [ ];
description = lib.mdDoc '' description = lib.mdDoc ''
Extra types in json format on separate lines. See: Types to write in 'nixTypes.types'. See:
<https://gitlab.com/ananicy-cpp/ananicy-cpp/#types> <https://gitlab.com/ananicy-cpp/ananicy-cpp/#types>
''; '';
example = literalExpression '' example = [
''' { type = "my_type"; nice = 19; other_parameter = "value"; }
{"type": "my_type", "nice": 19, "other_parameter": "value"} { type = "compiler"; nice = 19; sched = "batch"; ioclass = "idle"; }
{"type": "compiler", "nice": 19, "sched": "batch", "ioclass": "idle"} ];
'''
'';
}; };
extraCgroups = mkOption { extraCgroups = mkOption {
type = types.str; type = with types; listOf attrs;
default = ""; default = [ ];
description = lib.mdDoc '' description = lib.mdDoc ''
Extra cgroups in json format on separate lines. See: Cgroups to write in 'nixCgroups.cgroups'. See:
<https://gitlab.com/ananicy-cpp/ananicy-cpp/#cgroups> <https://gitlab.com/ananicy-cpp/ananicy-cpp/#cgroups>
''; '';
example = literalExpression '' example = [
''' { cgroup = "cpu80"; CPUQuota = 80; }
{"cgroup": "cpu80", "CPUQuota": 80} ];
'''
'';
}; };
}; };
}; };
@ -106,9 +100,9 @@ in
# configured through .setings # configured through .setings
rm -f $out/ananicy.conf rm -f $out/ananicy.conf
cp ${configFile} $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.extraTypes != [ ]) "cp ${extraTypes} $out/nixTypes.types"}
${optionalString (cfg.extraCgroups != "") "cp ${extraCgroups} $out/nixCgroups.cgroups"} ${optionalString (cfg.extraCgroups != [ ]) "cp ${extraCgroups} $out/nixCgroups.cgroups"}
''; '';
}; };