more nix serialisation
This commit is contained in:
parent
e125fd4b6a
commit
e02af13482
@ -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);
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user