Unverified Commit 08f3ff19 authored by Robert Hensing's avatar Robert Hensing Committed by GitHub
Browse files

ghostunnel: fix darwin build, skip included vendor directory (#402420)

parents a4604fc5 c27dd8a8
Loading
Loading
Loading
Loading
+17 −9
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@
  fetchFromGitHub,
  lib,
  nixosTests,
  apple-sdk_12,
  darwinMinVersionHook,
}:

buildGoModule rec {
@@ -17,16 +19,20 @@ buildGoModule rec {
    hash = "sha256-NnRm1HEdfK6WI5ntilLSwdR2B5czG5CIcMFzl2TzEds=";
  };

  vendorHash = null;
  vendorHash = "sha256-vP8OtjpYNMm1KkNfD3pmNrHh3HRy1GkzUbfLKWKhHbo=";

  deleteVendor = true;

  # The certstore directory isn't recognized as a subpackage, but is when moved
  # into the vendor directory.
  postUnpack = ''
    mkdir -p $sourceRoot/vendor/ghostunnel
    mv $sourceRoot/certstore $sourceRoot/vendor/ghostunnel/
  '';
  buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
    apple-sdk_12
    (darwinMinVersionHook "12.0")
  ];

  # These tests don't exist for Linux, and on Darwin they attempt to use the macOS Keychain
  # which doesn't work from a nix build. Presumably other platform implementations of the
  # certstore would have similar issues, so it probably makes sense to skip them in
  # general wherever they are available.
  checkFlags = [ "-skip=^Test(ImportDelete|Signer|Certificate)(RSA|ECDSA|EC)$" ];

  passthru.tests = {
    nixos = nixosTests.ghostunnel;
@@ -34,12 +40,14 @@ buildGoModule rec {
  };

  meta = with lib; {
    broken = stdenv.hostPlatform.isDarwin;
    description = "TLS proxy with mutual authentication support for securing non-TLS backend applications";
    homepage = "https://github.com/ghostunnel/ghostunnel#readme";
    changelog = "https://github.com/ghostunnel/ghostunnel/releases/tag/v${version}";
    license = licenses.asl20;
    maintainers = with maintainers; [ roberth ];
    maintainers = with maintainers; [
      roberth
      mjm
    ];
    mainProgram = "ghostunnel";
  };
}