Adding an option to a nixpackage

Hi there,

I want to modify a theme package (papirus-icon-theme) to enable the use of a tool provided by the papirus development team named papirus-folder.

I’ve added the tool to my nixpkgs and added an option to the original “papirus-icon-theme” package to enable the choice of the color. (https://github.com/aacebedo/nixpkgs/blob/7966cf9b26171a7b646511f75c63a7c1dda1ae62/pkgs/data/icons/papirus-icon-theme/default.nix). However I am unable to test the change of color with nix-env

When I run nix-env -f . -iA papirus-icon-theme --arg folderColor \"grey\" The package is always installed with the default value of the argument folderColor.

What am I missing here ?

--arg can only pass values to arguments of the outermost function, which for Nixpkgs is

imported from

Now, you can actually use that fact to pass an overlay that would add folderColor to pkgs to overlays attribute of Nixpkgs:

nix-env -f . -iA papirus-icon-theme --arg overlays '[ (final: prev: { folderColor = "grey"; }) ]'

which will make callPackage call inject the value to the expression.

But it is probably cleaner to use the -E flag to directly build a Nix expression that overrides the argument:

nix-env -f . -iE 'f: (f {}).papirus-icon-theme.override { folderColor = "grey"; }'

Or equivalently, you should be able to build the package and then install the resulting store path:

nix-env -i "$(nix-build  -E '(import ./. {}).papirus-icon-theme.override { folderColor = "grey"; }')"

Thank you it works !
I am going to PR the changes to add this option to nixpkgs.