From 38271ead8e7b291beb9d3b8312e66c3268796c0a Mon Sep 17 00:00:00 2001 From: Guangqing Chen Date: Fri, 5 May 2023 16:52:22 +0800 Subject: [PATCH] xfconf: support uint (#3946) --- modules/misc/xfconf.nix | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/misc/xfconf.nix b/modules/misc/xfconf.nix index a56ecbb5a..423126ff5 100644 --- a/modules/misc/xfconf.nix +++ b/modules/misc/xfconf.nix @@ -6,8 +6,31 @@ let cfg = config.xfconf; + xfIntVariant = types.submodule { + options = { + type = mkOption { + type = types.enum [ "int" "uint" "uint64" ]; + description = '' + To distinguish between int, uint and uint64 in xfconf, + you can specify the type in xfconf with this submodule. + For other types, you don't need to use this submodule, + just specify the value is enough. + ''; + }; + value = mkOption { + type = types.int; + description = "The value in xfconf."; + }; + }; + }; + withType = v: - if builtins.isBool v then [ + if builtins.isAttrs v then [ + "-t" + v.type + "-s" + (toString v.value) + ] else if builtins.isBool v then [ "-t" "bool" "-s" @@ -55,9 +78,10 @@ in { attrsOf (attrsOf (oneOf [ bool int + xfIntVariant float str - (listOf (oneOf [ bool int float str ])) + (listOf (oneOf [ bool int xfIntVariant float str ])) ])) // { description = "xfconf settings"; };