From 34d2b8329146c9068af20c1dbb71bff94f9b2abe Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Thu, 22 Jul 2021 21:51:16 -0700 Subject: [PATCH] nixos/klipper: Allow lists as values for gcode_macro --- nixos/modules/services/misc/klipper.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/misc/klipper.nix b/nixos/modules/services/misc/klipper.nix index 4930648ba8e3..909408225e06 100644 --- a/nixos/modules/services/misc/klipper.nix +++ b/nixos/modules/services/misc/klipper.nix @@ -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