about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/1password-gui
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/1password-gui')
-rw-r--r--nixpkgs/pkgs/tools/security/1password-gui/default.nix75
-rwxr-xr-xnixpkgs/pkgs/tools/security/1password-gui/update.sh5
2 files changed, 80 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/security/1password-gui/default.nix b/nixpkgs/pkgs/tools/security/1password-gui/default.nix
new file mode 100644
index 000000000000..ad3bb6eeb1b0
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/1password-gui/default.nix
@@ -0,0 +1,75 @@
+{ stdenv
+, fetchurl
+, appimageTools
+, makeWrapper
+, electron_9
+, openssl
+}:
+
+let
+  electron = electron_9;
+
+in
+
+stdenv.mkDerivation rec {
+  pname = "1password";
+  version = "0.8.7";
+
+  src = fetchurl {
+    url = "https://onepassword.s3.amazonaws.com/linux/appimage/${pname}-${version}.AppImage";
+    sha256 = "1101q5yavzl8imf8gqa3h929gcyy6lh7dy2dw0zs52qdcrb4z49j";
+  };
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  appimageContents = appimageTools.extractType2 {
+    name = "${pname}-${version}";
+    inherit src;
+  };
+
+  dontUnpack = true;
+  dontConfigure = true;
+  dontBuild = true;
+
+  installPhase = let
+    runtimeLibs = [
+      openssl.out
+      stdenv.cc.cc
+    ];
+  in ''
+    mkdir -p $out/bin $out/share/1password
+
+    # Applications files.
+    cp -a ${appimageContents}/{locales,resources} $out/share/${pname}
+
+    # Desktop file.
+    install -Dt $out/share/applications ${appimageContents}/${pname}.desktop
+    substituteInPlace $out/share/applications/${pname}.desktop \
+      --replace 'Exec=AppRun' 'Exec=${pname}'
+
+    # Icons.
+    cp -a ${appimageContents}/usr/share/icons $out/share
+
+    # Wrap the application with Electron.
+    makeWrapper "${electron}/bin/electron" "$out/bin/${pname}" \
+      --add-flags "$out/share/${pname}/resources/app.asar" \
+      --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath runtimeLibs}"
+  '';
+
+  passthru.updateScript = ./update.sh;
+
+  meta = with stdenv.lib; {
+    description = "Multi-platform password manager";
+    longDescription = ''
+      1Password is a multi-platform package manager.
+
+      The Linux version is currently a development preview and can
+      only be used to search, view, and copy items. However items
+      cannot be created or edited.
+    '';
+    homepage = "https://1password.com/";
+    license = licenses.unfree;
+    maintainers = with maintainers; [ danieldk ];
+    platforms = [ "x86_64-linux" ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/security/1password-gui/update.sh b/nixpkgs/pkgs/tools/security/1password-gui/update.sh
new file mode 100755
index 000000000000..7703aba99847
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/1password-gui/update.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env nix-shell
+#!nix-shell -i bash -p curl gnused common-updater-scripts
+
+version="$(curl -sL https://onepassword.s3.amazonaws.com/linux/debian/dists/edge/main/binary-amd64/Packages | sed -r -n 's/^Version: (.*)-[0-9]+/\1/p' | head -n1)"
+update-source-version _1password-gui "$version"