nixpkgs/pkgs/applications/misc/keeweb/default.nix

68 lines
2.0 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, appimageTools, undmg, libsecret }:
2020-05-25 15:44:29 +00:00
let
inherit (stdenv.hostPlatform) system;
throwSystem = throw "Unsupported system: ${system}";
pname = "keeweb";
2020-12-13 11:44:58 +00:00
version = "1.16.5";
2020-05-25 15:44:29 +00:00
name = "${pname}-${version}";
suffix = {
x86_64-linux = "linux.AppImage";
2020-12-13 11:44:58 +00:00
x86_64-darwin = "mac.x64.dmg";
aarch64-darwin = "mac.arm64.dmg";
2020-05-25 15:44:29 +00:00
}.${system} or throwSystem;
src = fetchurl {
url = "https://github.com/keeweb/keeweb/releases/download/v${version}/KeeWeb-${version}.${suffix}";
sha256 = {
2020-12-13 11:44:58 +00:00
x86_64-linux = "18qcr8zyn20n5zrrha0qwgq2ic10bp189fps87lbnmcjknrkac9g";
x86_64-darwin = "0crpjkcqgs7q5c814bx2npjh9kpyyb87yagm5wcy9j21kwrbqv6k";
aarch64-darwin = "1wkf9inrm5qg0c4xrk0s97mx5j21xvlqwwkvydl513gyfzi2g9gp";
2020-05-25 15:44:29 +00:00
}.${system} or throwSystem;
};
appimageContents = appimageTools.extract {
inherit name src;
};
meta = with lib; {
2020-05-25 15:44:29 +00:00
description = "Free cross-platform password manager compatible with KeePass";
homepage = "https://keeweb.info/";
license = licenses.mit;
maintainers = with maintainers; [ sikmir ];
2020-12-13 11:44:58 +00:00
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
2020-05-25 15:44:29 +00:00
};
linux = appimageTools.wrapType2 rec {
inherit name src meta;
extraPkgs = pkgs: with pkgs; [ libsecret ];
extraInstallCommands = ''
mv $out/bin/{${name},${pname}}
install -Dm644 ${appimageContents}/keeweb.desktop -t $out/share/applications
install -Dm644 ${appimageContents}/keeweb.png -t $out/share/icons/hicolor/256x256/apps
install -Dm644 ${appimageContents}/usr/share/mime/keeweb.xml -t $out/share/mime
substituteInPlace $out/share/applications/keeweb.desktop \
--replace 'Exec=AppRun' 'Exec=${pname}'
'';
};
darwin = stdenv.mkDerivation {
inherit pname version src meta;
nativeBuildInputs = [ undmg ];
sourceRoot = "KeeWeb.app";
installPhase = ''
mkdir -p $out/Applications/KeeWeb.app
cp -R . $out/Applications/KeeWeb.app
'';
};
in
if stdenv.isDarwin
then darwin
else linux