diff --git a/configurations/home-manager/leyla/default.nix b/configurations/home-manager/leyla/default.nix index f2c14e1..0c90ab1 100644 --- a/configurations/home-manager/leyla/default.nix +++ b/configurations/home-manager/leyla/default.nix @@ -83,6 +83,32 @@ }; }; + user = { + continue = { + enable = true; + docs = { + "Continue Docs" = { + startUrl = "https://docs.continue.dev"; + }; + "Nixpkgs" = { + startUrl = "https://ryantm.github.io/nixpkgs/#preface"; + }; + "Nix Manual" = { + startUrl = "https://nixos.org/manual/nixos/stable/"; + }; + "Home manager Manual" = { + startUrl = "https://nix-community.github.io/home-manager/"; + }; + "Nix Docs" = { + startUrl = "https://nix.dev/index.html"; + }; + "Linux Man Page" = { + startUrl = "https://linux.die.net/man/"; + }; + }; + }; + }; + programs = { # Let Home Manager install and manage itself. home-manager.enable = true; diff --git a/configurations/home-manager/leyla/vscode/default.nix b/configurations/home-manager/leyla/vscode/default.nix index 1108f2f..2f3c455 100644 --- a/configurations/home-manager/leyla/vscode/default.nix +++ b/configurations/home-manager/leyla/vscode/default.nix @@ -2,11 +2,12 @@ lib, pkgs, inputs, + config, osConfig, ... }: let nix-development-enabled = osConfig.host.nix-development.enable; - ai-tooling-enabled = osConfig.services.ollama.enable; + ai-tooling-enabled = config.user.continue.enable && osConfig.host.ai.enable; in { nixpkgs = { overlays = [ @@ -14,9 +15,6 @@ in { ]; }; - # TODO: when ai-tooling is enabled configure ~/.continue/config.yaml to use remote hosted on defiant - # TODO: when ai-tooling is enabled configure ~/.continue/config.yaml to use use better models hosted on defiant - programs = { bash.shellAliases = { code = "codium"; @@ -59,10 +57,8 @@ in { "expr" = "import {}"; }; }) - (lib.mkIf osConfig.services.ollama.enable { + (lib.mkIf ai-tooling-enabled { "continue.telemetryEnabled" = false; - - # builtins.elemAt osConfig.services.ollama.loadModels 0; }) ]; diff --git a/configurations/nixos/twilight/configuration.nix b/configurations/nixos/twilight/configuration.nix index 4a2c838..82ca9b7 100644 --- a/configurations/nixos/twilight/configuration.nix +++ b/configurations/nixos/twilight/configuration.nix @@ -35,7 +35,7 @@ # TODO: benchmark twilight against defiant and prune this list of models that are faster on defiant models = { # conversation models - "lamma3.1:8b" = { + "Llama 3.1 8B" = { model = "lamma3.1:8b"; roles = ["chat" "edit" "apply"]; }; diff --git a/modules/home-manager-modules/continue.nix b/modules/home-manager-modules/continue.nix index fce3b38..327ee44 100644 --- a/modules/home-manager-modules/continue.nix +++ b/modules/home-manager-modules/continue.nix @@ -1,3 +1,75 @@ -{...}: { - # TODO: enable option for continue.yaml for home based on options defined in osConfig.ai.models +{ + lib, + pkgs, + config, + osConfig, + ... +}: let + ai-tooling-enabled = config.user.continue.enable && osConfig.host.ai.enable; +in { + options = { + user.continue = { + enable = lib.mkEnableOption "should continue be enabled on this machine"; + docs = lib.mkOption { + type = lib.types.attrsOf (lib.types.submodule ({name, ...}: { + options = { + name = lib.mkOption { + type = lib.types.str; + default = name; + }; + startUrl = lib.mkOption { + type = lib.types.str; + }; + }; + })); + }; + context = lib.mkOption { + type = lib.types.attrsOf (lib.types.submodule ({name, ...}: { + options = { + provider = lib.mkOption { + type = lib.types.str; + default = name; + }; + }; + })); + default = { + "code" = {}; + "docs" = {}; + "diff" = {}; + "terminal" = {}; + "problems" = {}; + "folder" = {}; + "codebase" = {}; + }; + }; + }; + }; + + config = + lib.mkIf ai-tooling-enabled + (lib.mkMerge [ + { + home = { + file = { + ".continue/config.yaml".source = (pkgs.formats.yaml {}).generate "continue-config" { + name = "Assistant"; + version = "1.0.0"; + schema = "v1"; + models = lib.attrsets.attrValues osConfig.host.ai.models; + context = lib.attrsets.attrValues config.user.continue.context; + docs = lib.attrsets.attrValues config.user.continue.docs; + }; + }; + }; + } + (lib.mkIf osConfig.host.impermanence.enable { + home.persistence."/persist${config.home.homeDirectory}" = { + directories = [ + ".continue/index" + ".continue/sessions" + ]; + allowOther = true; + }; + }) + ]); } diff --git a/modules/home-manager-modules/default.nix b/modules/home-manager-modules/default.nix index ef9bf0a..ee47fb5 100644 --- a/modules/home-manager-modules/default.nix +++ b/modules/home-manager-modules/default.nix @@ -4,5 +4,6 @@ ./flipperzero.nix ./i18n.nix ./openssh.nix + ./continue.nix ]; } diff --git a/modules/nixos-modules/ai.nix b/modules/nixos-modules/ai.nix index 73ff4db..8cc19ff 100644 --- a/modules/nixos-modules/ai.nix +++ b/modules/nixos-modules/ai.nix @@ -4,24 +4,24 @@ enable = lib.mkEnableOption "should we use AI on this machine"; models = lib.mkOption { type = lib.types.attrsOf (lib.types.submodule ({name, ...}: { - option = { + options = { name = lib.mkOption { type = lib.types.str; default = name; }; - model = { + model = lib.mkOption { type = lib.types.str; }; - provider = { + provider = lib.mkOption { type = lib.types.str; default = "ollama"; }; - apiBase = { - type = lib.types.str; - default = null; - }; - roles = { - type = lib.types.listOf lib.types.enumOf [ + # apiBase = lib.mkOption { + # type = lib.types.nullOr lib.types.str; + # default = null; + # }; + roles = lib.mkOption { + type = lib.types.listOf (lib.types.enum [ "chat" "autocomplete" "embed" @@ -29,11 +29,13 @@ "edit" "apply" "summarize" - ]; + ]); + default = []; }; }; })); }; + default = {}; }; };