I am attempting to converted the changes found in this PR into an overlay so I don’t need to keep updating my own fork of nixpkgs. The trouble is, I need to override the attributes of a derivation inside another derivation.
I’ve attempted to just override the inner derivation, hoping it would be that easy, but as expected that did not work. I’ve also attempted to override the “sublime_text” attribute of the outer derivation with another override, thought that surprisingly also did not work. What am I missing here?
My latest attempt is below:
final: prev:
assert builtins.hasAttr "sublime4" prev;
{
final.sublime4 = prev.sublime4.overrideAttrs(prevAttrs:
let
primaryBinary = "sublime_text";
in
assert builtins.hasAttr primaryBinary prevAttrs;
{
${primaryBinary} = prevAttrs.${primaryBinary}.overrideAttrs (
let
pkexecPath = "/run/wrappers/bin/pkexec";
redirects = [ "/usr/bin/pkexec=${pkexecPath}" ];
in {
postFixup = ''
wrapProgram $out/${primaryBinary} \
--set LD_PRELOAD "${final.libredirect}/lib/libredirect.so" \
--set NIX_REDIRECTS ${builtins.concatStringsSep ":" redirects} \
--set LOCALE_ARCHIVE "${final.glibcLocales.out}/lib/locale/locale-archive" \
"''${gappsWrapperArgs[@]}"
'';
}
);
});
}