Last active
September 2, 2025 20:07
-
-
Save LnL7/e645b9075933417e7fd8f93207787581 to your computer and use it in GitHub Desktop.
NixOS configuration overlays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { config, pkgs, ... }: | |
| let | |
| # Import unstable channel. | |
| # sudo nix-channel --add http://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable | |
| # sudo nix-channel --update nixpkgs-unstable | |
| unstable = import <nixpkgs-unstable> {}; | |
| in | |
| { | |
| environment.systemPackages = | |
| [ pkgs.hello # regular channel | |
| unstable.spotify # newer version from nixpkgs-unstable | |
| ]; | |
| virtualisation.libvirtd.enable = true; | |
| nixpkgs.overlays = | |
| [ (self: super: | |
| { | |
| # override with newer version from nixpkgs-unstable | |
| qemu = unstable.qemu; | |
| # custom package that depends on hello from nixpkgs-unstable | |
| foo = super.callPackage ./pkgs/foo { inherit (unstable) hello; }; | |
| }) | |
| ]; | |
| } |
It might be possible to bring in unstable.qemu with dependencies satisfied from pkgs using override attribute of package.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just adding that you can also use a local copy of either
nixpkgsornixpkgs-unstable(or both at the same time) by passing in-I nipkgs=/path/to/stable/fork -I nixpkgs-unstable=/path/to/unstable/forkto any of the tools.nixos-rebuildfor instance.