Add Bitwarden for Mac

This commit is contained in:
greg-compass
2022-11-10 11:58:49 -06:00
parent f0a50305b8
commit 8a78e58f04
4 changed files with 43 additions and 4 deletions
+1
View File
@@ -60,4 +60,5 @@ in rec {
propagatedBuildInputs = old.propagatedBuildInputs ++ [ my-py-addons.xonsh-direnv ];
});
bitwarden = if super.stdenv.isDarwin then (super.callPackage ./mac/bitwarden.nix {}) else super.bitwarden;
}
+9 -3
View File
@@ -27,8 +27,14 @@ popd > /dev/null
rm -r "${dest}"
if [ "$(uname -s)" == "Darwin" ]; then
for app in ~/.nix-profile/Applications/*.app; do
echo "Copying '${app}' to Applications"
cp -r "${app}" "${HOME}/Applications"
cd ~/.nix-profile/Applications
for app in *.app; do
echo "Updating permissions on '${app}'"
chmod -R u+w "${HOME}/Applications/${app}"
echo "Copying new version to Applications"
cp -r "${app}" "${HOME}/Applications" 2>&1 > /dev/null || true
if [ "$?" != "0" ]; then
echo "An error occurred, proceeding anyway"
fi
done
fi
+32
View File
@@ -0,0 +1,32 @@
{ stdenv, fetchurl,
undmg,
}:
stdenv.mkDerivation rec {
version = "2022.10.1";
pname = "Bitwarden";
buildInputs = [
undmg
];
sourceRoot = ".";
phases = [
"unpackPhase"
"installPhase"
];
installPhase = ''
mkdir -p "$out/Applications"
cp -r Bitwarden*.app "$out/Applications"
'';
src = fetchurl {
name = "Bitwarden-${version}.dmg";
url = "https://github.com/bitwarden/clients/releases/download/desktop-v${version}/Bitwarden-${version}-universal.dmg";
sha256 = "sha256-6O8xaGBaG4d6l9QRtGM5wj9OCMFy87dH8N1MfEBBjck=";
};
meta = {
description = "Bitwarden, an open source password management tool";
homepage = "https://bitwarden.com";
};
}