How to try a PR

Good day,

3 day old Nixos newbie here…
How can I try a PR that has not yet been merged? I’m after this one:

I’ve tried following this guide :

(snippet from configuration.nix)

  nixpkgs.config = {
    packageOverrides = pkgs: {
      pr117102 = import (fetchTarball "") { config = config.nixpkgs.config; };

  environment.systemPackages = with pkgs; [

But nixos-rebuild switch complains about

error: attribute 'plasma5' missing at /etc/nixos/configuration.nix:125:5

Which is exactly the pr117102.plasma5 line.
Judging by the PR, I see that it changes module, not a package but not sure how config nixos to use the module source from the PR.

Any help will be greatly appreciated.

1 Like

Just leave your config as is and run

nixos-rebuild -I nixpkgs= ...

This PR is quite old though and still targets 20.09, so your configuration might need a little adaptation.


Thanks for replying.

Running this now and indeed it pulls bunch of older stuff which is not what I’m after.
In the one-before-last comment in the PR, they say ‘Plasma with Wayland works wonderfully here with latest unstable and this PR applied’.

I’m already on the latest unstable as of yesterday. How can I try the same setup? - the latest unstable + PR.

I would say the best way is to rebase PR against NixOS version you want and then run

nixos-rebuild -I nixpkgs= ...

I have written this page Nixpkgs/Reviewing changes - NixOS Wiki


Save this as nixpkgs-pr.nix

# Idea by Bas van Dijk (
{ pr }:
  pkgs = import <nixpkgs> {};
  patches = [
    (builtins.fetchurl {
      url = "${pr}.patch";
in pkgs.runCommand "nixpkgs-PR${pr}" { inherit patches; } ''
  cp -R ${pkgs.path} $out
  chmod -R +w $out
  for p in $patches; do
    echo "Applying patch $p"
    patch -d $out -p1 < "$p"

and then use

nixos-rebuild -I nixpkgs="$(nix-build nixpkgs-pr.nix --argstr pr 117102)" ...

Maybe this will become more ergonomic in the future:


Thanks everyone for the answers. Eventually @Artturin’s way worked.

What I did is forked current nixpkgs, cherry-picked the PR commit, and then used the tarball URL as per Artturin guide.

Simply passing my tarball URL as -I http... to nixos-rebuild... kept complaining that it can’t recognize new module options introduced by the PR.
So changing the configuration.nix file, besides actually working, has an additional benefit of freeing me from remembering to drag command line switches around.

The relevant snipped from my configuration.nix is below.

  # BEGIN plasma test
  disabledModules = [ "services/x11/desktop-managers/plasma5.nix" ];

  imports = let
    pkgsReview = builtins.fetchTarball {
      url = "";
    #pkgsReview = ../nixpkgs;
  in [
    (import "${pkgsReview}/nixos/modules/services/x11/desktop-managers/plasma5.nix")
  services.xserver.desktopManager.plasma5.runUsingSystemd = true;
  services.xserver.displayManager.sessionPackages = [
      (old: { passthru.providedSessions = [ "plasmawayland" ]; }))
  # END plasma test

@Artturin With your method (and this example) I’m only overriding a single plasma5 module, right? The rest of definition will be taken from the current nix channel, right?


Posts must be atleast 20 characters

Maybe an RFC has to be written to promote the proper solution (patching nix flake inputs) until somebody with the appropriate skills in C++ is willing to pick this up?

The possibilites of working around the root problem unfortunately are endless.

1 Like

by patching flake inputs i assume you mean nixos: fix cross-compiling by using buildPackages for build-time lndir by ju1m · Pull Request #142273 · NixOS/nixpkgs · GitHub