···
else if isBool v then boolToString v
else if isString v then ''"${escape [''"''] v}"''
else if isList v then "[ " + concatMapStringsSep ", " toConf v + " ]"
14
+
else if isAttrs v then "\n{\n" + convertAttrs v + "\n}"
else abort "clight.toConf: unexpected type (v = ${v})";
16
-
clightConf = pkgs.writeText "clight.conf"
17
-
(concatStringsSep "\n" (mapAttrsToList
18
-
(name: value: "${toString name} = ${toConf value};")
20
-
(_: value: value != null)
18
+
if isAttrs v then ":"
21
+
convertAttrs = attrs: concatStringsSep "\n" (mapAttrsToList
22
+
(name: value: "${toString name} ${getSep value} ${toConf value};")
25
+
clightConf = pkgs.writeText "clight.conf" (convertAttrs
27
+
(_: value: value != null)
options.services.clight = {
···
52
-
validConfigTypes = with types; either int (either str (either bool float));
59
+
validConfigTypes = with types; oneOf [ int str bool float ];
60
+
collectionTypes = with types; oneOf [ validConfigTypes (listOf validConfigTypes) ];
54
-
type = with types; attrsOf (nullOr (either validConfigTypes (listOf validConfigTypes)));
62
+
type = with types; attrsOf (nullOr (either collectionTypes (attrsOf collectionTypes)));
example = { captures = 20; gamma_long_transition = true; ac_capture_timeouts = [ 120 300 60 ]; };
···
services.upower.enable = true;
services.clight.settings = {
72
-
gamma_temp = with cfg.temperature; mkDefault [ day night ];
80
+
gamma.temp = with cfg.temperature; mkDefault [ day night ];
} // (optionalAttrs (config.location.provider == "manual") {
74
-
latitude = mkDefault config.location.latitude;
75
-
longitude = mkDefault config.location.longitude;
82
+
daytime.latitude = mkDefault config.location.latitude;
83
+
daytime.longitude = mkDefault config.location.longitude;
services.geoclue2.appConfig.clightc = {