2021-01-25 08:26:54 +00:00
|
|
|
{ lib, fetchurl, buildDotnetPackage, substituteAll, makeWrapper, makeDesktopItem,
|
2020-05-19 10:00:59 +01:00
|
|
|
unzip, icoutils, gtk2, xorg, xdotool, xsel, coreutils, unixtools, glib, plugins ? [] }:
|
2013-06-09 22:17:09 +01:00
|
|
|
|
2015-11-22 17:21:13 +00:00
|
|
|
with builtins; buildDotnetPackage rec {
|
2021-11-08 16:12:26 +00:00
|
|
|
pname = "keepass";
|
2021-12-01 12:11:40 +00:00
|
|
|
version = "2.49";
|
2013-06-09 22:17:09 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-05-22 14:25:02 +01:00
|
|
|
url = "mirror://sourceforge/keepass/KeePass-${version}-Source.zip";
|
2021-12-01 12:11:40 +00:00
|
|
|
sha256 = "sha256-1hg4bRuQSG+UzEQGeQcSURTmTxt5ITGQqfg0IS7RWt0=";
|
2013-06-09 22:17:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
|
2021-02-20 21:01:53 +00:00
|
|
|
nativeBuildInputs = [ makeWrapper unzip ];
|
|
|
|
buildInputs = [ icoutils ];
|
2015-05-22 14:25:02 +01:00
|
|
|
|
2018-02-22 15:25:20 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./fix-paths.patch;
|
|
|
|
xsel = "${xsel}/bin/xsel";
|
|
|
|
xprop = "${xorg.xprop}/bin/xprop";
|
|
|
|
xdotool = "${xdotool}/bin/xdotool";
|
2020-05-19 10:00:59 +01:00
|
|
|
uname = "${coreutils}/bin/uname";
|
|
|
|
whereis = "${unixtools.whereis}/bin/whereis";
|
|
|
|
gsettings = "${glib}/bin/gsettings";
|
2018-02-22 15:25:20 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2018-02-24 06:38:36 +00:00
|
|
|
# KeePass looks for plugins in under directory in which KeePass.exe is
|
|
|
|
# located. It follows symlinks where looking for that directory, so
|
|
|
|
# buildEnv is not enough to bring KeePass and plugins together.
|
|
|
|
#
|
|
|
|
# This derivation patches KeePass to search for plugins in specified
|
|
|
|
# plugin derivations in the Nix store and nowhere else.
|
|
|
|
pluginLoadPathsPatch =
|
|
|
|
let outputLc = toString (add 7 (length plugins));
|
|
|
|
patchTemplate = readFile ./keepass-plugins.patch;
|
|
|
|
loadTemplate = readFile ./keepass-plugins-load.patch;
|
|
|
|
loads =
|
|
|
|
lib.concatStrings
|
|
|
|
(map
|
|
|
|
(p: replaceStrings ["$PATH$"] [ (unsafeDiscardStringContext (toString p)) ] loadTemplate)
|
|
|
|
plugins);
|
|
|
|
in replaceStrings ["$OUTPUT_LC$" "$DO_LOADS$"] [outputLc loads] patchTemplate;
|
|
|
|
|
|
|
|
passAsFile = [ "pluginLoadPathsPatch" ];
|
|
|
|
postPatch = ''
|
|
|
|
sed -i 's/\r*$//' KeePass/Forms/MainForm.cs
|
|
|
|
patch -p1 <$pluginLoadPathsPatchPath
|
|
|
|
'';
|
|
|
|
|
2016-01-29 20:10:26 +00:00
|
|
|
preConfigure = ''
|
|
|
|
rm -rvf Build/*
|
|
|
|
find . -name "*.sln" -print -exec sed -i 's/Format Version 10.00/Format Version 11.00/g' {} \;
|
|
|
|
find . -name "*.csproj" -print -exec sed -i '
|
|
|
|
s#ToolsVersion="3.5"#ToolsVersion="4.0"#g
|
|
|
|
s#<TargetFrameworkVersion>.*</TargetFrameworkVersion>##g
|
|
|
|
s#<PropertyGroup>#<PropertyGroup><TargetFrameworkVersion>v4.5</TargetFrameworkVersion>#g
|
|
|
|
s#<SignAssembly>.*$#<SignAssembly>false</SignAssembly>#g
|
|
|
|
s#<PostBuildEvent>.*sgen.exe.*$##
|
|
|
|
' {} \;
|
|
|
|
'';
|
2013-06-09 22:17:09 +01:00
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "keepass";
|
|
|
|
exec = "keepass";
|
|
|
|
comment = "Password manager";
|
2015-09-20 03:04:16 +01:00
|
|
|
icon = "keepass";
|
2013-06-09 22:17:09 +01:00
|
|
|
desktopName = "Keepass";
|
2015-11-22 17:21:13 +00:00
|
|
|
genericName = "Password manager";
|
2022-02-22 14:56:15 +00:00
|
|
|
categories = [ "Utility" ];
|
|
|
|
mimeTypes = [ "application/x-keepass2" ];
|
2013-06-09 22:17:09 +01:00
|
|
|
};
|
|
|
|
|
2021-12-01 11:56:22 +00:00
|
|
|
outputFiles = [
|
|
|
|
"Build/KeePass/Release/*"
|
|
|
|
"Build/KeePassLib/Release/*"
|
|
|
|
"Ext/KeePass.config.xml" # contains <PreferUserConfiguration>true</PreferUserConfiguration>
|
|
|
|
];
|
2015-05-22 14:25:02 +01:00
|
|
|
dllFiles = [ "KeePassLib.dll" ];
|
|
|
|
exeFiles = [ "KeePass.exe" ];
|
2013-06-09 22:17:09 +01:00
|
|
|
|
2015-11-22 17:21:13 +00:00
|
|
|
# plgx plugin like keefox requires mono to compile at runtime
|
|
|
|
# after loading. It is brought into plugins bin/ directory using
|
|
|
|
# buildEnv in the plugin derivation. Wrapper below makes sure it
|
|
|
|
# is found and does not pollute output path.
|
2021-08-28 16:18:03 +01:00
|
|
|
binPaths = lib.concatStringsSep ":" (map (x: x + "/bin") plugins);
|
2015-11-22 17:21:13 +00:00
|
|
|
|
2021-01-15 05:42:41 +00:00
|
|
|
dynlibPath = lib.makeLibraryPath [ gtk2 ];
|
2016-05-05 10:25:24 +01:00
|
|
|
|
2020-09-19 10:13:56 +01:00
|
|
|
postInstall =
|
2015-09-20 03:04:16 +01:00
|
|
|
let
|
|
|
|
extractFDeskIcons = ./extractWinRscIconsToStdFreeDesktopDir.sh;
|
|
|
|
in
|
|
|
|
''
|
2014-06-30 13:56:10 +01:00
|
|
|
mkdir -p "$out/share/applications"
|
2013-06-09 22:17:09 +01:00
|
|
|
cp ${desktopItem}/share/applications/* $out/share/applications
|
2016-05-05 10:25:24 +01:00
|
|
|
wrapProgram $out/bin/keepass \
|
|
|
|
--prefix PATH : "$binPaths" \
|
|
|
|
--prefix LD_LIBRARY_PATH : "$dynlibPath"
|
2015-09-20 03:04:16 +01:00
|
|
|
|
|
|
|
${extractFDeskIcons} \
|
|
|
|
"./Translation/TrlUtil/Resources/KeePass.ico" \
|
|
|
|
'[^\.]+_[0-9]+_([0-9]+x[0-9]+)x[0-9]+\.png' \
|
|
|
|
'\1' \
|
|
|
|
'([^\.]+).+' \
|
|
|
|
'keepass' \
|
|
|
|
"$out" \
|
|
|
|
"./tmp"
|
2013-06-09 22:17:09 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "GUI password manager with strong cryptography";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "http://www.keepass.info/";
|
2021-01-28 22:27:46 +00:00
|
|
|
maintainers = with lib.maintainers; [ amorsillo obadz ];
|
2021-01-15 05:42:41 +00:00
|
|
|
platforms = with lib.platforms; all;
|
|
|
|
license = lib.licenses.gpl2;
|
2013-06-09 22:17:09 +01:00
|
|
|
};
|
|
|
|
}
|