Compare commits
No commits in common. "3fcd8f0244ad2df3389db26560acfec6bb1c81a6" and "0a7bbdbc8f63213a784b4e95a0e14cf24a6ef709" have entirely different histories.
3fcd8f0244
...
0a7bbdbc8f
1 changed files with 25 additions and 35 deletions
|
@ -7,45 +7,35 @@
|
||||||
services.ollama.exposePort = lib.mkEnableOption "should we expose ollama on tailscale";
|
services.ollama.exposePort = lib.mkEnableOption "should we expose ollama on tailscale";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf config.services.ollama.enable (
|
config = lib.mkMerge [
|
||||||
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
|
group = "ollama";
|
||||||
group = "ollama";
|
user = "ollama";
|
||||||
user = "ollama";
|
};
|
||||||
};
|
}
|
||||||
}
|
(lib.mkIf config.host.impermanence.enable (lib.mkIf config.services.ollama.enable {
|
||||||
(lib.mkIf config.services.ollama.exposePort (let
|
environment.persistence."/persist/system/root" = {
|
||||||
|
enable = true;
|
||||||
|
hideMounts = true;
|
||||||
|
directories = [
|
||||||
|
{
|
||||||
|
directory = config.services.ollama.models;
|
||||||
|
user = config.services.ollama.user;
|
||||||
|
group = config.services.ollama.group;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
networking.firewall.interfaces.${config.services.tailscale.interfaceName} = let
|
||||||
ports = [
|
ports = [
|
||||||
config.services.ollama.port
|
config.services.ollama.port
|
||||||
];
|
];
|
||||||
in {
|
in
|
||||||
networking.firewall.interfaces.${config.services.tailscale.interfaceName} = {
|
lib.mkIf config.services.ollama.exposePort {
|
||||||
allowedTCPPorts = ports;
|
allowedTCPPorts = ports;
|
||||||
allowedUDPPorts = ports;
|
allowedUDPPorts = ports;
|
||||||
};
|
};
|
||||||
}))
|
}))
|
||||||
(lib.mkIf config.host.impermanence.enable {
|
];
|
||||||
environment.persistence."/persist/system/root" = {
|
|
||||||
enable = true;
|
|
||||||
hideMounts = true;
|
|
||||||
directories = [
|
|
||||||
{
|
|
||||||
directory = config.services.ollama.models;
|
|
||||||
user = config.services.ollama.user;
|
|
||||||
group = config.services.ollama.group;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
directory = "/var/lib/private/ollama";
|
|
||||||
user = config.services.ollama.user;
|
|
||||||
group = config.services.ollama.group;
|
|
||||||
mode = "0700";
|
|
||||||
defaultPerms.mode = "0700";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue