[Nix-dev] how to overwrite a derivation in nix
Sergey
grrwlf at gmail.com
Fri Jan 10 22:04:48 CET 2014
On 10.01.2014 15:57, Marc Weber wrote:
> option 1: use ~/.nixpkgs/config.nix, see wiki "how to keep multiple
> packages up to date" or such.
>
> option 2: use applyGlobalOverrides
> problem: its not exposed by pkgs AFAIK
>
> option 3: when importing nipkgs pass config.nix (like option 1)
>
> option 4: use deepOverride (see lib.misc.nix)
>
> Then it would look like
> something_having_thunar_as_dep.deepOverride {
> thunar = patch-thunar-here
> }
>
> Now it looks like you don't want to "override", instead you want to
> reuse a build and add a patch only giving it a new name, this is done by
> overrideDerivation found in lib/customization.nix
>
> thunar is in xfce/core/thunar, and no top-level in all-packages.nix
> and eg ./pkgs/desktops/xfce/core/xfdesktop.nix|2| depends on it.
>
> Thus you might need any of the deep overriding methods listed above if
> you want packages to change depending on it.
>
> Eventually the most simple thing is to create a git topic branch and
> just apply your change.
Yep, I do the job in my local branch, which I don't plan to merge into
upstream. But I also want to minimize the changes in the nixpkgs folder,
in particular, I'd like to avoid copying an existing derivation if I
don't need a specific version of the application it defines. Of cause,
ideally, I'd like to avoid touching the tree at all.
>
> Marc Weber
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
overrideDerivation does what I expected, thanks! Looks like I don't need
deepOverride right now. There is a problem, however, which prevents me
from keeping my changes completely separate from the nixpkgs tree. It
is on a nixos level. Basically, I've ended up with the following setup:
# nixos/services/x11/desktopManagers/xfce.nix
environment.systemPackages = [
...
pkgs.xfce.thunar
...
];
# my_config.nix
let
thunar_uca = pkgs.lib.hiPrio (pkgs.lib.overrideDerivation
pkgs.xfce.thunar (a:{
name = a.name + "-uca";
prePatch = ''
./tweak-sources.sh
'';
}));
in
environment.systemPackages = [
...
thunar_uca
...
];
Here I have two different conflicting packages sitting in the
environment.systemPackages after merging. hiPrio doesn't help me here
probably because it affects nix-env only. If there had been a method of
filtering out original pkgs.xfce.thunar from systemPackages list, I
would have done my hack without touching nixpkgs/. Is it possible? For
now I have a patch which does some minimal changes [1] there.
Thanks,
Sergey
[1] -
https://github.com/grwlf/nixpkgs/commit/21ebe02cd057a102e55bdeffab6ff72137d093b6
More information about the nix-dev
mailing list