Nix develop to hack on an existing package

Hey!

I would like to hack on an existing package. For example nixpkgs#polybar. I use nix develop nixpkgs#polybar --unpack to get the source code. No problem. I go to the source directory. Then I run nix develop nixpkgs#polybar --configure and I get:

 10:35 ❱ nix develop nixpkgs#polybar --configure
no configure script, doing nothing

Am I missing something? It should use cmake, but it does not.

Also, how should I override the base derivation? For example, I would like to set i3Support to true. I was able to use:

 10:41 ❱ nix develop --impure --expr '(builtins.getFlake "nixpkgs").outputs.legacyPackages.x86_64-linux.polybar.override { pulseSupport = true; i3GapsSupport = true; }' -c $SHELL

Is there anything easier?

The typical approach (afaik, I don’t do a lot of this) would be to git clone the source manually, enter the directory, and run nix develop nixpkgs#polybar. Then you can invoke the build system directly or run various phases (skip unpackPhase though) as you please, from the shell that creates.

2 Likes