mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat(access): a llama
This commit is contained in:
parent
e3b6048e32
commit
7bf1ce71de
14 changed files with 323 additions and 6 deletions
|
|
@ -60,6 +60,7 @@ let
|
|||
(mkIf (cfg.id != null) (mkAlmostOptionDefault (access.systemForServiceId cfg.id).name))
|
||||
(mkOptionDefault (mapNullable (serviceName: (access.systemForService serviceName).name) cfg.name))
|
||||
];
|
||||
network = mkIf (port.listen == "tail") (mkAlmostOptionDefault "tail");
|
||||
};
|
||||
conf = {
|
||||
enable = lib.warnIf (!port.enable) "${cfg.system}.exports.services.${cfg.name}.ports.${cfg.port} isn't enabled" (
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
gensokyo-zone,
|
||||
...
|
||||
}: let
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault bindToAddress;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf mkMerge mkBefore mkAfter mkOptionDefault mkDefault;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
|
|
@ -296,10 +296,7 @@ in {
|
|||
upstreams' = let
|
||||
localVouch = let
|
||||
inherit (vouch-proxy.settings.vouch) listen port;
|
||||
host =
|
||||
if listen == "0.0.0.0" || listen == "[::]"
|
||||
then "localhost"
|
||||
else listen;
|
||||
host = bindToAddress {localhost = "localhost";} listen;
|
||||
in {
|
||||
# TODO: accessService.exportedId = "login";
|
||||
enable = mkAlmostOptionDefault vouch-proxy.enable;
|
||||
|
|
|
|||
30
modules/system/exports/ollama.nix
Normal file
30
modules/system/exports/ollama.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
lib,
|
||||
gensokyo-zone,
|
||||
...
|
||||
}: let
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
|
||||
inherit (lib.modules) mkIf;
|
||||
in {
|
||||
config.exports.services.ollama = {config, ...}: {
|
||||
displayName = mkAlmostOptionDefault "Ollama";
|
||||
id = mkAlmostOptionDefault "ollama";
|
||||
nixos = {
|
||||
serviceAttr = "ollama";
|
||||
assertions = mkIf config.enable [
|
||||
(nixosConfig: {
|
||||
assertion = config.ports.default.port == nixosConfig.services.ollama.port;
|
||||
message = "port mismatch";
|
||||
})
|
||||
];
|
||||
};
|
||||
defaults.port.listen = mkAlmostOptionDefault "lan";
|
||||
ports = {
|
||||
default = {
|
||||
port = mkAlmostOptionDefault 11434;
|
||||
protocol = "http";
|
||||
status.enable = mkAlmostOptionDefault true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
else config.name;
|
||||
};
|
||||
listen = mkOption {
|
||||
type = enum ["wan" "lan" "int" "localhost"];
|
||||
type = enum ["wan" "lan" "int" "tail" "localhost"];
|
||||
};
|
||||
protocol = mkOption {
|
||||
type = nullOr (enum ["http" "https"]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue