nixos/ananicy: take `listOf attrs` instead of `string`

Artturin 4cf80061 1b1f2531

Changed files
+28 -32
nixos
doc
manual
release-notes
modules
services
+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.
+26 -32
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;
-
extraTypes = pkgs.writeText "extraTypes" cfg.extraTypes;
-
extraCgroups = pkgs.writeText "extraCgroups" cfg.extraCgroups;
+
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
{
···
};
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-Viewer" }
-
{ "name": "fdupes", "type": "BG_CPUIO" }
-
'''
-
'';
+
example = [
+
{ name = "eog"; type = "Image-Viewer"; }
+
{ name = "fdupes"; type = "BG_CPUIO"; }
+
];
};
extraTypes = mkOption {
-
type = types.str;
-
default = "";
+
type = with types; listOf attrs;
+
default = [ ];
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>
'';
-
example = literalExpression ''
-
'''
-
{"type": "my_type", "nice": 19, "other_parameter": "value"}
-
{"type": "compiler", "nice": 19, "sched": "batch", "ioclass": "idle"}
-
'''
-
'';
+
example = [
+
{ type = "my_type"; nice = 19; other_parameter = "value"; }
+
{ type = "compiler"; nice = 19; sched = "batch"; ioclass = "idle"; }
+
];
};
extraCgroups = mkOption {
-
type = types.str;
-
default = "";
+
type = with types; listOf attrs;
+
default = [ ];
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>
'';
-
example = literalExpression ''
-
'''
-
{"cgroup": "cpu80", "CPUQuota": 80}
-
'''
-
'';
+
example = [
+
{ cgroup = "cpu80"; CPUQuota = 80; }
+
];
};
};
};
···
# configured through .setings
rm -f $out/ananicy.conf
cp ${configFile} $out/ananicy.conf
-
${optionalString (cfg.extraRules != "") "cp ${extraRules} $out/nixRules.rules"}
-
${optionalString (cfg.extraTypes != "") "cp ${extraTypes} $out/nixTypes.types"}
-
${optionalString (cfg.extraCgroups != "") "cp ${extraCgroups} $out/nixCgroups.cgroups"}
+
${optionalString (cfg.extraRules != [ ]) "cp ${extraRules} $out/nixRules.rules"}
+
${optionalString (cfg.extraTypes != [ ]) "cp ${extraTypes} $out/nixTypes.types"}
+
${optionalString (cfg.extraCgroups != [ ]) "cp ${extraCgroups} $out/nixCgroups.cgroups"}
'';
};