I was trying to make GIMP
use xsane
. Set everything up, followed the documentation to the letter. xsane
nowhere to be found. Added xsaneGimp
to packages:
environment.systemPackages = with pkgs; [
...
xsaneGimp
...
];
Now got an error “xsaneGimp not found”. Tried all kinds of tricks, like pkgs.xsaneGimp
etc., no luck. Still don’t understand why.
Finally, with a lot of help from Claude, got it working with:
let
# Create a new package set with our overlay applied
system = pkgs.system; # Get the system from pkgs instead
customPkgs = import inputs.nixpkgs-unstable {
inherit system;
overlays = [
(final: prev: {
xsaneGimp = upkgs.xsane.override { gimpSupport = true; };
})
];
};
in
{
...
environment.systemPackages = with pkgs; [
...
customPkgs.xsaneGimp
...
];
...
};
Can anyone explain why the method recommended in the docs doesn’t work?
Well to be clear, that’s the dead wiki (the current one is wiki.nixos.org), and wikis are inherently not documentation but just the ramblings of random people on the internet (like me right now
). Caveat emptor.
Secondly, the wiki article itself says to use
nixpkgs.config.packageOverrides = pkgs: {
xsaneGimp = pkgs.xsane.override { gimpSupport = true; };
};
packageOverrides
is (loosely) the deprecated version of overlays. What an overlay does is modify the nixpkgs instance to set the value for a given attribute within that instance - and it propagates to anything that uses that attribute in that instance. For example, if you want to patch openssl
for all packages, then an overlay makes sense.
So, just adding pkgs.xsaneGimp
to your package list without the overlay would of course not work, since nixpkgs has no such attribute at the top-level called xsaneGimp
.
Finally, LLMs are downright insane and tend to give awful solutions for nix.
I’d say both the LLM and the wiki are providing suboptimal solutions here; both are increasing your eval time for basically no reason, and the LLM is far worse because it’s creating an entire second instance of nixpkgs - the biggest piece of nix code you will work with - just to get one package from it.
Really what you should do here is not use any overlay at all, because you’re overriding a leaf package (not a dependency) which can be done at point-of-use. So get rid of all of your xsane-related overlays, the let
block, etc and use this instead:
environment.systemPackages = with pkgs; [
(xsane.override { gimpSupport = true; })
];
Thank you.
P.S. One can only dream of proper documentation 