diff --git a/.editorconfig b/.editorconfig index 3c7962ab4d8b..a4f216d71a22 100644 --- a/.editorconfig +++ b/.editorconfig @@ -60,6 +60,13 @@ indent_size = unset [*.md] trim_trailing_whitespace = unset +# binaries +[*.nib] +end_of_line = unset +insert_final_newline = unset +trim_trailing_whitespace = unset +charset = unset + [eggs.nix] trim_trailing_whitespace = unset diff --git a/pkgs/tools/security/pinentry/mac.nix b/pkgs/tools/security/pinentry/mac.nix index 27917ffbbf17..daf2d82d66b0 100644 --- a/pkgs/tools/security/pinentry/mac.nix +++ b/pkgs/tools/security/pinentry/mac.nix @@ -1,32 +1,78 @@ -{ lib, stdenv, fetchFromGitHub, xcbuildHook, libiconv, ncurses, Cocoa }: +{ lib +, stdenv +, fetchFromGitHub +, autoreconfHook +, libassuan +, libgpg-error +, libiconv +, texinfo +, common-updater-scripts +, writers +, Cocoa +}: -stdenv.mkDerivation { +stdenv.mkDerivation rec { pname = "pinentry-mac"; - version = "0.9.4"; + + # NOTE: Don't update manually. Use passthru.updateScript on a Mac with XCode + # installed. + version = "1.1.1.1"; src = fetchFromGitHub { - owner = "matthewbauer"; - repo = "pinentry-mac"; - rev = "6dfef256c8ea32d642fea847f27d800f024cf51e"; - sha256 = "0g75302697gqcxyf2hyqzvcbd5pyss1bl2xvfd40wqav7dlyvj83"; + owner = "GPGTools"; + repo = "pinentry"; + rev = "v${version}"; + sha256 = "sha256-QnDuqFrI/U7aZ5WcOCp5vLE+w59LVvDGOFNQy9fSy70="; }; - nativeBuildInputs = [ xcbuildHook ]; - buildInputs = [ libiconv ncurses Cocoa ]; - - preBuild = '' - # Only build for what we care about (also allows arm64) - substituteInPlace pinentry-mac.xcodeproj/project.pbxproj \ - --replace "i386 x86_64 ppc" "${stdenv.targetPlatform.darwinArch}" + # use pregenerated nib files because generating them requires XCode + postPatch = '' + cp -r ${./mac/Main.nib} macosx/Main.nib + cp -r ${./mac/Pinentry.nib} macosx/Pinentry.nib + chmod -R u+w macosx/*.nib ''; + nativeBuildInputs = [ autoreconfHook texinfo ]; + buildInputs = [ libassuan libgpg-error libiconv Cocoa ]; + + configureFlags = [ "--enable-maintainer-mode" "--disable-ncurses" ]; + installPhase = '' mkdir -p $out/Applications - mv Products/Release/pinentry-mac.app $out/Applications + mv macosx/pinentry-mac.app $out/Applications ''; + enableParallelBuilding = true; + passthru = { binaryPath = "Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac"; + updateScript = writers.writeBash "update-pinentry-mac" '' + set -euxo pipefail + + main() { + tag="$(queryLatestTag)" + ver="$(expr "$tag" : 'v\(.*\)')" + + ${common-updater-scripts}/bin/update-source-version pinentry_mac "$ver" + + cd ${lib.escapeShellArg ./.} + rm -rf mac + mkdir mac + + srcDir="$(nix-build ../../../.. --no-out-link -A pinentry_mac.src)" + for path in "$srcDir"/macosx/*.xib; do + filename="''${path##*/}" + /usr/bin/ibtool --compile "mac/''${filename%.*}.nib" "$path" + done + } + + queryLatestTag() { + curl -sS https://api.github.com/repos/GPGTools/pinentry/tags \ + | jq -r '.[] | .name' | sort --version-sort | tail -1 + } + + main + ''; }; meta = { diff --git a/pkgs/tools/security/pinentry/mac/Main.nib/keyedobjects-101300.nib b/pkgs/tools/security/pinentry/mac/Main.nib/keyedobjects-101300.nib new file mode 100644 index 000000000000..18cc1c8b46f5 Binary files /dev/null and b/pkgs/tools/security/pinentry/mac/Main.nib/keyedobjects-101300.nib differ diff --git a/pkgs/tools/security/pinentry/mac/Main.nib/keyedobjects.nib b/pkgs/tools/security/pinentry/mac/Main.nib/keyedobjects.nib new file mode 100644 index 000000000000..90635122ffdc Binary files /dev/null and b/pkgs/tools/security/pinentry/mac/Main.nib/keyedobjects.nib differ diff --git a/pkgs/tools/security/pinentry/mac/Pinentry.nib/keyedobjects-101300.nib b/pkgs/tools/security/pinentry/mac/Pinentry.nib/keyedobjects-101300.nib new file mode 100644 index 000000000000..6df3d5f46227 Binary files /dev/null and b/pkgs/tools/security/pinentry/mac/Pinentry.nib/keyedobjects-101300.nib differ diff --git a/pkgs/tools/security/pinentry/mac/Pinentry.nib/keyedobjects.nib b/pkgs/tools/security/pinentry/mac/Pinentry.nib/keyedobjects.nib new file mode 100644 index 000000000000..aa8bca0d085e Binary files /dev/null and b/pkgs/tools/security/pinentry/mac/Pinentry.nib/keyedobjects.nib differ diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b6ff5da1d143..fdb78390032d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9830,7 +9830,6 @@ with pkgs; pinentry_mac = callPackage ../tools/security/pinentry/mac.nix { inherit (darwin.apple_sdk.frameworks) Cocoa; - xcbuildHook = if stdenv.targetPlatform.isAarch64 then xcbuildHook else xcbuild6Hook; }; pinentry-bemenu = callPackage ../tools/security/pinentry-bemenu { };