mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
aiac: add module
This commit is contained in:
parent
142acd7a7d
commit
68a92b0301
4 changed files with 91 additions and 0 deletions
54
modules/programs/aiac.nix
Normal file
54
modules/programs/aiac.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
mkIf
|
||||||
|
mkEnableOption
|
||||||
|
mkPackageOption
|
||||||
|
mkOption
|
||||||
|
;
|
||||||
|
|
||||||
|
cfg = config.programs.aiac;
|
||||||
|
tomlFormat = pkgs.formats.toml { };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||||
|
options.programs.aiac = {
|
||||||
|
enable = mkEnableOption "aiac";
|
||||||
|
package = mkPackageOption pkgs "aiac" { nullable = true; };
|
||||||
|
settings = mkOption {
|
||||||
|
inherit (tomlFormat) type;
|
||||||
|
default = { };
|
||||||
|
example = {
|
||||||
|
default_backend = "official_openai";
|
||||||
|
backends = {
|
||||||
|
official_openai = {
|
||||||
|
type = "openai";
|
||||||
|
api_key = "API KEY";
|
||||||
|
default_model = "gpt-4o";
|
||||||
|
};
|
||||||
|
|
||||||
|
localhost = {
|
||||||
|
type = "ollama";
|
||||||
|
url = "http://localhost:11434/api";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Configuration settings for aiac. All the available options can be found here:
|
||||||
|
<https://github.com/gofireflyio/aiac/?tab=readme-ov-file#configuration>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||||
|
xdg.configFile."aiac/aiac.toml" = mkIf (cfg.settings != { }) {
|
||||||
|
source = tomlFormat.generate "aiac.toml" cfg.settings;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
10
tests/modules/programs/aiac/aiac.toml
Normal file
10
tests/modules/programs/aiac/aiac.toml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
default_backend = "official_openai"
|
||||||
|
|
||||||
|
[backends.localhost]
|
||||||
|
type = "ollama"
|
||||||
|
url = "http://localhost:11434/api"
|
||||||
|
|
||||||
|
[backends.official_openai]
|
||||||
|
api_key = "API KEY"
|
||||||
|
default_model = "gpt-4o"
|
||||||
|
type = "openai"
|
||||||
1
tests/modules/programs/aiac/default.nix
Normal file
1
tests/modules/programs/aiac/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{ aiac-example-config = ./example-config.nix; }
|
||||||
26
tests/modules/programs/aiac/example-config.nix
Normal file
26
tests/modules/programs/aiac/example-config.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
programs.aiac = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
default_backend = "official_openai";
|
||||||
|
backends = {
|
||||||
|
official_openai = {
|
||||||
|
type = "openai";
|
||||||
|
api_key = "API KEY";
|
||||||
|
default_model = "gpt-4o";
|
||||||
|
};
|
||||||
|
|
||||||
|
localhost = {
|
||||||
|
type = "ollama";
|
||||||
|
url = "http://localhost:11434/api";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.config/aiac/aiac.toml
|
||||||
|
assertFileContent home-files/.config/aiac/aiac.toml \
|
||||||
|
${./aiac.toml}
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue