Unverified Commit 585bc6f8 authored by Doron Behar's avatar Doron Behar Committed by GitHub
Browse files

sequoia-chameleon-gnupg: add wrappers to mimic gpg (#507547)

parents 6b07a476 f195e55d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
#!@execlineb@ -s0
pipeline -w { @sed@ -e "s|^gpg:OpenPGP:.*/bin/gpg$|gpg:OpenPGP:@out@/bin/gpg|" }
@gpgconf@ $@
+25 −1
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  rustPlatform,
  fetchFromGitLab,
  pkg-config,
  makeWrapper,
  nettle,
  openssl,
  sqlite,
  gnupg,
  execline,
  gnused,
}:

rustPlatform.buildRustPackage rec {
@@ -25,6 +28,7 @@ rustPlatform.buildRustPackage rec {
  nativeBuildInputs = [
    rustPlatform.bindgenHook
    pkg-config
    makeWrapper
  ];

  buildInputs = [
@@ -33,6 +37,26 @@ rustPlatform.buildRustPackage rec {
    sqlite
  ];

  postInstall = ''
    # Wrap to find gpg-agent from GnuPG.
    makeWrapper $out/bin/gpg-sq $out/bin/gpg \
      --suffix PATH : ${lib.makeBinPath [ gnupg ]}
    makeWrapper $out/bin/gpgv-sq $out/bin/gpgv \
      --suffix PATH : ${lib.makeBinPath [ gnupg ]}

    # Modify the output of gpgconf to resolve gpg to this package.
    substitute ${./gpgconf.el} $out/bin/gpgconf \
      --subst-var-by execlineb ${lib.getExe' execline "execlineb"} \
      --subst-var-by gpgconf ${lib.getExe' gnupg "gpgconf"} \
      --subst-var-by sed ${lib.getExe' gnused "sed"} \
      --subst-var out

    # Additional wrappers.
    chmod +x $out/bin/gpgconf
    ln -s gpg $out/bin/gpg2
    ln -s ${lib.getExe' gnupg "gpg"} $out/bin/gpg-g10code
  '';

  # gpgconf: error creating socket directory
  doCheck = false;

+10 −5
Original line number Diff line number Diff line
@@ -108,14 +108,12 @@ stdenv.mkDerivation rec {
    cp "contrib/dmenu/passmenu" "$out/bin/"
  '';

  wrapperPath = lib.makeBinPath (
  wrapperPathPrefix = lib.makeBinPath (
    [
      coreutils
      findutils
      getopt
      git
      gnugrep
      gnupg
      gnused
      tree
      which
@@ -136,6 +134,11 @@ stdenv.mkDerivation rec {
    ]
  );

  wrapperPathSuffix = lib.makeBinPath [
    git
    gnupg
  ];

  postFixup = ''
    # Fix program name in --help
    substituteInPlace $out/bin/pass \
@@ -143,13 +146,15 @@ stdenv.mkDerivation rec {

    # Ensure all dependencies are in PATH
    wrapProgram $out/bin/pass \
      --prefix PATH : "${wrapperPath}"
      --prefix PATH : "${wrapperPathPrefix}" \
      --suffix PATH : "${wrapperPathSuffix}"
  ''
  + lib.optionalString dmenuSupport ''
    # We just wrap passmenu with the same PATH as pass. It doesn't
    # need all the tools in there but it doesn't hurt either.
    wrapProgram $out/bin/passmenu \
      --prefix PATH : "$out/bin:${wrapperPath}"
      --prefix PATH : "$out/bin:${wrapperPathPrefix}" \
      --suffix PATH : "${wrapperPathSuffix}"
  '';

  # Turn "check" into "installcheck", since we want to test our pass,