Install Packages from NixOS Unstable on Stable Channel: Easy Guide
2 min read
6 months ago
Published on Jun 03, 2024
This response is partially generated with the help of AI. It may contain inaccuracies.
Table of Contents
How to Install Packages from NixOS Unstable on Stable Channel
Step 1: Check Current Channel
- Open a terminal window.
- Run the command
sudo nix-channel --list
to confirm that you are on the stable channel (e.g., nios 23.11).
Step 2: Find Package Versions
- Visit the n.org website and search for the package you want to install (e.g., Go).
- Note the version available on the stable channel (e.g., 1.121.9) and the version on the unstable channel.
Step 3: Edit Configuration File
- Open the Nix configuration file using the command
sudo vi /etc/nixos/configuration.nix
. - Locate the section with config and packages.
- Add the following lines:
let unstable = { Channel = "unstable"; };
- Save the configuration file.
Step 4: Install Package from Unstable Channel
- In the configuration file, find the section for system packages.
- Replace the stable version with the unstable version by changing
go
tounstable.go
. - Save the changes to the file.
Step 5: Update Channels
- Run
sudo nix-channel --update unstable
to add the unstable channel to the Nix search path. - If you encounter an error, run
sudo nix-channel --update
to fix it.
Step 6: Update Channels and Packages
- Run
sudo nixos-rebuild switch
to update the channels and packages. - If needed, run
sudo nixos-rebuild switch --upgrade
to ensure all packages are updated.
Step 7: Verify Installation
- Run
go version
to confirm that you are now using the latest version of the package from the unstable channel.
By following these steps, you can easily install packages from the NixOS unstable channel on the stable channel of your system.