The solution provided in How to run ollama service from unstable channel seems not to work any longer. Ollama versions available are:
0.21 stable
0.22 unstable
0.23 (other Linux)
The attached (how to attach?) configuration.nix albeit set to unstable is still providing the stable version.
1 Like
configuration.nix has these elements w/o overrides in:
let
# Import the unstable channel
unstable = import { config = { allowUnfree = true; }; };
in
{
âŚ
\#https://wiki.nixos.org/wiki/Ollama
services.ollama = {
enable = true;
package = unstable.ollama-rocm;
loadModels = \[âgemma3:27b-it-qatâ\]; # gpt-oss, qwen3:8b-fp16, gemma3:27b-it-qat
##host = â0.0.0.0â;
##openFirewall = true;
##home = â\~/.ollamaâ;
##models = â\~/.ollama/modelsâ;
};
...
unstable.ollama-rocm
Any ideas what may be wrong or missing?
On the latest complete build of nixpkgs-unstable, ollama-rocm is failing to build on x86_64-linux.
Are you using that architecture? What version of nixpkgs-unstable are you using? What is the error that you are seeing?
Providing this information will help to determine whether the failing Hydra build is the reason that your set-up is failing.
Yes, precisely.
On listing the channels, no version number is provided for unstable https://nixos.org/channels/nixos-unstable
No error. It seems to fall back to the stable channel - at least:
ollama --version
ollama version is 0.21.1
In addition, I found an interesting thread Reddit - Please wait for verification but not able to follow all of it as still new to NixOS.
My solution looks something like this:
# flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { nixpkgs, nixpkgs-unstable, ... }@inputs:
let
system = "x86_64-linux"; # or your specific architecture
# This is the overlay logic
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
};
};
in {
# Please replace my-nixos with your hostname
nixosConfigurations.my-nixos = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
./services.nix
{
nixpkgs.overlays = [ overlay-unstable ];
}
];
};
};
}
#services.nix
{ config, lib, pkgs, unstable, inputs, ... }:
{
disabledModules = [ "services/misc/ollama.nix" ];
imports = [
"${inputs.nixpkgs-unstable}/nixos/modules/services/misc/ollama.nix"
];
services.ollama = {
package = unstable.ollama-cuda;
enable = true;
# Optional: preload models, see https://ollama.com/library
#acceleration = "cuda";
loadModels = [ "gemma4:e2b" "gemma4:e4b" ];
syncModels = true;
};
}
You can now install unstable packages with pkgs.unstable. example:
environment.systemPackages = [
pkgs.unstable.antigravity
];
I attempted to use that code but:
error: syntax error, unexpected LET, expecting INHERIT
at /etc/nixos/configuration.nix:12:5:
11| outputs = { nixpkgs, nixpkgs-unstable, ... }@inputs: {
12| let
| ^
13| system = "x86_64-linux"; # or your specific architecture
Command ânix-build â<nixpkgs/nixos>â --attr config.system.build.nixos-rebuild --no-out-linkâ returned non-zero exit status 1.
dyrkon
May 16, 2026, 11:09am
7
The let block is at the wrong level, this should work:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { nixpkgs, nixpkgs-unstable, ... }@inputs: let
system = "x86_64-linux"; # or your specific architecture
# This is the overlay logic
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
};
};
in
{
# Please replace my-nixos with your hostname
nixosConfigurations.my-nixos = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
./services.nix
{
nixpkgs.overlays = [ overlay-unstable ];
}
];
};
};
}
1 Like
@dyrkon thanks for the catch. I edited my original comment.
1 Like
It goes through the changed block but now falls over at:
error: syntax error, unexpected ',', expecting '.' or '='
at /etc/nixos/configuration.nix:36:9:
35| #services.nix
36| { config, lib, pkgs, unstable, inputs, ... }:
| ^
37|
Command 'nix-build '<nixpkgs/nixos>' --attr config.system.build.nixos-rebuild --no-out-link' returned non-zero exit status 1.
ng0177
May 16, 2026, 2:06pm
10
Here is the entire first portion of configuration.nix:
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ânixos-helpâ).
# flake.nix
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
};
outputs = { nixpkgs, nixpkgs-unstable, ... }@inputs: let
system = "x86_64-linux"; # or your specific architecture
# This is the overlay logic
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable {
inherit system;
config.allowUnfree = true;
};
};
in
{
# Please replace my-nixos with your hostname
nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
./services.nix
{
nixpkgs.overlays = [ overlay-unstable ];
}
];
};
};
}
#services.nix
{ config, lib, pkgs, unstable, inputs, ... }:
{
disabledModules = [ "services/misc/ollama.nix" ];
imports = [
"${inputs.nixpkgs-unstable}/nixos/modules/services/misc/ollama.nix"
];
#https://wiki.nixos.org/wiki/AMD_GPU
hardware.graphics = {
enable = true;
enable32Bit = true;
};
#https://wiki.nixos.org/wiki/Ollama
services.ollama = {
package = unstable.ollama-rocm;
enable = true;
# Optional: preload models, see https://ollama.com/library
#acceleration = "cuda";
loadModels = [ "gemma3:27b-it-qat" ];
syncModels = true;
};
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
Everything after #services .nix should be in a separate file named services.nix
1 Like
sorry my configuration works for flakes not for the ânormalâ nixos setup.
you need to follow this guide: Enabling NixOS with Flakes | NixOS & Flakes Book to enable flakes.
and the config is in multiple files it looks to me like you have the code in the same file.
the comment flake.nix meant that this is the file name and the same for services.nix
ng0177
May 16, 2026, 3:10pm
13
As there seems to be now way with my original non-flakes setup that initially worked (How to run ollama service from unstable channel ), I will have to indulge into flakes. Thanks for the link!
As it originally worked, based on my reading of the recent changes to unstable and nixos-25.11, nothing has changed that should break your original setup.
The main difference between your old configuration and the flakes based one proposed above is that it is also using the service definition for ollama from nixos-unstable.
I was under the impression that you were using the nixpkgs-unstable channel for your unstable packages rather than the nixos-unstable channel. Nonetheless, the latest nixos-unstable channel has a user-cancelled build status for ollama-rocm.
This sounds like an issue with your channels being out of date. Although if you updated them now I would expect you to get a cache hit triggering a local build.
ng0177
May 17, 2026, 12:00pm
15
This is good know and hopefully will not lead to any problems in the future.
I was not aware of that. Interestingly whilst updating nixos-unstable also nixpkgs-unstable seem to have been updated.
Indeed, it took about 1-2 hours to build.
ng0177
May 17, 2026, 12:06pm
16
The question is whether the original setup using nixpkgs-unstable will update automatically as soon as a new ollama-rocm is available in nixpkgs-unstable. And also, if the flakes-based setup would do. Either way, this should be what most users expect.
This is not the default. On both channels and flakes you have to manually trigger an update.
There are multiple ways to implement automatic updates; the wiki documents one way.
1 Like
ng0177
May 18, 2026, 5:26pm
18
A link to the relevant section in the documentation should be added to the Wiki.
ng0177
May 18, 2026, 5:30pm
19
I have:
system.autoUpgrade.enable = true;
system.autoUpgrade.allowReboot = true;
nix.gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 1d";
};
It looks like the default frequency is not sufficient to provide every few weeks a new ollama version in nixos-unstable.
@ng0177 from the documentation i gathered that:
system.autoUpgrade.enable = true;
image
runs nixos-rebuild switch --upgrade but this doesnât update your unstable channel.
If you read in man nixos-rebuild what the --upgrade flag does:
image
you will see that it doesnât upgrade your unstable channel only your nixos channel.
I think you need to change it to something like this:
system.autoUpgrade = {
enable = true;
# add the --upgrade-all flag
flags = [
"--upgrade-all"
];
allowReboot = true;
};
1 Like