Merge pull request #203743 from lukegb/yubioath-flutter

yubioath-flutter: init at 6.0.2
This commit is contained in:
Luke Granger-Brown 2022-12-03 12:10:43 -08:00 committed by GitHub
commit d6b617b124
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 177 additions and 3 deletions

View File

@ -0,0 +1,57 @@
{ lib
, flutter
, python3
, fetchFromGitHub
, stdenv
, pcre2
}:
let
vendorHashes = {
x86_64-linux = "sha256-BwhWA8N0S55XkljDKPNkDhsj0QSpmJJ5MwEnrPjymS8=";
aarch64-linux = "sha256-T1aGz3+2Sls+rkUVDUo39Ky2igg+dxGSUaf3qpV7ovQ=";
};
version = "6.0.2";
src = fetchFromGitHub {
owner = "Yubico";
repo = "yubioath-flutter";
rev = version;
sha256 = "13nh5qpq02c6azfdh4cbzhlrq0hs9is45q5z5cnxg84hrx26hd4k";
};
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;
};
helper = python3.pkgs.callPackage ./helper.nix { inherit src version meta; };
in
flutter.mkFlutterApp rec {
pname = "yubioath-flutter";
inherit src version meta;
passthru.helper = helper;
vendorHash = vendorHashes."${stdenv.system}";
postPatch = ''
substituteInPlace linux/CMakeLists.txt \
--replace "../build/linux/helper" "${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 "${helper}/bin/authenticator-helper" "$out/app/helper/authenticator-helper"
'';
buildInputs = [
pcre2
];
}

View File

@ -0,0 +1,44 @@
{ buildPythonApplication
, poetry-core
, yubikey-manager
, fido2
, mss
, zxing_cpp
, pillow
, cryptography
, src
, version
, meta
}:
buildPythonApplication rec {
pname = "yubioath-flutter-helper";
inherit src version meta;
sourceRoot = "source/helper";
format = "pyproject";
postPatch = ''
sed -i \
-e 's,zxing-cpp = .*,zxing-cpp = "*",g' \
-e 's,mss = .*,mss = "*",g' \
pyproject.toml
'';
postInstall = ''
install -Dm 0755 authenticator-helper.py $out/bin/authenticator-helper
install -d $out/libexec/helper
ln -fs $out/bin/authenticator-helper $out/libexec/helper/authenticator-helper
'';
propagatedBuildInputs = [
poetry-core
yubikey-manager
fido2
mss
zxing_cpp
pillow
cryptography
];
}

View File

@ -88,7 +88,8 @@ let
# so we can use lock, diff yaml
cp "pubspec.yaml" "$RES"
cp "pubspec.lock" "$RES"
mv .dart_tool .flutter-plugins .flutter-plugins-dependencies .packages "$RES/f"
[[ -e .packages ]] && mv .packages "$RES/f"
mv .dart_tool .flutter-plugins .flutter-plugins-dependencies "$RES/f"
# replace paths with placeholders
find "$RES" -type f -exec sed -i \
@ -119,7 +120,7 @@ let
find "$RES/.pub-cache" -iname "*.json" -exec sed -r 's|.*_fetchedAt.*| "_fetchedAt": "'"$DART_DATE"'",|g' -i {} +
replace_line_matching "$RES/f/.dart_tool/package_config.json" '"generated"' '"generated": "'"$DART_DATE"'",'
replace_line_matching "$RES/f/.flutter-plugins-dependencies" '"date_created"' '"date_created": "'"$DART_DATE"'",'
remove_line_matching "$RES/f/.packages" "Generated by pub"
[[ -e "$RES/f/.packages" ]] && remove_line_matching "$RES/f/.packages" "Generated by pub"
# nuke refs
find "$RES" -type f -exec nuke-refs {} +

View File

@ -3,6 +3,7 @@
, fetchFromGitHub
, pkg-config
, cmake
, python3
}:
stdenv.mkDerivation rec {
@ -37,6 +38,10 @@ stdenv.mkDerivation rec {
--replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
'';
passthru.tests = {
inherit (python3.pkgs) zxing_cpp;
};
meta = with lib; {
homepage = "https://github.com/nu-book/zxing-cpp";
description = "C++ port of zxing (a Java barcode image processing library)";

View File

@ -0,0 +1,49 @@
{ buildPythonPackage
, lib
, cmake
, pybind11
, zxing-cpp
, numpy
, pillow
}:
buildPythonPackage rec {
pname = "zxing_cpp";
inherit (zxing-cpp) src version;
sourceRoot = "source/wrappers/python";
patches = [
./use-nixpkgs-pybind11.patch
];
dontUseCmakeConfigure = true;
propagatedBuildInputs = [
pybind11
numpy
];
nativeBuildInputs = [
cmake
];
checkInputs = [
pillow
];
meta = with lib; {
homepage = "https://github.com/zxing-cpp/zxing-cpp";
description = "Python bindings for C++ port of zxing (a Java barcode image processing library)";
longDescription = ''
ZXing-C++ ("zebra crossing") is an open-source, multi-format 1D/2D barcode
image processing library implemented in C++.
It was originally ported from the Java ZXing Library but has been
developed further and now includes many improvements in terms of quality
and performance. It can both read and write barcodes in a number of
formats.
'';
license = licenses.asl20;
maintainers = with maintainers; [ lukegb ];
platforms = with platforms; unix;
};
}

View File

@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eadfc045..b6f273a6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,8 +20,7 @@ if (NOT hasParent)
# In development mode, when the whole zxing-cpp directory is checked out, build against head code.
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../core ZXing EXCLUDE_FROM_ALL)
- include(${CMAKE_CURRENT_SOURCE_DIR}/../../zxing.cmake)
- zxing_add_package(pybind11 pybind11 ${pybind11_git_repo} ${pybind11_git_rev})
+ find_package(pybind11 CONFIG)
else()
# we don't have access to the top-level cmake helpers -> simply fetch it unconditional
include(FetchContent)

View File

@ -1645,7 +1645,7 @@ mapAliases ({
youtubeDL = throw "'youtubeDL' has been renamed to/replaced by 'youtube-dl'"; # Converted to throw 2022-02-22
ytop = throw "ytop has been abandoned by upstream. Consider switching to bottom instead";
yubikey-neo-manager = throw "yubikey-neo-manager has been removed because it was broken. Use yubikey-manager-qt instead"; # Added 2021-03-08
yubioath-desktop = throw "yubioath-desktop has been deprecated by upstream in favor of https://github.com/Yubico/yubioath-flutter"; # Added 2022-11-22
yubioath-desktop = throw "yubioath-desktop has been deprecated by upstream in favor of yubioath-flutter"; # Added 2022-11-22
yuzu-ea = yuzu-early-access; # Added 2022-08-18
yuzu = yuzu-mainline; # Added 2021-01-25

View File

@ -23260,6 +23260,8 @@ with pkgs;
yubihsm-shell = callPackage ../tools/security/yubihsm-shell { };
yubioath-flutter = callPackage ../applications/misc/yubioath-flutter { };
zchunk = callPackage ../development/libraries/zchunk { };
zeitgeist = callPackage ../development/libraries/zeitgeist { };

View File

@ -12400,4 +12400,6 @@ self: super: with self; {
zwave-js-server-python = callPackage ../development/python-modules/zwave-js-server-python { };
zxcvbn = callPackage ../development/python-modules/zxcvbn { };
zxing_cpp = callPackage ../development/python-modules/zxing_cpp { };
}