diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:36 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-01-07 02:18:47 +0000 |
commit | 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch) | |
tree | b3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/applications/misc/keepass/default.nix | |
parent | 4e31070265257dc67d120c27e0f75c2344fdfa9a (diff) | |
parent | abf060725d7614bd3b9f96764262dfbc2f9c2199 (diff) | |
download | nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2 nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip |
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/applications/misc/keepass/default.nix')
-rw-r--r-- | nixpkgs/pkgs/applications/misc/keepass/default.nix | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/misc/keepass/default.nix b/nixpkgs/pkgs/applications/misc/keepass/default.nix new file mode 100644 index 000000000000..b954d2d3cdb8 --- /dev/null +++ b/nixpkgs/pkgs/applications/misc/keepass/default.nix @@ -0,0 +1,115 @@ +{ stdenv, lib, fetchurl, buildDotnetPackage, substituteAll, makeWrapper, makeDesktopItem, + unzip, icoutils, gtk2, xorg, xdotool, xsel, plugins ? [] }: + +with builtins; buildDotnetPackage rec { + baseName = "keepass"; + version = "2.40"; + + src = fetchurl { + url = "mirror://sourceforge/keepass/KeePass-${version}-Source.zip"; + sha256 = "1gldl74wz2lvsci6rn71d6q1zmnhr52z6fjib9nsragsazq5byz9"; + }; + + sourceRoot = "."; + + buildInputs = [ unzip makeWrapper icoutils ]; + + patches = [ + (substituteAll { + src = ./fix-paths.patch; + xsel = "${xsel}/bin/xsel"; + xprop = "${xorg.xprop}/bin/xprop"; + xdotool = "${xdotool}/bin/xdotool"; + }) + ]; + + # 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 + ''; + + 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.*$## + ' {} \; + ''; + + desktopItem = makeDesktopItem { + name = "keepass"; + exec = "keepass"; + comment = "Password manager"; + icon = "keepass"; + desktopName = "Keepass"; + genericName = "Password manager"; + categories = "Application;Utility;"; + mimeType = stdenv.lib.concatStringsSep ";" [ + "application/x-keepass2" + "" + ]; + }; + + outputFiles = [ "Build/KeePass/Release/*" "Build/KeePassLib/Release/*" ]; + dllFiles = [ "KeePassLib.dll" ]; + exeFiles = [ "KeePass.exe" ]; + + # 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. + binPaths = lib.concatStrings (lib.intersperse ":" (map (x: x + "/bin") plugins)); + + dynlibPath = stdenv.lib.makeLibraryPath [ gtk2 ]; + + postInstall = + let + extractFDeskIcons = ./extractWinRscIconsToStdFreeDesktopDir.sh; + in + '' + mkdir -p "$out/share/applications" + cp ${desktopItem}/share/applications/* $out/share/applications + wrapProgram $out/bin/keepass \ + --prefix PATH : "$binPaths" \ + --prefix LD_LIBRARY_PATH : "$dynlibPath" + + ${extractFDeskIcons} \ + "./Translation/TrlUtil/Resources/KeePass.ico" \ + '[^\.]+_[0-9]+_([0-9]+x[0-9]+)x[0-9]+\.png' \ + '\1' \ + '([^\.]+).+' \ + 'keepass' \ + "$out" \ + "./tmp" + ''; + + meta = { + description = "GUI password manager with strong cryptography"; + homepage = http://www.keepass.info/; + maintainers = with stdenv.lib.maintainers; [ amorsillo obadz joncojonathan jraygauthier ]; + platforms = with stdenv.lib.platforms; all; + license = stdenv.lib.licenses.gpl2; + }; +} |