Translations:FAQ/117/en

From NixOS Wiki

This only changes what version of PACKAGE_NAME is available on $PATH. If the package you want to take from unstable is installed through a NixOS module, you must use overlays:

{ config, pkgs, ... }:
let
  unstable = import <nixos-unstable> {};
in {
  nixpkgs.overlays = [
    (self: super: {
       PACKAGE_NAME = unstable.PACKAGE_NAME;
    })
  ];
}

Note that this will rebuild all packages depending on the overlaid package, which may be a lot. Some modules offer a services.foo.package to change the actual derivation used by the module without and overlay, and without recompiling dependencies (example).