Use unstable ollama-cuda and pin gemma4:e4b

This commit is contained in:
ltadeu6 2026-04-12 11:49:34 -03:00
parent 2e5565d2de
commit a72accde1a
4 changed files with 47 additions and 5 deletions

19
flake.lock generated
View file

@ -179,6 +179,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs-unstable": {
"locked": {
"lastModified": 1775710090,
"narHash": "sha256-ar3rofg+awPB8QXDaFJhJ2jJhu+KqN/PRCXeyuXR76E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "4c1018dae018162ec878d42fec712642d214fdfa",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1767364772, "lastModified": 1767364772,
@ -232,7 +248,8 @@
"agenix": "agenix", "agenix": "agenix",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"nix-openclaw": "nix-openclaw", "nix-openclaw": "nix-openclaw",
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_4",
"nixpkgs-unstable": "nixpkgs-unstable"
} }
}, },
"systems": { "systems": {

View file

@ -3,6 +3,7 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-25.11"; url = "github:nix-community/home-manager/release-25.11";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -11,7 +12,7 @@
nix-openclaw.url = "github:openclaw/nix-openclaw"; nix-openclaw.url = "github:openclaw/nix-openclaw";
}; };
outputs = { self, nixpkgs, home-manager, agenix, nix-openclaw, ... }: outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, agenix, nix-openclaw, ... }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
in { in {
@ -21,7 +22,17 @@
modules = [ modules = [
./hosts/Nixos/configuration.nix ./hosts/Nixos/configuration.nix
agenix.nixosModules.default agenix.nixosModules.default
{ nixpkgs.overlays = [ nix-openclaw.overlays.default ]; } {
nixpkgs.overlays = [
nix-openclaw.overlays.default
(final: prev: {
unstable = import nixpkgs-unstable {
inherit system;
config = prev.config;
};
})
];
}
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;

View file

@ -349,7 +349,7 @@
id = "OPENCLAW_GATEWAY_TOKEN"; id = "OPENCLAW_GATEWAY_TOKEN";
}; };
agents.defaults.model.primary = "ollama/qwen2.5:3b"; agents.defaults.model.primary = "ollama/gemma4:e4b";
models.providers.ollama = { models.providers.ollama = {
baseUrl = "http://127.0.0.1:11434"; baseUrl = "http://127.0.0.1:11434";
api = "ollama"; api = "ollama";

View file

@ -43,6 +43,14 @@
}; };
}; };
nix.settings = {
# CUDA builds are heavy; use a binary cache to avoid local compilation.
substituters = lib.mkAfter [ "https://cache.nixos-cuda.org" ];
trusted-public-keys = lib.mkAfter [
"cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M="
];
};
powerManagement.cpuFreqGovernor = "performance"; powerManagement.cpuFreqGovernor = "performance";
# Bootloader. # Bootloader.
boot = { boot = {
@ -248,10 +256,16 @@
}; };
ollama = { ollama = {
enable = true; enable = true;
# Nixpkgs' plain `ollama` is typically CPU-only; use the CUDA variant on NVIDIA.
package = pkgs.unstable.ollama-cuda;
acceleration = "cuda"; acceleration = "cuda";
host = "[::]"; host = "[::]";
environmentVariables = {
# Lower default context to keep KV cache smaller (faster + more likely to stay on GPU).
OLLAMA_CONTEXT_LENGTH = "8192";
};
loadModels = [ loadModels = [
"qwen2.5:3b" "gemma4:e4b"
]; ];
syncModels = true; syncModels = true;
# listenAddress = "10.0.0.2:11434"; # listenAddress = "10.0.0.2:11434";