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.
···1{ stdenv, lib, fetchurl, buildDotnetPackage, substituteAll, makeWrapper, makeDesktopItem,
2 unzip, icoutils, gtk2, xorg, xdotool, xsel, plugins ? [] }:
34-# KeePass looks for plugins in under directory in which KeePass.exe is
5-# located. It follows symlinks where looking for that directory, so
6-# buildEnv is not enough to bring KeePass and plugins together.
7-#
8-# This derivation patches KeePass to search for plugins in specified
9-# plugin derivations in the Nix store and nowhere else.
10with builtins; buildDotnetPackage rec {
11 baseName = "keepass";
12 version = "2.38";
···28 xdotool = "${xdotool}/bin/xdotool";
29 })
30 ];
000000000000000000000003132 preConfigure = ''
33 rm -rvf Build/*
···1{ stdenv, lib, fetchurl, buildDotnetPackage, substituteAll, makeWrapper, makeDesktopItem,
2 unzip, icoutils, gtk2, xorg, xdotool, xsel, plugins ? [] }:
30000004with builtins; buildDotnetPackage rec {
5 baseName = "keepass";
6 version = "2.38";
···22 xdotool = "${xdotool}/bin/xdotool";
23 })
24 ];
25+26+ # KeePass looks for plugins in under directory in which KeePass.exe is
27+ # located. It follows symlinks where looking for that directory, so
28+ # buildEnv is not enough to bring KeePass and plugins together.
29+ #
30+ # This derivation patches KeePass to search for plugins in specified
31+ # plugin derivations in the Nix store and nowhere else.
32+ pluginLoadPathsPatch =
33+ let outputLc = toString (add 7 (length plugins));
34+ patchTemplate = readFile ./keepass-plugins.patch;
35+ loadTemplate = readFile ./keepass-plugins-load.patch;
36+ loads =
37+ lib.concatStrings
38+ (map
39+ (p: replaceStrings ["$PATH$"] [ (unsafeDiscardStringContext (toString p)) ] loadTemplate)
40+ plugins);
41+ in replaceStrings ["$OUTPUT_LC$" "$DO_LOADS$"] [outputLc loads] patchTemplate;
42+43+ passAsFile = [ "pluginLoadPathsPatch" ];
44+ postPatch = ''
45+ sed -i 's/\r*$//' KeePass/Forms/MainForm.cs
46+ patch -p1 <$pluginLoadPathsPatchPath
47+ '';
4849 preConfigure = ''
50 rm -rvf Build/*