Skip to content

Instantly share code, notes, and snippets.

@sampointer
Last active August 1, 2024 18:10
Show Gist options
  • Save sampointer/b506369b926ad395123aa7f18275de92 to your computer and use it in GitHub Desktop.
Save sampointer/b506369b926ad395123aa7f18275de92 to your computer and use it in GitHub Desktop.
NixOS Packages From Unstable alongside Stable (Google Chrome)

If you'd like to keep up-to-date with Chrome from unstable but otherwise want to run a stable NixOS release you can do the following:

  • Create a file /etc/nixos/unstable.nix:
{ config, pkgs, ...}:
let
  baseconfig = { allowUnfree = true; };
  unstable = import <nixos-unstable> { config = baseconfig; };
in {
  environment.systemPackages = with pkgs; [
    unstable.google-chrome
  ];
}
  • Modify /etc/nixos/configuration.nix:
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
      ./unstable.nix
    ];
  • Subscribe root to unstable:
sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable
sudo nix-channel --update
  • Ensure you have done everything correctly and then rebuild and switch:
sudo nixos-rebuild dry-build
sudo nixos-rebuild switch --upgrade

Log out and back in again

Gotchas

I had installed Chrome imperatively, which is used in preference. See if you have done this via:

nix-env -q
# remove with nix-env --uninstall
@JohnRTitor
Copy link

A question, does hardware acceleration work for you? What is the output of chrome://gpu ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment