keepass: bring back and update plugins load patches
Plugins loading was broken as those patches were removed
in latest release. I brought patches back and updated them
onto 2.38 release code base.
···11{ stdenv, lib, fetchurl, buildDotnetPackage, substituteAll, makeWrapper, makeDesktopItem,
22 unzip, icoutils, gtk2, xorg, xdotool, xsel, plugins ? [] }:
3344-# KeePass looks for plugins in under directory in which KeePass.exe is
55-# located. It follows symlinks where looking for that directory, so
66-# buildEnv is not enough to bring KeePass and plugins together.
77-#
88-# This derivation patches KeePass to search for plugins in specified
99-# plugin derivations in the Nix store and nowhere else.
104with builtins; buildDotnetPackage rec {
115 baseName = "keepass";
126 version = "2.38";
···2822 xdotool = "${xdotool}/bin/xdotool";
2923 })
3024 ];
2525+2626+ # KeePass looks for plugins in under directory in which KeePass.exe is
2727+ # located. It follows symlinks where looking for that directory, so
2828+ # buildEnv is not enough to bring KeePass and plugins together.
2929+ #
3030+ # This derivation patches KeePass to search for plugins in specified
3131+ # plugin derivations in the Nix store and nowhere else.
3232+ pluginLoadPathsPatch =
3333+ let outputLc = toString (add 7 (length plugins));
3434+ patchTemplate = readFile ./keepass-plugins.patch;
3535+ loadTemplate = readFile ./keepass-plugins-load.patch;
3636+ loads =
3737+ lib.concatStrings
3838+ (map
3939+ (p: replaceStrings ["$PATH$"] [ (unsafeDiscardStringContext (toString p)) ] loadTemplate)
4040+ plugins);
4141+ in replaceStrings ["$OUTPUT_LC$" "$DO_LOADS$"] [outputLc loads] patchTemplate;
4242+4343+ passAsFile = [ "pluginLoadPathsPatch" ];
4444+ postPatch = ''
4545+ sed -i 's/\r*$//' KeePass/Forms/MainForm.cs
4646+ patch -p1 <$pluginLoadPathsPatchPath
4747+ '';
31483249 preConfigure = ''
3350 rm -rvf Build/*