2022-12-17 10:02:37 +00:00
|
|
|
{ lib
|
|
|
|
, flutter
|
|
|
|
, python3
|
|
|
|
, fetchFromGitHub
|
|
|
|
, stdenv
|
|
|
|
, pcre2
|
2023-01-11 07:51:40 +00:00
|
|
|
, gnome
|
|
|
|
, makeWrapper
|
2023-02-02 18:25:31 +00:00
|
|
|
, removeReferencesTo
|
2022-12-17 10:02:37 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
vendorHashes = {
|
2023-02-09 11:40:11 +00:00
|
|
|
x86_64-linux = "sha256-Upe0cEDG02RJD50Ht9VNMwkelsJHX8zOuJZssAhMuMY=";
|
|
|
|
aarch64-linux = "sha256-lKER4+gcyFqnCvgBl/qdVBCbUpocWUnXGLXsX82MSy4=";
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
2023-01-11 07:51:40 +00:00
|
|
|
in
|
|
|
|
flutter.mkFlutterApp rec {
|
|
|
|
pname = "yubioath-flutter";
|
2023-02-09 11:40:11 +00:00
|
|
|
version = "6.1.0";
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Yubico";
|
|
|
|
repo = "yubioath-flutter";
|
|
|
|
rev = version;
|
2023-02-09 11:40:11 +00:00
|
|
|
sha256 = "sha256-N9/qwC79mG9r+zMPLHSPjNSQ+srGtnXuKsf0ijtH7CI=";
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
passthru.helper = python3.pkgs.callPackage ./helper.nix { inherit src version meta; };
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
vendorHash = vendorHashes.${stdenv.system};
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace linux/CMakeLists.txt \
|
2023-01-11 07:51:40 +00:00
|
|
|
--replace "../build/linux/helper" "${passthru.helper}/libexec/helper"
|
2022-12-17 10:02:37 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
# Make sure we have permission to delete things CMake has copied in to our build directory from elsewhere.
|
2023-01-11 07:51:40 +00:00
|
|
|
chmod -R +w build
|
2022-12-17 10:02:37 +00:00
|
|
|
'';
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
postInstall = ''
|
|
|
|
# Swap the authenticator-helper symlink with the correct symlink.
|
2023-01-11 07:51:40 +00:00
|
|
|
ln -fs "${passthru.helper}/bin/authenticator-helper" "$out/app/helper/authenticator-helper"
|
|
|
|
|
|
|
|
# Move the icon.
|
|
|
|
mkdir $out/share/icons
|
|
|
|
mv $out/app/linux_support/com.yubico.yubioath.png $out/share/icons
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
|
|
|
|
# Needed for QR scanning to work.
|
|
|
|
wrapProgram "$out/bin/yubioath-flutter" \
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ gnome.gnome-screenshot ]}
|
|
|
|
|
|
|
|
# Set the correct path to the binary in desktop file.
|
|
|
|
substituteInPlace "$out/share/applications/com.yubico.authenticator.desktop" \
|
|
|
|
--replace "@EXEC_PATH/authenticator" "$out/bin/yubioath-flutter" \
|
|
|
|
--replace "@EXEC_PATH/linux_support/com.yubico.yubioath.png" "$out/share/icons/com.yubico.yubioath.png"
|
2023-02-02 18:25:31 +00:00
|
|
|
|
|
|
|
# Remove unnecessary references to Flutter.
|
|
|
|
remove-references-to -t ${flutter.unwrapped} $out/app/data/flutter_assets/shaders/ink_sparkle.frag
|
2022-12-17 10:02:37 +00:00
|
|
|
'';
|
|
|
|
|
2023-01-11 07:51:40 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
2023-02-02 18:25:31 +00:00
|
|
|
removeReferencesTo
|
2023-01-11 07:51:40 +00:00
|
|
|
];
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
buildInputs = [
|
|
|
|
pcre2
|
|
|
|
];
|
2023-01-11 07:51:40 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
disallowedReferences = [
|
|
|
|
flutter
|
|
|
|
flutter.unwrapped
|
|
|
|
];
|
|
|
|
|
2023-01-11 07:51:40 +00: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-12-17 10:02:37 +00:00
|
|
|
}
|