2022-11-30 14:05:16 +01:00
|
|
|
{ lib
|
2023-08-28 03:01:02 +02:00
|
|
|
, flutter
|
2022-11-30 14:05:16 +01:00
|
|
|
, python3
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pcre2
|
2023-08-13 14:37:49 +02:00
|
|
|
, libnotify
|
|
|
|
, libappindicator
|
|
|
|
, pkg-config
|
2023-01-04 15:09:20 +01:00
|
|
|
, gnome
|
|
|
|
, makeWrapper
|
2023-01-23 04:55:02 +01:00
|
|
|
, removeReferencesTo
|
2022-11-30 14:05:16 +01:00
|
|
|
}:
|
2023-04-13 17:49:09 +02:00
|
|
|
|
2023-08-28 03:01:02 +02:00
|
|
|
flutter.buildFlutterApplication rec {
|
2022-12-29 21:56:06 +01:00
|
|
|
pname = "yubioath-flutter";
|
2024-02-20 12:59:27 +01:00
|
|
|
version = "6.4.0";
|
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;
|
2024-02-20 12:59:27 +01:00
|
|
|
hash = "sha256-aXUnmKEUCi0rsVr3HVhEk6xa1z9HMsH+0AIY531hqiU=";
|
2022-11-30 14:05:16 +01:00
|
|
|
};
|
|
|
|
|
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
|
|
|
|
2023-10-25 13:29:28 +02:00
|
|
|
pubspecLock = lib.importJSON ./pubspec.lock.json;
|
2024-02-20 12:59:27 +01:00
|
|
|
gitHashes = {
|
|
|
|
window_manager = "sha256-mLX51nbWFccsAfcqLQIYDjYz69y9wAz4U1RZ8TIYSj0=";
|
|
|
|
};
|
2022-11-30 14:05:16 +01:00
|
|
|
|
|
|
|
postPatch = ''
|
2023-08-28 03:01:02 +02:00
|
|
|
rm -f pubspec.lock
|
|
|
|
|
2022-11-30 14:05:16 +01:00
|
|
|
substituteInPlace linux/CMakeLists.txt \
|
2024-02-25 23:47:02 +01:00
|
|
|
--replace-fail "../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"
|
|
|
|
|
|
|
|
# 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
|
|
|
'';
|
|
|
|
|
2024-01-25 00:41:36 +01:00
|
|
|
# Needed for QR scanning to work
|
|
|
|
extraWrapProgramArgs = ''
|
|
|
|
--prefix PATH : ${lib.makeBinPath [ gnome.gnome-screenshot ]}
|
|
|
|
'';
|
|
|
|
|
2023-01-04 15:09:20 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
2023-01-23 04:55:02 +01:00
|
|
|
removeReferencesTo
|
2023-08-13 14:37:49 +02:00
|
|
|
pkg-config
|
2023-01-04 15:09:20 +01:00
|
|
|
];
|
|
|
|
|
2022-11-30 14:05:16 +01:00
|
|
|
buildInputs = [
|
|
|
|
pcre2
|
2023-08-13 14:37:49 +02:00
|
|
|
libnotify
|
|
|
|
libappindicator
|
2022-11-30 14:05:16 +01:00
|
|
|
];
|
2022-12-29 21:56:06 +01:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Yubico Authenticator for Desktop";
|
2024-03-19 03:14:51 +01:00
|
|
|
mainProgram = "yubioath-flutter";
|
2022-12-29 21:56:06 +01:00
|
|
|
homepage = "https://github.com/Yubico/yubioath-flutter";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ lukegb ];
|
2023-04-13 17:49:09 +02:00
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
2022-12-29 21:56:06 +01:00
|
|
|
};
|
2022-11-30 14:05:16 +01:00
|
|
|
}
|