diff --git a/hosts/Rhizome/programs.nix b/hosts/Rhizome/programs.nix index a0925976..abd958ce 100644 --- a/hosts/Rhizome/programs.nix +++ b/hosts/Rhizome/programs.nix @@ -96,4 +96,9 @@ enable = true; startOnActivation = true; }; + + programs.cmux = { + enable = true; + enableDefaults = true; + }; } diff --git a/hosts/lobtop/programs.nix b/hosts/lobtop/programs.nix index 032d2f6e..3041941d 100644 --- a/hosts/lobtop/programs.nix +++ b/hosts/lobtop/programs.nix @@ -58,75 +58,6 @@ programs.cmux = { enable = true; - - settings = { - app.minimalMode = true; - notifications.showInMenuBar = false; - ui.surfaceTabBar.buttons = [ - "cmux.newTerminal" - "cmux.splitRight" - "cmux.splitDown" - ]; - workspaceColors = { - notificationBadgeColor = null; - indicatorStyle = "leftRail"; - selectionColor = null; - colors = { - Red = "#ff7b72"; - Orange = "#ffa657"; - Green = "#7ee787"; - Blue = "#79c0ff"; - Sky = "#a5d6ff"; - Purple = "#d2a8ff"; - Pink = "#ff6ac1"; - Cyan = "#9aedfe"; - }; - }; - shortcuts.bindings = { - openFolder = ""; - reopenPreviousSession = ""; - goToWorkspace = "cmd+o"; - commandPalette = "cmd+p"; - nextSurface = "cmd+opt+→"; - prevSurface = "cmd+opt+←"; - nextSidebarTab = "cmd+opt+↓"; - prevSidebarTab = "cmd+opt+↑"; - closeOtherTabsInPane = ""; - selectSurfaceByNumber = "cmd+1"; - selectWorkspaceByNumber = "ctrl+1"; - }; - }; - - ghostty = { - settings = { - background = "#131313"; - foreground = "#dddddd"; - "cursor-color" = "#dddddd"; - "selection-background" = "#353436"; - "selection-foreground" = "#dddddd"; - "font-family" = "MesloLGSDZ Nerd Font Mono"; - "font-size" = 12; - "window-padding-x" = 8; - "window-padding-y" = 8; - }; - palette = { - "0" = "#131313"; - "1" = "#ff5c57"; - "2" = "#5af78e"; - "3" = "#f3f99d"; - "4" = "#57c7ff"; - "5" = "#ff6ac1"; - "6" = "#9aedfe"; - "7" = "#caccca"; - "8" = "#686868"; - "9" = "#ff7b72"; - "10" = "#7ee787"; - "11" = "#ffa657"; - "12" = "#79c0ff"; - "13" = "#d2a8ff"; - "14" = "#a5d6ff"; - "15" = "#ffffff"; - }; - }; + enableDefaults = true; }; } diff --git a/modules/darwin/programs/cmux.nix b/modules/darwin/programs/cmux.nix index 4bc83d4a..c5b94fb0 100644 --- a/modules/darwin/programs/cmux.nix +++ b/modules/darwin/programs/cmux.nix @@ -26,6 +26,8 @@ in { options.programs.cmux = { enable = mkEnableOption "cmux"; + enableDefaults = mkEnableOption "cmux and ghostty shared defaults"; + settings = mkOption { inherit (jsonFormat) type; default = {}; @@ -33,16 +35,6 @@ in { Configuration written to {file}`~/.config/cmux/cmux.json`. Keys map directly to cmux JSON config fields. ''; - example = literalExpression '' - { - schemaVersion = 1; - app.minimalMode = true; - shortcuts.bindings = { - goToWorkspace = "cmd+o"; - commandPalette = "cmd+p"; - }; - } - ''; }; ghostty = { @@ -53,15 +45,6 @@ in { Ghostty settings written to {file}`~/.config/ghostty/config` as `key = value` pairs. ''; - example = literalExpression '' - { - background = "#131313"; - foreground = "#dddddd"; - "cursor-color" = "#dddddd"; - "font-family" = "MesloLGSDZ Nerd Font Mono"; - "font-size" = 12; - } - ''; }; palette = mkOption { @@ -71,32 +54,99 @@ in { Terminal color palette written as `palette = =` lines in {file}`~/.config/ghostty/config`. Keys must be numeric strings "0"–"15". ''; - example = literalExpression '' - { - "0" = "#131313"; - "1" = "#ff5c57"; - "15" = "#ffffff"; - } - ''; }; }; }; - config = mkIf cfg.enable { - homebrew.casks = ["cmux"]; + config = mkMerge [ + (mkIf cfg.enableDefaults { + programs.cmux.settings = { + app.minimalMode = mkDefault true; + notifications.showInMenuBar = mkDefault false; + ui.surfaceTabBar.buttons = mkDefault [ + "cmux.newTerminal" + "cmux.splitRight" + "cmux.splitDown" + ]; + workspaceColors = mkDefault { + notificationBadgeColor = null; + indicatorStyle = "leftRail"; + selectionColor = null; + colors = { + Red = "#ff7b72"; + Orange = "#ffa657"; + Green = "#7ee787"; + Blue = "#79c0ff"; + Sky = "#a5d6ff"; + Purple = "#d2a8ff"; + Pink = "#ff6ac1"; + Cyan = "#9aedfe"; + }; + }; + shortcuts.bindings = mkDefault { + openFolder = ""; + reopenPreviousSession = ""; + goToWorkspace = "cmd+o"; + commandPalette = "cmd+p"; + nextSurface = "cmd+opt+→"; + prevSurface = "cmd+opt+←"; + nextSidebarTab = "cmd+opt+↓"; + prevSidebarTab = "cmd+opt+↑"; + closeOtherTabsInPane = ""; + selectSurfaceByNumber = "cmd+1"; + selectWorkspaceByNumber = "ctrl+1"; + }; + }; - home-manager.users.${username} = { - xdg.configFile."cmux/cmux.json" = { - source = jsonFormat.generate "cmux-config" ({ - "$schema" = "https://raw.githubusercontent.com/manaflow-ai/cmux/main/web/data/cmux.schema.json"; - schemaVersion = 1; - } - // cfg.settings); + programs.cmux.ghostty = { + settings = mapAttrs (_: mkDefault) { + background = "#131313"; + foreground = "#dddddd"; + "cursor-color" = "#dddddd"; + "selection-background" = "#353436"; + "selection-foreground" = "#dddddd"; + "font-family" = "MesloLGSDZ Nerd Font Mono"; + "font-size" = 12; + "window-padding-x" = 8; + "window-padding-y" = 8; + }; + palette = mapAttrs (_: mkDefault) { + "0" = "#131313"; + "1" = "#ff5c57"; + "2" = "#5af78e"; + "3" = "#f3f99d"; + "4" = "#57c7ff"; + "5" = "#ff6ac1"; + "6" = "#9aedfe"; + "7" = "#caccca"; + "8" = "#686868"; + "9" = "#ff7b72"; + "10" = "#7ee787"; + "11" = "#ffa657"; + "12" = "#79c0ff"; + "13" = "#d2a8ff"; + "14" = "#a5d6ff"; + "15" = "#ffffff"; + }; }; + }) + + (mkIf cfg.enable { + homebrew.casks = ["cmux"]; + + home-manager.users.${username} = { + xdg.configFile."cmux/cmux.json" = { + source = jsonFormat.generate "cmux-config" ({ + "$schema" = "https://raw.githubusercontent.com/manaflow-ai/cmux/main/web/data/cmux.schema.json"; + schemaVersion = 1; + } + // cfg.settings); + }; - xdg.configFile."ghostty/config" = mkIf (cfg.ghostty.settings != {} || cfg.ghostty.palette != {}) { - text = ghosttyConfigText; + xdg.configFile."ghostty/config" = mkIf (cfg.ghostty.settings != {} || cfg.ghostty.palette != {}) { + text = ghosttyConfigText; + }; }; - }; - }; + }) + ]; }