From 64020f453bdf3634bf88a6bbce7f3e56183c8b2b Mon Sep 17 00:00:00 2001 From: Leon Erd Date: Fri, 17 Oct 2025 23:18:22 +0200 Subject: [PATCH] aerospace: add extraConfig --- modules/programs/aerospace.nix | 41 +++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/modules/programs/aerospace.nix b/modules/programs/aerospace.nix index 2f5ebdcc..c24e0104 100644 --- a/modules/programs/aerospace.nix +++ b/modules/programs/aerospace.nix @@ -81,6 +81,23 @@ in }; }; + extraConfig = mkOption { + type = types.lines; + default = ""; + description = '' + Extra configuration to append to the aerospace.toml file. + This allows you to add raw TOML content, including multiline strings. + ''; + example = lib.literalExpression '' + alt-enter = ''''exec-and-forget osascript -e ' + tell application "Terminal" + do script + activate + end tell' + '''' + ''; + }; + userSettings = mkOption { type = types.submodule { freeformType = tomlFormat.type; @@ -303,16 +320,20 @@ in home = { packages = lib.mkIf (cfg.package != null) [ cfg.package ]; - file.".config/aerospace/aerospace.toml".source = tomlFormat.generate "aerospace" ( - filterNulls ( - cfg.userSettings - // lib.optionalAttrs cfg.launchd.enable { - # Override these to avoid launchd conflicts - start-at-login = false; - after-login-command = [ ]; - } - ) - ); + file.".config/aerospace/aerospace.toml".text = + let + generatedConfig = tomlFormat.generate "aerospace" ( + filterNulls ( + cfg.userSettings + // lib.optionalAttrs cfg.launchd.enable { + # Override these to avoid launchd conflicts + start-at-login = false; + after-login-command = [ ]; + } + ) + ); + in + builtins.readFile generatedConfig + lib.optionalString (cfg.extraConfig != "") "${cfg.extraConfig}"; }; launchd.agents.aerospace = {