changed formatting for ollama.nix to wrap all of configurations in its enable option
This commit is contained in:
parent
393f468be2
commit
089fbb8717
1 changed files with 28 additions and 25 deletions
|
@ -7,35 +7,38 @@
|
||||||
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 = {
|
{
|
||||||
# TODO: these should match whats set in the users file
|
services.ollama = {
|
||||||
group = "ollama";
|
# TODO: these should match whats set in the users file
|
||||||
user = "ollama";
|
group = "ollama";
|
||||||
};
|
user = "ollama";
|
||||||
}
|
};
|
||||||
(lib.mkIf config.host.impermanence.enable (lib.mkIf config.services.ollama.enable {
|
}
|
||||||
environment.persistence."/persist/system/root" = {
|
(lib.mkIf config.services.ollama.exposePort (let
|
||||||
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 {
|
||||||
lib.mkIf config.services.ollama.exposePort {
|
networking.firewall.interfaces.${config.services.tailscale.interfaceName} = {
|
||||||
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;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue