|
| 1 | +{ stdenv |
| 2 | +, fetchurl |
| 3 | +, appimageTools |
| 4 | +, makeWrapper |
| 5 | +, electron |
| 6 | +, openssl |
| 7 | +}: |
| 8 | + |
| 9 | +stdenv.mkDerivation rec { |
| 10 | + pname = "1password"; |
| 11 | + version = "0.8.0"; |
| 12 | + |
| 13 | + src = fetchurl { |
| 14 | + url = "https://onepassword.s3.amazonaws.com/linux/appimage/${pname}-${version}.AppImage"; |
| 15 | + sha256 = "1r26vyx724h3k6p340bg3lmcxwyvgxj2kqvwczq784583hpq3lq9"; |
| 16 | + }; |
| 17 | + |
| 18 | + nativeBuildInputs = [ makeWrapper ]; |
| 19 | + |
| 20 | + appimageContents = appimageTools.extractType2 { |
| 21 | + name = "${pname}-${version}"; |
| 22 | + inherit src; |
| 23 | + }; |
| 24 | + |
| 25 | + dontUnpack = true; |
| 26 | + dontConfigure = true; |
| 27 | + dontBuild = true; |
| 28 | + |
| 29 | + installPhase = let |
| 30 | + runtimeLibs = [ |
| 31 | + openssl.out |
| 32 | + stdenv.cc.cc |
| 33 | + ]; |
| 34 | + in '' |
| 35 | + mkdir -p $out/bin $out/share/1password |
| 36 | +
|
| 37 | + # Applications files. |
| 38 | + cp -a ${appimageContents}/{locales,resources} $out/share/${pname} |
| 39 | +
|
| 40 | + # Desktop file. |
| 41 | + install -Dt $out/share/applications ${appimageContents}/${pname}.desktop |
| 42 | + substituteInPlace $out/share/applications/${pname}.desktop \ |
| 43 | + --replace 'Exec=AppRun' 'Exec=${pname}' |
| 44 | +
|
| 45 | + # Icons. |
| 46 | + cp -a ${appimageContents}/usr/share/icons $out/share |
| 47 | +
|
| 48 | + # Wrap the application with Electron. |
| 49 | + makeWrapper "${electron}/bin/electron" "$out/bin/${pname}" \ |
| 50 | + --add-flags "$out/share/${pname}/resources/app.asar" \ |
| 51 | + --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath runtimeLibs}" |
| 52 | + ''; |
| 53 | + |
| 54 | + meta = with stdenv.lib; { |
| 55 | + description = "Multi-platform password manager"; |
| 56 | + longDescription = '' |
| 57 | + 1Password is a multi-platform package manager. |
| 58 | +
|
| 59 | + The Linux version is currently a development preview and can |
| 60 | + only be used to search, view, and copy items. However items |
| 61 | + cannot be created or edited. |
| 62 | + ''; |
| 63 | + homepage = "https://1password.com/"; |
| 64 | + license = licenses.unfree; |
| 65 | + maintainers = with maintainers; [ danieldk ]; |
| 66 | + platforms = [ "x86_64-linux" ]; |
| 67 | + }; |
| 68 | +} |
0 commit comments