about summary refs log tree commit diff
path: root/pkgs/applications/misc/yubioath-flutter
diff options
context:
space:
mode:
authorIlan Joselevich <personal@ilanjoselevich.com>2022-12-29 22:56:06 +0200
committerIlan Joselevich <personal@ilanjoselevich.com>2022-12-29 22:56:06 +0200
commitcb8de6b9103498e188afff5f26018a1174574963 (patch)
treeca8d514acec0015c45e8615601f3b72706aac4c6 /pkgs/applications/misc/yubioath-flutter
parent63910891c25e1ded1c36186d527375c3d7d4737c (diff)
yubioath-flutter: slight refactor and cleanup
Diffstat (limited to 'pkgs/applications/misc/yubioath-flutter')
-rw-r--r--pkgs/applications/misc/yubioath-flutter/default.nix52
-rw-r--r--pkgs/applications/misc/yubioath-flutter/helper.nix2
2 files changed, 33 insertions, 21 deletions
diff --git a/pkgs/applications/misc/yubioath-flutter/default.nix b/pkgs/applications/misc/yubioath-flutter/default.nix
index d858605e9044b..11e414677cd6b 100644
--- a/pkgs/applications/misc/yubioath-flutter/default.nix
+++ b/pkgs/applications/misc/yubioath-flutter/default.nix
@@ -5,53 +5,65 @@
 , stdenv
 , pcre2
 }:
-
 let
   vendorHashes = {
     x86_64-linux = "sha256-BwhWA8N0S55XkljDKPNkDhsj0QSpmJJ5MwEnrPjymS8=";
     aarch64-linux = "sha256-T1aGz3+2Sls+rkUVDUo39Ky2igg+dxGSUaf3qpV7ovQ=";
   };
-
+in
+flutter.mkFlutterApp rec {
+  pname = "yubioath-flutter";
   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;
+  passthru.helper = python3.pkgs.callPackage ./helper.nix { inherit src version meta; };
 
-  vendorHash = vendorHashes."${stdenv.system}";
+  vendorHash = vendorHashes.${stdenv.system};
 
   postPatch = ''
     substituteInPlace linux/CMakeLists.txt \
-      --replace "../build/linux/helper" "${helper}/libexec/helper"
+      --replace "../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/
+    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"
+    ln -fs "${passthru.helper}/bin/authenticator-helper" "$out/app/helper/authenticator-helper"
+
+    # 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" \
+      --replace "@EXEC_PATH/authenticator" "$out/bin/yubioath-flutter"
   '';
 
   buildInputs = [
     pcre2
   ];
+
+  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;
+  };
 }
diff --git a/pkgs/applications/misc/yubioath-flutter/helper.nix b/pkgs/applications/misc/yubioath-flutter/helper.nix
index a37ae01990ab2..12e5f52d6b2e7 100644
--- a/pkgs/applications/misc/yubioath-flutter/helper.nix
+++ b/pkgs/applications/misc/yubioath-flutter/helper.nix
@@ -12,7 +12,7 @@
 , meta
 }:
 
-buildPythonApplication rec {
+buildPythonApplication {
   pname = "yubioath-flutter-helper";
   inherit src version meta;