about summary refs log tree commit diff
path: root/pkgs/applications/misc/keepass/default.nix
diff options
context:
space:
mode:
authorRaymond Gauthier <jraygauthier@gmail.com>2015-09-19 22:04:16 -0400
committerRaymond Gauthier <jraygauthier@gmail.com>2016-03-03 01:03:31 -0500
commit4f347ca8fe5cb120cab2916e14770e3e3416a6e5 (patch)
tree4c5d25bbca33cb5165070bbb8fb6c2f2db41af50 /pkgs/applications/misc/keepass/default.nix
parent5f57d2dc506d27da999756666466f81eef6e3c98 (diff)
downloadnixlib-4f347ca8fe5cb120cab2916e14770e3e3416a6e5.tar
nixlib-4f347ca8fe5cb120cab2916e14770e3e3416a6e5.tar.gz
nixlib-4f347ca8fe5cb120cab2916e14770e3e3416a6e5.tar.bz2
nixlib-4f347ca8fe5cb120cab2916e14770e3e3416a6e5.tar.lz
nixlib-4f347ca8fe5cb120cab2916e14770e3e3416a6e5.tar.xz
nixlib-4f347ca8fe5cb120cab2916e14770e3e3416a6e5.tar.zst
nixlib-4f347ca8fe5cb120cab2916e14770e3e3416a6e5.zip
keepass: improvements
`*.desktop` file now:
 -  Refers to an icon.
 -  Is placed in the proper category (based on comparison with `keepassx2`.
 -  Has proper mime type (also based on comparison).

Also, now use `icoutils` to extract icons from the application ressouces
and transform them from `*.ico` to `*.png`. Created and used a generic
script that has the ability to move the extracted `*.png` to their
appropriate standard freedesktop location.

Tested this on nixos. `keepass` now has a icon and is categorized
in the same bin as `keepassx2`. The program still execute and
function prefectly.
Diffstat (limited to 'pkgs/applications/misc/keepass/default.nix')
-rw-r--r--pkgs/applications/misc/keepass/default.nix28
1 files changed, 23 insertions, 5 deletions
diff --git a/pkgs/applications/misc/keepass/default.nix b/pkgs/applications/misc/keepass/default.nix
index 8f16283d3911..948d03262b6b 100644
--- a/pkgs/applications/misc/keepass/default.nix
+++ b/pkgs/applications/misc/keepass/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, buildDotnetPackage, makeWrapper, unzip, makeDesktopItem, plugins ? [] }:
+{ stdenv, lib, fetchurl, buildDotnetPackage, makeWrapper, unzip, makeDesktopItem, icoutils, plugins ? [] }:
 
 # KeePass looks for plugins in under directory in which KeePass.exe is
 # located. It follows symlinks where looking for that directory, so
@@ -17,7 +17,7 @@ with builtins; buildDotnetPackage rec {
 
   sourceRoot = ".";
 
-  buildInputs = [ unzip makeWrapper ];
+  buildInputs = [ unzip makeWrapper icoutils ];
 
   pluginLoadPathsPatch =
     let outputLc = toString (add 8 (length plugins));
@@ -52,9 +52,14 @@ with builtins; buildDotnetPackage rec {
     name = "keepass";
     exec = "keepass";
     comment = "Password manager";
+    icon = "keepass";
     desktopName = "Keepass";
     genericName = "Password manager";
-    categories = "Application;Other;";
+    categories = "Application;Utility;";
+    mimeType = stdenv.lib.concatStringsSep ";" [
+      "application/x-keepass2"
+      ""
+    ];
   };
 
   outputFiles = [ "Build/KeePass/Release/*" "Build/KeePassLib/Release/*" ];
@@ -67,16 +72,29 @@ with builtins; buildDotnetPackage rec {
   # is found and does not pollute output path.
   binPaths = lib.concatStrings (lib.intersperse ":" (map (x: x + "/bin") plugins));
 
-  postInstall = ''
+  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"
+
+    ${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 ];
+    maintainers = with stdenv.lib.maintainers; [ amorsillo obadz jraygauthier ];
     platforms = with stdenv.lib.platforms; all;
     license = stdenv.lib.licenses.gpl2;
   };