2022-11-30 14:05:16 +01:00
|
|
|
{ lib
|
|
|
|
, flutter
|
|
|
|
, python3
|
|
|
|
, fetchFromGitHub
|
|
|
|
, stdenv
|
|
|
|
, pcre2
|
2023-01-04 15:09:20 +01:00
|
|
|
, gnome
|
|
|
|
, makeWrapper
|
2022-11-30 14:05:16 +01:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
vendorHashes = {
|
|
|
|
x86_64-linux = "sha256-BwhWA8N0S55XkljDKPNkDhsj0QSpmJJ5MwEnrPjymS8=";
|
|
|
|
aarch64-linux = "sha256-T1aGz3+2Sls+rkUVDUo39Ky2igg+dxGSUaf3qpV7ovQ=";
|
|
|
|
};
|
2022-12-29 21:56:06 +01:00
|
|
|
in
|
|
|
|
flutter.mkFlutterApp rec {
|
|
|
|
pname = "yubioath-flutter";
|
2022-11-30 14:05:16 +01:00
|
|
|
version = "6.0.2";
|
2022-12-29 21:56:06 +01:00
|
|
|
|
2022-11-30 14:05:16 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Yubico";
|
|
|
|
repo = "yubioath-flutter";
|
|
|
|
rev = version;
|
|
|
|
sha256 = "13nh5qpq02c6azfdh4cbzhlrq0hs9is45q5z5cnxg84hrx26hd4k";
|
|
|
|
};
|
|
|
|
|
2022-12-29 21:56:06 +01:00
|
|
|
passthru.helper = python3.pkgs.callPackage ./helper.nix { inherit src version meta; };
|
2022-11-30 14:05:16 +01:00
|
|
|
|
2022-12-29 21:56:06 +01:00
|
|
|
vendorHash = vendorHashes.${stdenv.system};
|
2022-11-30 14:05:16 +01:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace linux/CMakeLists.txt \
|
2022-12-29 21:56:06 +01:00
|
|
|
--replace "../build/linux/helper" "${passthru.helper}/libexec/helper"
|
2022-11-30 14:05:16 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
# Make sure we have permission to delete things CMake has copied in to our build directory from elsewhere.
|
2022-12-29 21:56:06 +01:00
|
|
|
chmod -R +w build
|
2022-11-30 14:05:16 +01:00
|
|
|
'';
|
2022-12-29 21:56:06 +01:00
|
|
|
|
2022-11-30 14:05:16 +01:00
|
|
|
postInstall = ''
|
|
|
|
# Swap the authenticator-helper symlink with the correct symlink.
|
2022-12-29 21:56:06 +01:00
|
|
|
ln -fs "${passthru.helper}/bin/authenticator-helper" "$out/app/helper/authenticator-helper"
|
|
|
|
|
2023-01-02 19:00:06 +01:00
|
|
|
# Move the icon.
|
|
|
|
mkdir $out/share/icons
|
|
|
|
mv $out/app/linux_support/com.yubico.yubioath.png $out/share/icons
|
|
|
|
|
2022-12-29 21:56:06 +01:00
|
|
|
# Cleanup.
|
|
|
|
rm -rf \
|
|
|
|
"$out/app/README.adoc" \
|
|
|
|
"$out/app/desktop_integration.sh" \
|
|
|
|
"$out/app/linux_support" \
|
|
|
|
$out/bin/* # We will repopulate this directory later.
|
|
|
|
|
|
|
|
# Symlink binary.
|
|
|
|
ln -sf "$out/app/authenticator" "$out/bin/yubioath-flutter"
|
|
|
|
|
2023-01-04 15:09:20 +01:00
|
|
|
# Needed for QR scanning to work.
|
|
|
|
wrapProgram "$out/bin/yubioath-flutter" \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ gnome.gnome-screenshot ]}
|
|
|
|
|
2022-12-29 21:56:06 +01:00
|
|
|
# Set the correct path to the binary in desktop file.
|
|
|
|
substituteInPlace "$out/share/applications/com.yubico.authenticator.desktop" \
|
2023-01-02 19:00:06 +01:00
|
|
|
--replace "@EXEC_PATH/authenticator" "$out/bin/yubioath-flutter" \
|
|
|
|
--replace "@EXEC_PATH/linux_support/com.yubico.yubioath.png" "$out/share/icons/com.yubico.yubioath.png"
|
2022-11-30 14:05:16 +01:00
|
|
|
'';
|
|
|
|
|
2023-01-04 15:09:20 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
2022-11-30 14:05:16 +01:00
|
|
|
buildInputs = [
|
|
|
|
pcre2
|
|
|
|
];
|
2022-12-29 21:56:06 +01:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Yubico Authenticator for Desktop";
|
|
|
|
homepage = "https://github.com/Yubico/yubioath-flutter";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ lukegb ];
|
|
|
|
platforms = builtins.attrNames vendorHashes;
|
|
|
|
};
|
2022-11-30 14:05:16 +01:00
|
|
|
}
|