2022-12-17 10:02:37 +00:00
|
|
|
{ lib
|
2023-10-09 19:29:22 +00:00
|
|
|
, writeText
|
|
|
|
, flutter
|
2022-12-17 10:02:37 +00:00
|
|
|
, python3
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pcre2
|
2023-08-22 20:05:09 +00:00
|
|
|
, libnotify
|
|
|
|
, libappindicator
|
|
|
|
, pkg-config
|
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
|
|
|
}:
|
2023-04-29 16:46:19 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
flutter.buildFlutterApplication rec {
|
2023-01-11 07:51:40 +00:00
|
|
|
pname = "yubioath-flutter";
|
2023-08-22 20:05:09 +00:00
|
|
|
version = "6.2.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-08-22 20:05:09 +00:00
|
|
|
hash = "sha256-NgzijuvyWNl9sFQzq1Jzk1povF8c/rKuVyVKeve+Vic=";
|
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
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
pubspecLock = lib.importJSON ./pubspec.lock.json;
|
2022-12-17 10:02:37 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
2023-10-09 19:29:22 +00:00
|
|
|
rm -f pubspec.lock
|
|
|
|
ln -s "${writeText "${pname}-overrides.yaml" (builtins.toJSON {
|
|
|
|
dependency_overrides.intl = "^0.18.1";
|
|
|
|
})}" pubspec_overrides.yaml
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
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"
|
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-08-22 20:05:09 +00:00
|
|
|
pkg-config
|
2023-01-11 07:51:40 +00:00
|
|
|
];
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
buildInputs = [
|
|
|
|
pcre2
|
2023-08-22 20:05:09 +00:00
|
|
|
libnotify
|
|
|
|
libappindicator
|
2022-12-17 10:02:37 +00:00
|
|
|
];
|
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 ];
|
2023-04-29 16:46:19 +00:00
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
2023-01-11 07:51:40 +00:00
|
|
|
};
|
2022-12-17 10:02:37 +00:00
|
|
|
}
|