Cannot make `nixpkgs.overlays` work with `environment.systemPackages`

Building qemu, I want to skip GTK+3 support because that always pulls in tracker-3.0.3 which doesn’t build at all (due to #118155). So I’ve included this inside my /etc/nixos/configuration.nix:

nixpkgs.overlays = [
  ( self: super: {
      qemu = super.qemu.override {
        gtkSupport = false;
      };
    }
  )
];

qemu is pulled in via environment.systemPackages:

environment.systemPackages = with pkgs; [
  (lots of packages)
  qemu
  (lots more packages)
];

I’m sure it’s something very, very basic (like recursion), but the overlay I defined doesn’t “take” at all, and qemu is still built with GTK+3, pulling in the broken tracker-3.0.3. In other places inside Nixpkgs, gtkSupport does get overridden in various places, so I believe my approach should work. Where am I wrong?

Hi there, and welcome to the community!

Your code looks absolutely right.

There are two things we could do here.

  1. Verify it’s gtk pulling in tracker. Maybe it’s something else, too. You could try nix-tree for that.
nix-shell -p nix-tree --run nix-tree

Then press / to search for tracker, enter to select it, w to get a list of reverse dependencies.

  1. Since the underyling problem was already fixed, it may be worth a try using the unstable branch:
nixpkgs.overlays = [
 (self: super: {
    unstable = import (
      # you may want to pin it to a specific commit if you don't want automatic upgrades on each rebuild
      fetchTarball "https://github.com/NixOS/nixpkgs/archive/refs/heads/nixpkgs-unstable.tar.gz") {};
    )
  )
  (self: super: {  qemu = super.unstable.qemu;  })
];

Actually I did both steps in reverse order, because in that case you obviously the build is successful in the first place to be able to inspect dependencies.

Currently the channels don’t contain the new tracker yet. You can e.g. watch labels on tracker: 3.0.3 → 3.1.1 · NixOS/nixpkgs@4bf8895 · GitHub or just specify master or something.

@fricklerhandwerk @vcunat Thank you for your feedback! nix-tree looks like a nifty tool. Unfortunately, in my case, all dependency paths pulling in tracker ran through gtk+3 and qemu, so no extra enlightenment there.

I was already running unstable via git master, albeit a fetch that was a few days old. It pains me a little to say it, but making another fetch and rebasing against the origin updated qemu to 6.0.0 and tracker to 3.1.1, which resolved my issue. Since I had to temporarily downgrade binutils to build older kernels, I didn’t really mind having no prebuilt packages via channels since I had to rebuild the world for every change anyway.

Funnily enough, with the unrelated changes that come with any pull, my overlay started working, and qemu-6.0.0 got built without gtk. Oh well.

1 Like