diff --git a/modules/programs/aider-chat.nix b/modules/programs/aider-chat.nix new file mode 100644 index 000000000..1aac47732 --- /dev/null +++ b/modules/programs/aider-chat.nix @@ -0,0 +1,50 @@ +{ + lib, + pkgs, + config, + ... +}: +let + inherit (lib) + mkIf + mkEnableOption + mkPackageOption + mkOption + ; + + cfg = config.programs.aider-chat; + yamlFormat = pkgs.formats.yaml { }; +in +{ + meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ]; + options.programs.aider-chat = { + enable = mkEnableOption "aider-chat"; + package = mkPackageOption pkgs "aider-chat" { nullable = true; }; + settings = mkOption { + inherit (yamlFormat) type; + default = { }; + example = { + verify-ssl = false; + architect = true; + auto-accept-architect = false; + show-model-warnings = false; + check-model-accepts-settings = false; + cache-prompts = true; + dark-mode = true; + dirty-commits = false; + lint = true; + }; + description = '' + Configuration settings for aider-chat. All the available options can be found here: + . + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = mkIf (cfg.package != null) [ cfg.package ]; + home.file.".aider.conf.yml" = mkIf (cfg.settings != { }) { + source = yamlFormat.generate "aider.conf.yml" cfg.settings; + }; + }; +} diff --git a/tests/modules/programs/aider-chat/aider.conf.yml b/tests/modules/programs/aider-chat/aider.conf.yml new file mode 100644 index 000000000..5f022752f --- /dev/null +++ b/tests/modules/programs/aider-chat/aider.conf.yml @@ -0,0 +1,9 @@ +architect: true +auto-accept-architect: false +cache-prompts: true +check-model-accepts-settings: false +dark-mode: true +dirty-commits: false +lint: true +show-model-warnings: false +verify-ssl: false diff --git a/tests/modules/programs/aider-chat/default.nix b/tests/modules/programs/aider-chat/default.nix new file mode 100644 index 000000000..7689719e6 --- /dev/null +++ b/tests/modules/programs/aider-chat/default.nix @@ -0,0 +1 @@ +{ aider-chat-example-config = ./example-config.nix; } diff --git a/tests/modules/programs/aider-chat/example-config.nix b/tests/modules/programs/aider-chat/example-config.nix new file mode 100644 index 000000000..5041cc358 --- /dev/null +++ b/tests/modules/programs/aider-chat/example-config.nix @@ -0,0 +1,22 @@ +{ + programs.aider-chat = { + enable = true; + settings = { + verify-ssl = false; + architect = true; + auto-accept-architect = false; + show-model-warnings = false; + check-model-accepts-settings = false; + cache-prompts = true; + dark-mode = true; + dirty-commits = false; + lint = true; + }; + }; + + nmt.script = '' + assertFileExists home-files/.aider.conf.yml + assertFileContent home-files/.aider.conf.yml \ + ${./aider.conf.yml} + ''; +}