How do I use the options specified in a package definition?

I’d like to use the dwl compositor, and like dwm, it’s supposed to be patched, or at least I want to modify the config.def.h file which controls most settings.
I looked through the package on nixpkgs-unstable ( and it has some options for specifying a custom config.h:

# Allow users to set an alternative config.def.h
  postPatch = let
    configFile = if lib.isDerivation conf || builtins.isPath conf
                 then conf
                 else writeText "config.def.h" conf;
  in lib.optionalString (conf != null) "cp ${configFile} config.def.h";

How do I use this option in my NixOS configuration?

You override it, pass the config in then, and use the overridden version in your system.

1 Like

Since it looks like you’re new, I’ll spell it out a bit more by pointing you to the relevant parts of the manual. :slight_smile:

Check out the Nixpkgs manual sections on

and you can find some more overlays examples here.