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

69 lines
2.1 KiB
Nix
Raw Normal View History

2021-03-09 20:33:10 +01:00
{ lib, stdenv, fetchurl, appimageTools, undmg, libsecret, libxshmfence }:
2020-05-25 17:44:29 +02:00
let
inherit (stdenv.hostPlatform) system;
throwSystem = throw "Unsupported system: ${system}";
pname = "keeweb";
2021-03-09 20:33:10 +01:00
version = "1.17.0";
2020-05-25 17:44:29 +02:00
name = "${pname}-${version}";
suffix = {
x86_64-linux = "linux.AppImage";
2020-12-13 12:44:58 +01:00
x86_64-darwin = "mac.x64.dmg";
aarch64-darwin = "mac.arm64.dmg";
2020-05-25 17:44:29 +02:00
}.${system} or throwSystem;
src = fetchurl {
url = "https://github.com/keeweb/keeweb/releases/download/v${version}/KeeWeb-${version}.${suffix}";
sha256 = {
2021-03-09 20:33:10 +01:00
x86_64-linux = "1c7zvwnd46d3lrlcdigv341flz44jl6mnvr6zqny5mfz221ynbj7";
x86_64-darwin = "1n4haxychm5jjhjnpncavjh0wr4dagqi78qfsx5gwlv86hzryzwy";
aarch64-darwin = "1j7z63cbfms02f2lhl949wy3lc376jw8kqmjfn9j949s0l5fanpb";
2020-05-25 17:44:29 +02:00
}.${system} or throwSystem;
};
appimageContents = appimageTools.extract {
inherit name src;
};
meta = with lib; {
2020-05-25 17:44:29 +02:00
description = "Free cross-platform password manager compatible with KeePass";
homepage = "https://keeweb.info/";
2021-03-09 20:33:10 +01:00
changelog = "https://github.com/keeweb/keeweb/blob/v${version}/release-notes.md";
2020-05-25 17:44:29 +02:00
license = licenses.mit;
maintainers = with maintainers; [ sikmir ];
2020-12-13 12:44:58 +01:00
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
2020-05-25 17:44:29 +02:00
};
linux = appimageTools.wrapType2 rec {
inherit name src meta;
2021-03-09 20:33:10 +01:00
extraPkgs = pkgs: with pkgs; [ libsecret libxshmfence ];
2020-05-25 17:44:29 +02:00
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 ];
2021-03-09 20:33:10 +01:00
sourceRoot = ".";
2020-05-25 17:44:29 +02:00
installPhase = ''
2021-03-09 20:33:10 +01:00
mkdir -p $out/Applications
cp -r *.app $out/Applications
2020-05-25 17:44:29 +02:00
'';
};
in
if stdenv.isDarwin
then darwin
else linux