mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-04-15 14:08:04 +00:00
keepass: move to by-name, remove dependency on buildDotnetPackage
This commit is contained in:
parent
17012aa0d2
commit
c14085ee53
@ -1,19 +1,24 @@
|
||||
{ lib, fetchurl, buildDotnetPackage, substituteAll, makeWrapper, makeDesktopItem,
|
||||
unzip, icoutils, gtk2, xorg, xdotool, xsel, coreutils, unixtools, glib, plugins ? [] }:
|
||||
let
|
||||
inherit (builtins) add length readFile replaceStrings unsafeDiscardStringContext toString map;
|
||||
in buildDotnetPackage rec {
|
||||
{ lib, stdenv, fetchurl
|
||||
, unzip, mono, makeWrapper, icoutils
|
||||
, substituteAll, xsel, xorg, xdotool, coreutils, unixtools, glib
|
||||
, gtk2, makeDesktopItem, plugins ? [] }:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "keepass";
|
||||
version = "2.55";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/keepass/KeePass-${version}-Source.zip";
|
||||
url = "mirror://sourceforge/keepass/KeePass-${finalAttrs.version}-Source.zip";
|
||||
hash = "sha256-XZf/5b+rwASB41DP3It3g8UUPIHWEtZBXGk+Qrjw1Bc=";
|
||||
};
|
||||
|
||||
sourceRoot = ".";
|
||||
|
||||
nativeBuildInputs = [ makeWrapper unzip ];
|
||||
nativeBuildInputs = [
|
||||
unzip
|
||||
mono
|
||||
makeWrapper
|
||||
];
|
||||
buildInputs = [ icoutils ];
|
||||
|
||||
patches = [
|
||||
@ -34,16 +39,21 @@ in buildDotnetPackage rec {
|
||||
#
|
||||
# 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;
|
||||
pluginLoadPathsPatch = let
|
||||
inherit (builtins) toString;
|
||||
inherit (lib.strings) readFile concatStrings replaceStrings unsafeDiscardStringContext;
|
||||
inherit (lib.lists) map length;
|
||||
inherit (lib) add;
|
||||
|
||||
outputLc = toString (add 7 (length plugins));
|
||||
patchTemplate = readFile ./keepass-plugins.patch;
|
||||
loadTemplate = readFile ./keepass-plugins-load.patch;
|
||||
loads = concatStrings
|
||||
(map
|
||||
(p: replaceStrings ["$PATH$"] [ (unsafeDiscardStringContext (toString p)) ] loadTemplate)
|
||||
plugins);
|
||||
in
|
||||
replaceStrings ["$OUTPUT_LC$" "$DO_LOADS$"] [outputLc loads] patchTemplate;
|
||||
|
||||
passAsFile = [ "pluginLoadPathsPatch" ];
|
||||
postPatch = ''
|
||||
@ -51,7 +61,9 @@ in buildDotnetPackage rec {
|
||||
patch -p1 <$pluginLoadPathsPatchPath
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
configurePhase = ''
|
||||
runHook 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 '
|
||||
@ -61,6 +73,60 @@ in buildDotnetPackage rec {
|
||||
s#<SignAssembly>.*$#<SignAssembly>false</SignAssembly>#g
|
||||
s#<PostBuildEvent>.*sgen.exe.*$##
|
||||
' {} \;
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
xbuild /p:Configuration=Release
|
||||
|
||||
runHook postBuld
|
||||
'';
|
||||
|
||||
outputFiles = [
|
||||
"Build/KeePass/Release/*"
|
||||
"Build/KeePassLib/Release/*"
|
||||
"Ext/KeePass.config.xml" # contains <PreferUserConfiguration>true</PreferUserConfiguration>
|
||||
];
|
||||
|
||||
# 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.concatStringsSep ":" (map (x: x + "/bin") plugins);
|
||||
|
||||
dynlibPath = lib.makeLibraryPath [ gtk2 ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
target="$out/lib/dotnet/${finalAttrs.pname}"
|
||||
mkdir -p "$target"
|
||||
|
||||
cp -rv $outputFiles "$target"
|
||||
|
||||
makeWrapper \
|
||||
"${mono}/bin/mono" \
|
||||
"$out/bin/keepass" \
|
||||
--add-flags "$target/KeePass.exe" \
|
||||
--prefix PATH : "$binPaths" \
|
||||
--prefix LD_LIBRARY_PATH : "$dynlibPath"
|
||||
|
||||
# setup desktop item with icon
|
||||
mkdir -p "$out/share/applications"
|
||||
cp $desktopItem/share/applications/* $out/share/applications
|
||||
|
||||
${./extractWinRscIconsToStdFreeDesktopDir.sh} \
|
||||
"./Translation/TrlUtil/Resources/KeePass.ico" \
|
||||
'[^\.]+_[0-9]+_([0-9]+x[0-9]+)x[0-9]+\.png' \
|
||||
'\1' \
|
||||
'([^\.]+).+' \
|
||||
'keepass' \
|
||||
"$out" \
|
||||
"./tmp"
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
desktopItem = makeDesktopItem {
|
||||
@ -74,43 +140,6 @@ in buildDotnetPackage rec {
|
||||
mimeTypes = [ "application/x-keepass2" ];
|
||||
};
|
||||
|
||||
outputFiles = [
|
||||
"Build/KeePass/Release/*"
|
||||
"Build/KeePassLib/Release/*"
|
||||
"Ext/KeePass.config.xml" # contains <PreferUserConfiguration>true</PreferUserConfiguration>
|
||||
];
|
||||
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.concatStringsSep ":" (map (x: x + "/bin") plugins);
|
||||
|
||||
dynlibPath = 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/";
|
||||
@ -119,4 +148,4 @@ in buildDotnetPackage rec {
|
||||
license = lib.licenses.gpl2;
|
||||
mainProgram = "keepass";
|
||||
};
|
||||
}
|
||||
})
|
@ -31440,8 +31440,6 @@ with pkgs;
|
||||
evolution = callPackage ../applications/networking/mailreaders/evolution/evolution { };
|
||||
evolutionWithPlugins = callPackage ../applications/networking/mailreaders/evolution/evolution/wrapper.nix { plugins = [ evolution evolution-ews ]; };
|
||||
|
||||
keepass = callPackage ../applications/misc/keepass { };
|
||||
|
||||
keepass-charactercopy = callPackage ../applications/misc/keepass-plugins/charactercopy { };
|
||||
|
||||
keepass-keeagent = callPackage ../applications/misc/keepass-plugins/keeagent { };
|
||||
|
Loading…
Reference in New Issue
Block a user