summary refs log tree commit diff
path: root/pkgs/tools/security
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2019-08-09 14:00:27 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2019-08-09 14:00:27 +0200
commit9bd78cb0488040ea996b27e82135396a45325af5 (patch)
treefe8e48ceab8d69e7e51bd1f04ec6aae0ca7dafec /pkgs/tools/security
parenta12aeebedbac1bbb02d1beec35925c433cf022f5 (diff)
parent246c223e877989c5763ce905bfa42b3f32fe2c18 (diff)
downloadnixpkgs-9bd78cb0488040ea996b27e82135396a45325af5.tar
nixpkgs-9bd78cb0488040ea996b27e82135396a45325af5.tar.gz
nixpkgs-9bd78cb0488040ea996b27e82135396a45325af5.tar.bz2
nixpkgs-9bd78cb0488040ea996b27e82135396a45325af5.tar.lz
nixpkgs-9bd78cb0488040ea996b27e82135396a45325af5.tar.xz
nixpkgs-9bd78cb0488040ea996b27e82135396a45325af5.tar.zst
nixpkgs-9bd78cb0488040ea996b27e82135396a45325af5.zip
Merge master into staging-next
Diffstat (limited to 'pkgs/tools/security')
-rw-r--r--pkgs/tools/security/bitwarden/default.nix87
-rw-r--r--pkgs/tools/security/gopass/default.nix5
-rw-r--r--pkgs/tools/security/vault/vault-bin.nix53
3 files changed, 142 insertions, 3 deletions
diff --git a/pkgs/tools/security/bitwarden/default.nix b/pkgs/tools/security/bitwarden/default.nix
new file mode 100644
index 00000000000..e6874d085d2
--- /dev/null
+++ b/pkgs/tools/security/bitwarden/default.nix
@@ -0,0 +1,87 @@
+{ atomEnv
+, autoPatchelfHook
+, dpkg
+, fetchurl
+, libsecret
+, makeDesktopItem
+, makeWrapper
+, stdenv
+, udev
+, wrapGAppsHook
+}:
+
+let
+  inherit (stdenv.hostPlatform) system;
+
+  pname = "bitwarden";
+
+  version = {
+    "x86_64-linux" = "1.15.2";
+  }.${system} or "";
+
+  sha256 = {
+    "x86_64-linux" = "0yz4hkqqwq2zrdjfxk5kybhs90n80k6bkn0625m47b09lwl2di4f";
+  }.${system} or "";
+
+  meta = with stdenv.lib; {
+    description = "A secure and free password manager for all of your devices";
+    homepage = "https://bitwarden.com";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ kiwi ];
+    platforms = [ "x86_64-linux" ];
+  };
+
+  linux = stdenv.mkDerivation rec {
+    inherit pname version meta;
+
+    src = fetchurl {
+      url = "https://github.com/bitwarden/desktop/releases/download/"
+      + "v${version}/Bitwarden-${version}-amd64.deb";
+      inherit sha256;
+    };
+
+    desktopItem = makeDesktopItem {
+      name = "bitwarden";
+      exec = "bitwarden %U";
+      icon = "bitwarden";
+      comment = "A secure and free password manager for all of your devices";
+      desktopName = "Bitwarden";
+      categories = "Utility";
+    };
+
+    dontBuild = true;
+    dontConfigure = true;
+    dontPatchElf = true;
+    dontWrapGApps = true;
+
+    buildInputs = [ libsecret ] ++ atomEnv.packages;
+
+    nativeBuildInputs = [ dpkg makeWrapper autoPatchelfHook wrapGAppsHook ];
+
+    unpackPhase = "dpkg-deb -x $src .";
+
+    installPhase = ''
+      mkdir -p "$out/bin"
+      cp -R "opt" "$out"
+      cp -R "usr/share" "$out/share"
+      chmod -R g-w "$out"
+
+      # Desktop file
+      mkdir -p "$out/share/applications"
+      cp "${desktopItem}/share/applications/"* "$out/share/applications"
+    '';
+
+    runtimeDependencies = [
+      udev.lib
+    ];
+
+    postFixup = ''
+      makeWrapper $out/opt/Bitwarden/bitwarden $out/bin/bitwarden \
+        --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ libsecret stdenv.cc.cc ] }" \
+        "''${gappsWrapperArgs[@]}"
+    '';
+  };
+
+in if stdenv.isDarwin
+then throw "Bitwarden has not been packaged for macOS yet"
+else linux
diff --git a/pkgs/tools/security/gopass/default.nix b/pkgs/tools/security/gopass/default.nix
index a0b1f28854b..41a0d6eb7a5 100644
--- a/pkgs/tools/security/gopass/default.nix
+++ b/pkgs/tools/security/gopass/default.nix
@@ -15,12 +15,11 @@ buildGoPackage rec {
     sha256 = "0v3sx9hb03bdn4rvsv2r0jzif6p1rx47hrkpsbnwva31k396mck2";
   };
 
-  wrapperPath = with stdenv.lib; makeBinPath ([
+  wrapperPath = stdenv.lib.makeBinPath ([
     git
     gnupg
     xclip
-    wl-clipboard
-  ]);
+  ] ++ stdenv.lib.optional stdenv.isLinux wl-clipboard);
 
   postInstall = ''
     mkdir -p \
diff --git a/pkgs/tools/security/vault/vault-bin.nix b/pkgs/tools/security/vault/vault-bin.nix
new file mode 100644
index 00000000000..b58e41d850d
--- /dev/null
+++ b/pkgs/tools/security/vault/vault-bin.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchurl, unzip }:
+
+let
+  version = "1.1.3";
+
+  sources = let
+    base = "https://releases.hashicorp.com/vault/${version}";
+  in {
+    "x86_64-linux" = fetchurl {
+      url = "${base}/vault_${version}_linux_amd64.zip";
+      sha256 = "293b88f4d31f6bcdcc8b508eccb7b856a0423270adebfa0f52f04144c5a22ae0";
+    };
+    "i686-linux" = fetchurl {
+      url = "${base}/vault_${version}_linux_386.zip";
+      sha256 = "9f2fb99e08fa3d25af1497516d08b5d2d8a73bcacd5354ddec024e9628795867";
+    };
+    "x86_64-darwin" = fetchurl {
+      url = "${base}/vault_${version}_darwin_amd64.zip";
+      sha256 = "a0a7a242f8299ac4a00af8aa10ccedaf63013c8a068f56eadfb9d730b87155ea";
+    };
+    "i686-darwin" = fetchurl {
+      url = "${base}/vault_${version}_darwin_386.zip";
+      sha256 = "50542cfb37abb06e8bb6b8ba41f5ca7d72a4d6a4396d4e3f4a8391bed14f63be";
+    };
+    "aarch64-linux" = fetchurl {
+      url = "${base}/vault_${version}_linux_arm64.zip";
+      sha256 = "c243dce14b2e48e3667c2aa5b7fb37009dd7043b56032d6ebe50dd456715fd3f";
+    };
+  };
+
+in stdenv.mkDerivation {
+  name = "vault-bin-${version}";
+
+  src = sources."${stdenv.hostPlatform.system}" or (throw "unsupported system: ${stdenv.hostPlatform.system}");
+
+  nativeBuildInputs = [ unzip ];
+
+  sourceRoot = ".";
+
+  installPhase = ''
+    mkdir -p $out/bin $out/share/bash-completion/completions
+    mv vault $out/bin
+    echo "complete -C $out/bin/vault vault" > $out/share/bash-completion/completions/vault
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://www.vaultproject.io;
+    description = "A tool for managing secrets, this binary includes the UI";
+    platforms = [ "x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "i686-darwin" ];
+    license = licenses.mpl20;
+    maintainers = with maintainers; [ offline psyanticy ];
+  };
+}