diff --git a/nix/culr-module.nix b/nix/culr-module.nix index b46aa6c..50261a8 100644 --- a/nix/culr-module.nix +++ b/nix/culr-module.nix @@ -4,13 +4,13 @@ config, ... }: let - inherit (lib) mkIf mkEnableOption mkOption types concatStringsSep; + inherit (lib) mkIf mkEnableOption mkOption types concatStringsSep typeOf; cfg = config.programs.culr; in { options.programs.culr = { enable = mkEnableOption "culr"; pattern = mkOption { - type = with types; listOf int; + type = with types; either str (listOf int); default = []; description = "colourising pattern"; }; @@ -24,7 +24,15 @@ in { config = mkIf cfg.enable { environment.systemPackages = let inherit (pkgs) culr; in [culr]; environment.sessionVariables = { - CULR_PATTERN = mkIf (cfg.pattern != []) (concatStringsSep ";" cfg.pattern); + CULR_PATTERN = let + serialise = { + list = list: concatStringsSep ";"; + str = s: s; + }; + in + mkIf (cfg.pattern != "" && cfg.pattern != []) + serialise.${typeOf cfg.pattern} + cfg.pattern; CULR_PALETTE = mkIf (cfg.palette != []) (concatStringsSep ";" cfg.palette); }; };