3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/applications/misc/authy/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
1.9 KiB
Nix
Raw Normal View History

2022-06-07 23:43:09 +01:00
{ autoPatchelfHook
, electron
2022-03-16 15:25:30 +00:00
, fetchurl
, lib
, makeWrapper
, squashfsTools
, stdenv
2021-02-16 13:00:44 +00:00
}:
stdenv.mkDerivation rec {
pname = "authy";
2022-03-16 15:25:30 +00:00
# curl -H 'X-Ubuntu-Series: 16' 'https://api.snapcraft.io/api/v1/snaps/details/authy?channel=stable' | jq '.download_url,.version'
2022-07-28 07:52:49 +01:00
version = "2.2.1";
rev = "11";
2021-02-16 13:00:44 +00:00
src = fetchurl {
url = "https://api.snapcraft.io/api/v1/snaps/download/H8ZpNgIoPyvmkgxOWw5MSzsXK1wRZiHn_${rev}.snap";
2022-07-28 07:52:49 +01:00
sha256 = "sha256-/a0pMXVd7mEp7oaN2mBIJv5uOv1zQ3gvfgiz1XL9ZmM=";
2021-02-16 13:00:44 +00:00
};
nativeBuildInputs = [ autoPatchelfHook makeWrapper squashfsTools ];
unpackPhase = ''
runHook preUnpack
unsquashfs "$src"
cd squashfs-root
if ! grep -q '${version}' meta/snap.yaml; then
echo "Package version differs from version found in snap metadata:"
grep 'version: ' meta/snap.yaml
echo "While the nix package specifies: ${version}."
echo "You probably chose the wrong revision or forgot to update the nix version."
exit 1
fi
runHook postUnpack
'';
installPhase = ''
runHook preInstall
2022-06-07 23:43:09 +01:00
mkdir -p $out/bin $out/share/applications $out/share/pixmaps/apps
2021-02-16 13:00:44 +00:00
2022-06-07 23:43:09 +01:00
# Copy only what is needed
cp -r resources* $out/
cp -r locales* $out/
cp meta/gui/authy.desktop $out/share/applications/
cp meta/gui/icon.png $out/share/pixmaps/authy.png
2021-02-16 13:00:44 +00:00
# Replace icon name in Desktop file
2022-06-07 23:43:09 +01:00
sed -i 's|''${SNAP}/meta/gui/icon.png|authy|g' "$out/share/applications/authy.desktop"
2021-02-16 13:00:44 +00:00
runHook postInstall
'';
postFixup = ''
makeWrapper ${electron}/bin/electron $out/bin/${pname} \
--add-flags $out/resources/app.asar
'';
meta = with lib; {
homepage = "https://www.authy.com";
description = "Twilio Authy two factor authentication desktop application";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
2021-02-16 13:00:44 +00:00
license = licenses.unfree;
maintainers = with maintainers; [ iammrinal0 ];
platforms = [ "x86_64-linux" ];
};
}