How to upgrade to unstable branch, with flakes?

I am currently on the stable 23.11 branch, and I want to try the unstable branch, just in order to generally get newer packages. I have flakes enabled.
Is there a best or a recommended way to do this?

1 Like

if I understood your question correctly, here is how I did the switch:

From:

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";

    # omitting several configurations...
  };

To:

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    # omitting several configurations...
  };
1 Like

If your systems configuration is a flake, just change the nixpkgs inputs URL accordingly, it is still relies on the nix path, make sure roots nixos channel points to the unstable channel.

Having “flakes enabled” does say nothing about the format of your system config. As your system config can be flake without having them enabled otherwise, as similarily flakes can be enabled but still everything being channel based.

1 Like

Damn, we answered an the same time :slight_smile:

2 Likes

How would I go about doing that?

nix-channel --add …, no clue about the details, as I am not using channels anymore for a couple of years

Okay so I did
sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos
and
sudo nixos-rebuild switch --upgrade

and in my config I did
system.stateVersion = "unstable";

But my config does not even have this whole section that you are talking about:

inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";

    # omitting several configurations...
  };
1 Like

Can you share the inputs of your flakes?

As the comment in the config says:

  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It's perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).

You don’t need to change system.StateVersion

1 Like

I didn’t need to do that in my flakes config to change from 23.11 to unstable

Hi, sorry I didn’t get back about this. It’s a very different time zone here. So I see my mistake now. The code snippet you suggested is for flake.nix, not for configuration.nix. I will try it out…

This was not done in any config file. It was simply commands that I ran in terminal, in order to get on the unstable channel.

I still didn’t need that

So how did you make make sure roots nixos channel points to the unstable channel?

I just really didn’t and my system upgraded to unstable using flakes, but later on I did the channels just to have piece of mind but I guess it only makes a difference if you install packages using nix-env.

1 Like