diff --git a/configurations/nixos/horizon/configuration.nix b/configurations/nixos/horizon/configuration.nix index 63ed59d..8448654 100644 --- a/configurations/nixos/horizon/configuration.nix +++ b/configurations/nixos/horizon/configuration.nix @@ -23,6 +23,29 @@ hardware = { directAccess.enable = true; }; + + ai = { + enable = true; + models = { + "Llama 3.1 8B" = { + model = "lamma3.1:8b"; + roles = ["chat" "edit" "apply"]; + apiBase = "http://twilight:11434"; + }; + + "qwen2.5-coder:1.5b-base" = { + model = "qwen2.5-coder:1.5b-base"; + roles = ["autocomplete"]; + apiBase = "http://twilight:11434"; + }; + + "nomic-embed-text:latest" = { + model = "nomic-embed-text:latest"; + roles = ["embed"]; + apiBase = "http://twilight:11434"; + }; + }; + }; }; environment.systemPackages = [ @@ -51,14 +74,6 @@ fprintd = { enable = true; }; - ollama = { - enable = false; - - loadModels = [ - "deepseek-coder:1.3b" - "deepseek-r1:1.5b" - ]; - }; tailscale = { enable = true; authKeyFile = config.sops.secrets."vpn-keys/tailscale-authkey/horizon".path; diff --git a/configurations/nixos/twilight/configuration.nix b/configurations/nixos/twilight/configuration.nix index 82ca9b7..10f2606 100644 --- a/configurations/nixos/twilight/configuration.nix +++ b/configurations/nixos/twilight/configuration.nix @@ -83,6 +83,7 @@ services = { ollama = { enable = true; + exposePort = true; loadModels = [ # conversation models diff --git a/flake.lock b/flake.lock index 1a03eab..b70bb5a 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1747742835, - "narHash": "sha256-kYL4GCwwznsypvsnA20oyvW8zB/Dvn6K5G/tgMjVMT4=", + "lastModified": 1748225455, + "narHash": "sha256-AzlJCKaM4wbEyEpV3I/PUq5mHnib2ryEy32c+qfj6xk=", "owner": "nix-community", "repo": "disko", - "rev": "df522e787fdffc4f32ed3e1fca9ed0968a384d62", + "rev": "a894f2811e1ee8d10c50560551e50d6ab3c392ba", "type": "github" }, "original": { @@ -28,11 +28,11 @@ }, "locked": { "dir": "pkgs/firefox-addons", - "lastModified": 1747973023, - "narHash": "sha256-v2OgykASspKAyL+hYKlfa9PM4cwlFZ7/WQ1uvd256ko=", + "lastModified": 1748232210, + "narHash": "sha256-hyXsQVgl/URb13iWEONwV3gGZ9IU90Q9yPmn5xoWP/8=", "owner": "rycee", "repo": "nur-expressions", - "rev": "c7ee05a5dc9b52ba7a6a660537fabaf711b7790a", + "rev": "26c86ba664f227c6abb383d3ca8db9365f275766", "type": "gitlab" }, "original": { @@ -82,11 +82,11 @@ ] }, "locked": { - "lastModified": 1747978958, - "narHash": "sha256-pQQnbxWpY3IiZqgelXHIe/OAE/Yv4NSQq7fch7M6nXQ=", + "lastModified": 1748227609, + "narHash": "sha256-SaSdslyo6UGDpPUlmrPA4dWOEuxCy2ihRN9K6BnqYsA=", "owner": "nix-community", "repo": "home-manager", - "rev": "7419250703fd5eb50e99bdfb07a86671939103ea", + "rev": "d23d20f55d49d8818ac1f1b2783671e8a6725022", "type": "github" }, "original": { @@ -117,11 +117,11 @@ ] }, "locked": { - "lastModified": 1748004251, - "narHash": "sha256-XodjkVWTth3A2JpBqGBkdLD9kkWn94rnv98l3xwKukg=", + "lastModified": 1748149228, + "narHash": "sha256-mmonYFesFo42UUS49Hd0bcbVJRWX/aHBCDYUkkvylf4=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "33220d4791784e4dd4739edd3f6c028020082f91", + "rev": "a9939228f661df370c4094fe85f683e45d761dbe", "type": "github" }, "original": { @@ -159,11 +159,11 @@ ] }, "locked": { - "lastModified": 1747965670, - "narHash": "sha256-O91kjsTL7xccgTQr2KITmGhhLTpX9zh+oRvvV8ScOrg=", + "lastModified": 1748225039, + "narHash": "sha256-Lvl26mCEatC5akRHywuXkYM6ZKc7R5T9m6u7rBPtNQw=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "d3099346fa5e9e33d0989a4e6afc3e8dedd25311", + "rev": "cde730cb9dc2759104d7c8c27cb36d73189be1e2", "type": "github" }, "original": { @@ -190,11 +190,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1747744144, - "narHash": "sha256-W7lqHp0qZiENCDwUZ5EX/lNhxjMdNapFnbErcbnP11Q=", + "lastModified": 1748190013, + "narHash": "sha256-R5HJFflOfsP5FBtk+zE8FpL8uqE7n62jqOsADvVshhE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2795c506fe8fb7b03c36ccb51f75b6df0ab2553f", + "rev": "62b852f6c6742134ade1abdd2a21685fd617a291", "type": "github" }, "original": { diff --git a/modules/nixos-modules/ai.nix b/modules/nixos-modules/ai.nix index 8cc19ff..d8cd63d 100644 --- a/modules/nixos-modules/ai.nix +++ b/modules/nixos-modules/ai.nix @@ -16,10 +16,10 @@ type = lib.types.str; default = "ollama"; }; - # apiBase = lib.mkOption { - # type = lib.types.nullOr lib.types.str; - # default = null; - # }; + apiBase = lib.mkOption { + type = lib.types.str; + default = "http://localhost:11434"; + }; roles = lib.mkOption { type = lib.types.listOf (lib.types.enum [ "chat" @@ -40,7 +40,7 @@ }; config = { - # TODO: configure ollama to download any modules listed in options.host.ai.models.{name}.model if options.host.ai.models.{name}.apiBase is null - # TODO: if we have any models that have a non null options.host.ai.models.{name}.apiBase then set services.ollama.enable to a lib.mkAfter true + # TODO: configure ollama to download any modules listed in options.host.ai.models.{name}.model if options.host.ai.models.{name}.apiBase is localhost + # TODO: if we have any models that have a non localhost options.host.ai.models.{name}.apiBase then set services.ollama.enable to a lib.mkAfter true }; }