2022-06-04 09:03:02 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoreconfHook
|
|
|
|
, libassuan
|
|
|
|
, libgpg-error
|
|
|
|
, libiconv
|
|
|
|
, texinfo
|
2022-08-16 18:19:50 +02:00
|
|
|
, common-updater-scripts
|
|
|
|
, writers
|
2022-06-04 09:03:02 +02:00
|
|
|
, Cocoa
|
|
|
|
}:
|
2016-01-09 02:06:24 +01:00
|
|
|
|
2022-06-04 09:03:02 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2021-02-03 16:31:51 +01:00
|
|
|
pname = "pinentry-mac";
|
2022-08-16 18:19:50 +02:00
|
|
|
|
|
|
|
# NOTE: Don't update manually. Use passthru.updateScript on a Mac with XCode
|
|
|
|
# installed.
|
2022-06-04 09:03:02 +02:00
|
|
|
version = "1.1.1.1";
|
2016-01-09 02:06:24 +01:00
|
|
|
|
2017-04-12 09:59:54 +02:00
|
|
|
src = fetchFromGitHub {
|
2022-06-04 09:03:02 +02:00
|
|
|
owner = "GPGTools";
|
|
|
|
repo = "pinentry";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "sha256-QnDuqFrI/U7aZ5WcOCp5vLE+w59LVvDGOFNQy9fSy70=";
|
2016-01-09 02:06:24 +01:00
|
|
|
};
|
|
|
|
|
2022-08-16 18:19:50 +02:00
|
|
|
# use pregenerated nib files because generating them requires XCode
|
2022-06-04 09:03:02 +02:00
|
|
|
postPatch = ''
|
2022-08-16 18:19:50 +02:00
|
|
|
cp -r ${./mac/Main.nib} macosx/Main.nib
|
|
|
|
cp -r ${./mac/Pinentry.nib} macosx/Pinentry.nib
|
|
|
|
chmod -R u+w macosx/*.nib
|
2022-06-04 09:03:02 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ autoreconfHook texinfo ];
|
|
|
|
buildInputs = [ libassuan libgpg-error libiconv Cocoa ];
|
|
|
|
|
|
|
|
configureFlags = [ "--enable-maintainer-mode" "--disable-ncurses" ];
|
2017-04-09 11:24:16 +02:00
|
|
|
|
2016-01-09 02:06:24 +01:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/Applications
|
2022-06-04 09:03:02 +02:00
|
|
|
mv macosx/pinentry-mac.app $out/Applications
|
2016-01-09 02:06:24 +01:00
|
|
|
'';
|
|
|
|
|
2022-08-16 18:19:50 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2016-06-17 11:27:59 +02:00
|
|
|
passthru = {
|
|
|
|
binaryPath = "Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac";
|
2022-08-16 18:19:50 +02:00
|
|
|
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
|
|
|
|
'';
|
2016-06-17 11:27:59 +02:00
|
|
|
};
|
|
|
|
|
2016-01-09 02:06:24 +01:00
|
|
|
meta = {
|
|
|
|
description = "Pinentry for GPG on Mac";
|
2021-01-15 10:19:50 +01:00
|
|
|
license = lib.licenses.gpl2Plus;
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/GPGTools/pinentry-mac";
|
2021-01-15 10:19:50 +01:00
|
|
|
platforms = lib.platforms.darwin;
|
2016-01-09 02:06:24 +01:00
|
|
|
};
|
|
|
|
}
|