nixpkgs/pkgs/by-name/yu/yubioath-flutter/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

98 lines
2.5 KiB
Nix

{
lib,
flutter324,
python3,
fetchFromGitHub,
pcre2,
libnotify,
libappindicator,
pkg-config,
gnome-screenshot,
makeWrapper,
removeReferencesTo,
}:
flutter324.buildFlutterApplication rec {
pname = "yubioath-flutter";
version = "7.1.1";
src = fetchFromGitHub {
owner = "Yubico";
repo = "yubioath-flutter";
rev = version;
hash = "sha256-MpY6yJvGBaFiEwuGEme2Uvyi5INCYhZJHyaRpC9pCuk=";
};
passthru.helper = python3.pkgs.callPackage ./helper.nix { inherit src version meta; };
pubspecLock = lib.importJSON ./pubspec.lock.json;
gitHashes = {
window_manager = "sha256-mLX51nbWFccsAfcqLQIYDjYz69y9wAz4U1RZ8TIYSj0=";
};
postPatch = ''
rm -f pubspec.lock
substituteInPlace linux/CMakeLists.txt \
--replace-fail "../build/linux/helper" "${passthru.helper}/libexec/helper"
'';
preInstall = ''
# Make sure we have permission to delete things CMake has copied in to our build directory from elsewhere.
chmod -R +w build
'';
postInstall = ''
# Swap the authenticator-helper symlink with the correct symlink.
ln -fs "${passthru.helper}/bin/authenticator-helper" "$out/app/$pname/helper/authenticator-helper"
# Move the icon.
mkdir $out/share/icons
mv $out/app/$pname/linux_support/com.yubico.yubioath.png $out/share/icons
# Cleanup.
rm -rf \
"$out/app/$pname/README.adoc" \
"$out/app/$pname/desktop_integration.sh" \
"$out/app/$pname/linux_support" \
$out/bin/* # We will repopulate this directory later.
# Symlink binary.
ln -sf "$out/app/$pname/authenticator" "$out/bin/yubioath-flutter"
# 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"
'';
# Needed for QR scanning to work
extraWrapProgramArgs = ''
--prefix PATH : ${lib.makeBinPath [ gnome-screenshot ]}
'';
nativeBuildInputs = [
makeWrapper
removeReferencesTo
pkg-config
];
buildInputs = [
pcre2
libnotify
libappindicator
];
meta = with lib; {
description = "Yubico Authenticator for Desktop";
mainProgram = "yubioath-flutter";
homepage = "https://github.com/Yubico/yubioath-flutter";
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = [
"x86_64-linux"
"aarch64-linux"
];
};
}