Use this guide if you want to keep your NixOS on the stable branch, but enable unstable application packages. It took me a while to figure out how to do this, so I wanted to share because it ended up being far easier than most of the vague explanations online made it seem.
I put a sample configuration.nix file at the very bottom to help it make more sense for new users. Remember to keep a backup of your config file, just in case!
If there are any errors please let me know. I am currently running NixOS 24.11.
Steps listed in this guide:
- Add the unstable channel to NixOS as a secondary channel.
- Edit the configuration.nix to enable unstable applications.
- Add "unstable." in front of the application names in the config file (example: unstable.program). This enables the install of unstable versions during the build.
- Rebuild.
Step 1:
- Open the console. (If you want to see which channels you currently have, type: sudo nix-channel --list)
- Add the unstable channel, type: sudo nix-channel --add channels.nixos.org/nixpkgs-unstable unstable
- To update the channels (bring in the possible apps), type: sudo nix-channel --update
More info here: nixos.wiki/wiki/Nix_channels
Step 2:
Edit your configuration.nix and add the following around your current config:
{ config, pkgs, lib, ... }:
let
unstable = import <unstable> { config = { allowUnfree = true; }; };
in {
#insert normal configuration text here
} #remember to close the bracket!
At this point it would be good to save your config and try a rebuild to make sure there are no errors. If you have errors, make sure your brackets are in the right places and/or not missing. This step will make for less troubleshooting later on if something happens to be in the wrong spot!
Step 3:
Add "unstable." to the start of each application you want to use the unstable version. (Example: unstable.brave)
Step 4:
Rebuild your config, type: sudo nixos-rebuild switch
Example configuration.nix file:
# Config file for NixOS
{ config, pkgs, lib, ... }:
#Enable unstable apps from Nix repository.
let
unstable = import <unstable> { config = { allowUnfree = true; }; };
in {
#Put your normal config entries here in between the tags. Below is what your applications list needs to look like.
environment.systemPackages = with pkgs; [
appimage-run
blender
unstable.brave #Just add unstable. before the application name to enable the unstable version.
chirp
discord
];
} # Don't forget to close bracket at the end of the config file!
That should be all. Hope it helps.
