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
{ # We put legacy `system` into `localSystem`, if `localSystem` was not passed.
# If neither is passed, assume we are building packages on the current
# (build, in GNU Autotools parlance) platform.
localSystem ? { system = args.system or builtins.currentSystem; }
# These are needed only because nix's `--arg` command-line logic doesn't work
# with unnamed parameters allowed by ...
, system ? localSystem.system
, crossSystem ? localSystem
, # Fallback: The contents of the configuration file found at $NIXPKGS_CONFIG or
# $HOME/.config/nixpkgs/config.nix.
config ? let
configFile = builtins.getEnv "NIXPKGS_CONFIG";
configFile2 = homeDir + "/.config/nixpkgs/config.nix";
configFile3 = homeDir + "/.nixpkgs/config.nix"; # obsolete
in
if configFile != "" && builtins.pathExists configFile then import configFile
else if homeDir != "" && builtins.pathExists configFile2 then import configFile2
else if homeDir != "" && builtins.pathExists configFile3 then import configFile3
This file has been truncated. show original
imported from
For more information, please see the NixOS release notes at
https://nixos.org/nixos/manual or locally at
${toString ./nixos/doc/manual/release-notes}.
If you need further help, see https://nixos.org/nixos/support.html
''
else
import ./pkgs/top-level/impure.nix
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 override
s 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.