Compare commits
3 commits
0a7bbdbc8f
...
3fcd8f0244
Author | SHA1 | Date | |
---|---|---|---|
3fcd8f0244 | |||
60f8b0265a | |||
089fbb8717 |
1 changed files with 35 additions and 25 deletions
|
@ -7,7 +7,8 @@
|
||||||
services.ollama.exposePort = lib.mkEnableOption "should we expose ollama on tailscale";
|
services.ollama.exposePort = lib.mkEnableOption "should we expose ollama on tailscale";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkIf config.services.ollama.enable (
|
||||||
|
lib.mkMerge [
|
||||||
{
|
{
|
||||||
services.ollama = {
|
services.ollama = {
|
||||||
# TODO: these should match whats set in the users file
|
# TODO: these should match whats set in the users file
|
||||||
|
@ -15,7 +16,17 @@
|
||||||
user = "ollama";
|
user = "ollama";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(lib.mkIf config.host.impermanence.enable (lib.mkIf config.services.ollama.enable {
|
(lib.mkIf config.services.ollama.exposePort (let
|
||||||
|
ports = [
|
||||||
|
config.services.ollama.port
|
||||||
|
];
|
||||||
|
in {
|
||||||
|
networking.firewall.interfaces.${config.services.tailscale.interfaceName} = {
|
||||||
|
allowedTCPPorts = ports;
|
||||||
|
allowedUDPPorts = ports;
|
||||||
|
};
|
||||||
|
}))
|
||||||
|
(lib.mkIf config.host.impermanence.enable {
|
||||||
environment.persistence."/persist/system/root" = {
|
environment.persistence."/persist/system/root" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
|
@ -25,17 +36,16 @@
|
||||||
user = config.services.ollama.user;
|
user = config.services.ollama.user;
|
||||||
group = config.services.ollama.group;
|
group = config.services.ollama.group;
|
||||||
}
|
}
|
||||||
];
|
{
|
||||||
};
|
directory = "/var/lib/private/ollama";
|
||||||
networking.firewall.interfaces.${config.services.tailscale.interfaceName} = let
|
user = config.services.ollama.user;
|
||||||
ports = [
|
group = config.services.ollama.group;
|
||||||
config.services.ollama.port
|
mode = "0700";
|
||||||
];
|
defaultPerms.mode = "0700";
|
||||||
in
|
}
|
||||||
lib.mkIf config.services.ollama.exposePort {
|
];
|
||||||
allowedTCPPorts = ports;
|
};
|
||||||
allowedUDPPorts = ports;
|
})
|
||||||
};
|
]
|
||||||
}))
|
);
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue