Can't switch back to stable w/ flakes

Hi, so a while ago I set up an hybrid flake to have both stable and unstable pkgs with unstable as main, recently I had problems with the audio not working after an update so I decided to go back to stable, I modified the flake but when I rebuilt it gave me this error

error: path ‘/nix/store/whpmnfw6wj42iy2r38i53kfiqd84mfw7-source/lib/services/lib.nix’ does not exist

So I went to the github out of curiosity and it seems that lib/services/lib.nix exists only in unstable, anyway sudo nix-channel –list says I am using 25.11 and my home-manager does to.

I already tried sudo git add ., nix-store --gc, sudo nix flake update, I also tried adding the unstable branch again but as secondary but it didn’t work, also any unstable packages I had I removed them, other than that the configuration.nix remains untouched from before so I don’t think there is a problem there, here is the flake.nix:

{

  description = "flake";

  inputs = {
    nixpkgs.url = "nixpkgs/nixos-25.11";
    nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, nixpkgs-unstable, home-manager, ... }@inputs:
  let
    system = "x86_64-linux";
    lib = nixpkgs.lib;
    pkgs = nixpkgs.legacyPackages.${system};
    pkgs-unstable = nixpkgs-unstable.legacyPackages.${system};
  in
  {
    nixosConfigurations = {
      nixos = lib.nixosSystem {
        inherit system;
        modules = [ 
	  ./configuration.nix
	  home-manager.nixosModules.home-manager
	  {
	    home-manager = {
	      useUserPackages = true;
	      useGlobalPkgs = true;
	      backupFileExtension = "backup";
	      users.fra = ./home.nix;
	    };
	  }
        ];
	specialArgs = {
	  inherit pkgs-unstable;
	};
      };
    };
  };
}

honestly I have no idea of what could possibly be the problem, I didn’t find anything on google. Pls help :folded_hands:

You have to use the right home-manager branch for your nixpkgs branch. For nixos-unstable, that’s just the default home-manager branch. For nixos-25.11, that’s the release-25.11 home-manager branch.

1 Like

I want to additionally note that even though home-manager’s branch is called release-xx.xx, you should never use the NixOS branches with the release-xx.xx name; those are unbuilt precursors to the nixos-xx.xx branches.

I know this is tangential and @ElvishJerricco didn’t say anything about NixOS branches, but it’s easy to get confused by this and I want to preempt that. Unfortunate naming, really.

Honestly, you might as well just stay on unstable, because nixos-26.05 will come out in a week and nixos-25.11 will be deprecated.

1 Like

thanks, that worked :+1: