Merge pull request #131173 from zhaofengli/klipper-cfg-list

nixos/klipper: Allow lists as values for gcode_macro
This commit is contained in:
Bernardo Meurer 2021-07-23 08:57:12 -07:00 committed by GitHub
commit f7e77f65ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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