From 025eaa935a3fe46ad594bed1c24d00c2c22fce23 Mon Sep 17 00:00:00 2001 From: Leyla Becker Date: Sun, 22 Jun 2025 18:48:59 -0500 Subject: [PATCH 1/2] enabled ollama on defiant --- configurations/nixos/defiant/configuration.nix | 2 +- modules/nixos-modules/ollama.nix | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/configurations/nixos/defiant/configuration.nix b/configurations/nixos/defiant/configuration.nix index 4f900c6..0b9d1b7 100644 --- a/configurations/nixos/defiant/configuration.nix +++ b/configurations/nixos/defiant/configuration.nix @@ -212,7 +212,7 @@ }; ollama = { - enable = false; + enable = true; exposePort = true; loadModels = [ diff --git a/modules/nixos-modules/ollama.nix b/modules/nixos-modules/ollama.nix index 9507190..a29a9aa 100644 --- a/modules/nixos-modules/ollama.nix +++ b/modules/nixos-modules/ollama.nix @@ -28,23 +28,19 @@ }; })) (lib.mkIf config.host.impermanence.enable { + # TODO: move this somewhere common + systemd.tmpfiles.rules = [ + "d /var/lib/private 0700 root root" + ]; 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; - mode = "0700"; - defaultPerms.mode = "0700"; - } { directory = "/var/lib/private/ollama"; user = config.services.ollama.user; group = config.services.ollama.group; mode = "0700"; - defaultPerms.mode = "0700"; } ]; }; From b7cfcfef7db3553009d355ea74eccf18f3b7a784 Mon Sep 17 00:00:00 2001 From: Leyla Becker Date: Sun, 22 Jun 2025 20:10:25 -0500 Subject: [PATCH 2/2] limit zfs arc to 50gb --- configurations/nixos/defiant/configuration.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configurations/nixos/defiant/configuration.nix b/configurations/nixos/defiant/configuration.nix index 0b9d1b7..7d9c6d8 100644 --- a/configurations/nixos/defiant/configuration.nix +++ b/configurations/nixos/defiant/configuration.nix @@ -192,6 +192,9 @@ }; }; + # limit arc usage to 50gb because ollama doesn't play nice with zfs using up all of the memory + boot.kernelParams = ["zfs.zfs_arc_max=53687091200"]; + services = { # TODO: move zfs scrubbing into module zfs = { @@ -215,6 +218,8 @@ enable = true; exposePort = true; + acceleration = false; + loadModels = [ # conversation models "llama3.1:8b"