moves ollama to it's own service file

This commit is contained in:
Menno van Leeuwen 2024-11-05 20:53:11 +01:00
parent c0626c9d27
commit 309a2a1f35
Signed by: vleeuwenmenno
SSH Key Fingerprint: SHA256:OJFmjANpakwD3F2Rsws4GLtbdz1TJ5tkQF0RZmF0TRE
8 changed files with 132 additions and 94 deletions

View File

@ -0,0 +1 @@
{ ... }: { }

View File

@ -0,0 +1,4 @@
{ pkgs-unstable, ... }:
{
home.packages = with pkgs-unstable; [ ollama ];
}

View File

@ -0,0 +1,4 @@
{ pkgs-unstable, ... }:
{
home.packages = with pkgs-unstable; [ ollama-rocm ];
}

View File

@ -0,0 +1,4 @@
{ pkgs-unstable, ... }:
{
home.packages = with pkgs-unstable; [ ollama-cuda ];
}

View File

@ -0,0 +1,4 @@
{ pkgs-unstable, ... }:
{
home.packages = with pkgs-unstable; [ ollama-cuda ];
}

View File

@ -0,0 +1,27 @@
{
config,
pkgs,
pkgs-unstable,
...
}:
{
# Ollama will be installed in the hosts/ configuration depending on what the host is of this system
# If none is registered, the fallback will be used which installs ollama without GPU acceleration support.
systemd.user.services.ollama = {
Unit = {
Description = "Ollama Service";
After = [ "network.target" ];
};
Service = {
# This resolves to for example: /home/menno/.nix-profile/bin/ollama
ExecStart = "${config.home.profileDirectory}/bin/ollama serve";
Restart = "always";
RestartSec = "10";
};
Install = {
WantedBy = [ "default.target" ];
};
};
}

View File

@ -4,21 +4,19 @@
hostname, hostname,
... ...
}: }:
let
hostSpecificPackages =
if hostname == "mennos-gamingpc" then
with pkgs-unstable; [ ollama-rocm ]
else if hostname == "mennos-laptop" then
with pkgs-unstable; [ ollama-cuda ]
else if hostname == "mennos-server" then
with pkgs-unstable; [ ollama-cuda ]
else
with pkgs-unstable; [ ollama ];
in
{ {
home.packages = # Import host-specific packages
with pkgs; imports =
[ if hostname == "mennos-gamingpc" then
[ ./hosts/mennos-gamingpc.nix ]
else if hostname == "mennos-laptop" then
[ ./hosts/mennos-laptop.nix ]
else if hostname == "mennos-server" then
[ ./hosts/mennos-server.nix ]
else
[ ./hosts/fallback.nix ];
home.packages = with pkgs; [
# General packages # General packages
git git
gnupg gnupg
@ -103,6 +101,5 @@ in
cmatrix cmatrix
figlet figlet
lolcat lolcat
] ];
++ hostSpecificPackages;
} }

View File

@ -1,4 +1 @@
{ config, pkgs, ... }: { config, pkgs, ... }: { }
{
}