{ lib, config, ... }: { options.gnome = { extraWindowControls = lib.mkEnableOption "Should we add back in the minimize and maximize window controls?"; clockFormat = lib.mkOption { type = lib.types.enum [ "12h" "24h" ]; default = "24h"; }; colorScheme = lib.mkOption { type = lib.types.enum [ "default" "prefer-dark" "prefer-light" ]; default = "default"; }; accentColor = lib.mkOption { type = lib.types.enum [ "blue" "teal" "green" "yellow" "orange" "red" "pink" "purple" "slate" ]; default = "blue"; }; extensions = lib.mkOption { type = lib.types.listOf lib.types.package; default = []; description = "The set of extensions to install and enable in the user environment."; }; hotkeys = lib.mkOption { type = lib.types.attrsOf (lib.types.submodule ({name, ...}: { options = { key = lib.mkOption { type = lib.types.strMatching "[a-zA-Z0-9-]+"; default = builtins.replaceStrings [" " "/" "_"] ["-" "-" "-"] name; }; name = lib.mkOption { type = lib.types.str; default = name; }; binding = lib.mkOption { type = lib.types.str; }; command = lib.mkOption { type = lib.types.str; }; }; })); default = {}; }; }; config = { home.packages = config.gnome.extensions; dconf = { settings = lib.mkMerge [ { "org/gnome/shell" = { disable-user-extensions = false; # enables user extensions enabled-extensions = builtins.map (extension: extension.extensionUuid) config.gnome.extensions; }; "org/gnome/desktop/wm/preferences".button-layout = lib.mkIf config.gnome.extraWindowControls ":minimize,maximize,close"; "org/gnome/desktop/interface".color-scheme = config.gnome.colorScheme; "org/gnome/desktop/interface".accent-color = config.gnome.accentColor; "org/gnome/desktop/interface".clock-format = config.gnome.clockFormat; } ( lib.mkMerge ( builtins.map (value: let entry = "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/${value.key}"; in { ${entry} = { binding = value.binding; command = value.command; name = value.name; }; "org/gnome/settings-daemon/plugins/media-keys" = { custom-keybindings = [ "/${entry}/" ]; }; }) ( lib.attrsets.mapAttrsToList (_: value: value) config.gnome.hotkeys ) ) ) ]; }; }; }