How to use package specific settings

Hi, I struggle with using package specific settings. I tried to get the vimix-gtk-themes package working with another themeVariant. I tried setting the variant using the nixpkgs.config but no success so far. Maybe somebody can help? Thanks in advance!

configuration.nix:

{ config, pkgs, … }:

nixpkgs.config = {
allowUnfree = true;
vimix-gtk-themes = {
themeVariants = [ “doder” “beryl” “ruby” “amethyst” “jade” “grey” ];
};
};

environment.systemPackages = with pkgs; [
vimix-gtk-themes
];

The “configuration” arguments to the package expression are not doing anything special, they are arguments like any other – callPackage will attempt to populate them and when a corresponding attribute does not exist in the scope, they will fall back to the default value specified in the expression.

There are two main ways you can override the value:

  • You can insert the themeVariants into the pkgs scope using an overlay:

    (final: prev: {
      themeVariants = [ "beryl" ];
    })
    

    Though note that it will be passed to all packages that accept themeVariants argument so it is not generally a good idea.

  • You can create a custom instance of the package by overriding the argument:

    (pkgs.vimix-gtk-themes.override {
      themeVariants = [ "beryl" ];
    })
    

There are some packages that respect the attributes set in config but the expression needs to look at the values explicitly:

2 Likes

Thanks a lot for the detailed information! Made it work using the package override. I‘ll have a deeper dive using those concepts.