nixos/klipper: Allow lists as values for gcode_macro

This commit is contained in:
Zhaofeng Li 2021-07-22 21:51:16 -07:00
parent 3af210329f
commit 34d2b83291

View file

@ -2,7 +2,13 @@
with lib;
let
cfg = config.services.klipper;
format = pkgs.formats.ini { mkKeyValue = generators.mkKeyValueDefault {} ":"; };
format = pkgs.formats.ini {
# https://github.com/NixOS/nixpkgs/pull/121613#issuecomment-885241996
listToValue = l:
if builtins.length l == 1 then generators.mkValueStringDefault {} (head l)
else lib.concatMapStrings (s: "\n ${generators.mkValueStringDefault {} s}") l;
mkKeyValue = generators.mkKeyValueDefault {} ":";
};
in
{
##### interface