lol

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

Artturin 4cf80061 1b1f2531

+28 -32
+2
nixos/doc/manual/release-notes/rl-2311.section.md
··· 46 46 47 47 - `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). 48 48 49 + - The `services.ananicy.extraRules` option now has the type of `listOf attrs` instead of `string`. 50 + 49 51 - `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 50 52 51 53 - `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
··· 5 5 let 6 6 cfg = config.services.ananicy; 7 7 configFile = pkgs.writeText "ananicy.conf" (generators.toKeyValue { } cfg.settings); 8 - extraRules = pkgs.writeText "extraRules" cfg.extraRules; 9 - extraTypes = pkgs.writeText "extraTypes" cfg.extraTypes; 10 - extraCgroups = pkgs.writeText "extraCgroups" cfg.extraCgroups; 8 + extraRules = pkgs.writeText "extraRules" (concatMapStringsSep "\n" (l: builtins.toJSON l) cfg.extraRules); 9 + extraTypes = pkgs.writeText "extraTypes" (concatMapStringsSep "\n" (l: builtins.toJSON l) cfg.extraTypes); 10 + extraCgroups = pkgs.writeText "extraCgroups" (concatMapStringsSep "\n" (l: builtins.toJSON l) cfg.extraCgroups); 11 11 servicename = if ((lib.getName cfg.package) == (lib.getName pkgs.ananicy-cpp)) then "ananicy-cpp" else "ananicy"; 12 12 in 13 13 { ··· 47 47 }; 48 48 49 49 extraRules = mkOption { 50 - type = types.str; 51 - default = ""; 50 + type = with types; listOf attrs; 51 + default = [ ]; 52 52 description = lib.mdDoc '' 53 - Extra rules in json format on separate lines. See: 53 + Rules to write in 'nixRules.rules'. See: 54 54 <https://github.com/Nefelim4ag/Ananicy#configuration> 55 55 <https://gitlab.com/ananicy-cpp/ananicy-cpp/#global-configuration> 56 56 ''; 57 - example = literalExpression '' 58 - ''' 59 - { "name": "eog", "type": "Image-Viewer" } 60 - { "name": "fdupes", "type": "BG_CPUIO" } 61 - ''' 62 - ''; 57 + example = [ 58 + { name = "eog"; type = "Image-Viewer"; } 59 + { name = "fdupes"; type = "BG_CPUIO"; } 60 + ]; 63 61 }; 64 62 extraTypes = mkOption { 65 - type = types.str; 66 - default = ""; 63 + type = with types; listOf attrs; 64 + default = [ ]; 67 65 description = lib.mdDoc '' 68 - Extra types in json format on separate lines. See: 66 + Types to write in 'nixTypes.types'. See: 69 67 <https://gitlab.com/ananicy-cpp/ananicy-cpp/#types> 70 68 ''; 71 - example = literalExpression '' 72 - ''' 73 - {"type": "my_type", "nice": 19, "other_parameter": "value"} 74 - {"type": "compiler", "nice": 19, "sched": "batch", "ioclass": "idle"} 75 - ''' 76 - ''; 69 + example = [ 70 + { type = "my_type"; nice = 19; other_parameter = "value"; } 71 + { type = "compiler"; nice = 19; sched = "batch"; ioclass = "idle"; } 72 + ]; 77 73 }; 78 74 extraCgroups = mkOption { 79 - type = types.str; 80 - default = ""; 75 + type = with types; listOf attrs; 76 + default = [ ]; 81 77 description = lib.mdDoc '' 82 - Extra cgroups in json format on separate lines. See: 78 + Cgroups to write in 'nixCgroups.cgroups'. See: 83 79 <https://gitlab.com/ananicy-cpp/ananicy-cpp/#cgroups> 84 80 ''; 85 - example = literalExpression '' 86 - ''' 87 - {"cgroup": "cpu80", "CPUQuota": 80} 88 - ''' 89 - ''; 81 + example = [ 82 + { cgroup = "cpu80"; CPUQuota = 80; } 83 + ]; 90 84 }; 91 85 }; 92 86 }; ··· 106 100 # configured through .setings 107 101 rm -f $out/ananicy.conf 108 102 cp ${configFile} $out/ananicy.conf 109 - ${optionalString (cfg.extraRules != "") "cp ${extraRules} $out/nixRules.rules"} 110 - ${optionalString (cfg.extraTypes != "") "cp ${extraTypes} $out/nixTypes.types"} 111 - ${optionalString (cfg.extraCgroups != "") "cp ${extraCgroups} $out/nixCgroups.cgroups"} 103 + ${optionalString (cfg.extraRules != [ ]) "cp ${extraRules} $out/nixRules.rules"} 104 + ${optionalString (cfg.extraTypes != [ ]) "cp ${extraTypes} $out/nixTypes.types"} 105 + ${optionalString (cfg.extraCgroups != [ ]) "cp ${extraCgroups} $out/nixCgroups.cgroups"} 112 106 ''; 113 107 }; 114 108