Unverified Commit 55966961 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

mullvad: 2024.4 -> 2024.6, 2024.6 -> 2024.7 (#350746)

parents 984803d7 07f09fcb
Loading
Loading
Loading
Loading
+492 −212

File changed.

Preview size limit exceeded, changes collapsed.

+7 −7
Original line number Diff line number Diff line
@@ -10,19 +10,19 @@ buildGoModule {
    src
    ;

  sourceRoot = "${mullvad.src.name}/wireguard/libwg";

  vendorHash = "sha256-gaU3na3sjzM6lvmsGRkuGtV2AHvkl6IgzmyGx3R5ZpM=";
  modRoot = "wireguard-go-rs/libwg";
  proxyVendor = true;
  vendorHash = "sha256-uyAzY1hoCtS7da3wtjxTGx5wBb9c9m749TzihVr94rc=";

  # XXX: hack to make the ar archive go to the correct place
  # This is necessary because passing `-o ...` to `ldflags` does not work
  # (this doesn't get communicated everywhere in the chain, apparently, so
  # `go` complains that it can't find an `a.out` file).
  GOBIN = "${placeholder "out"}/lib";
  ldflags = [ "-s" "-w" "-buildmode=c-archive" ];

  patches = [
 ];
  subPackages = [ "." ];
  ldflags = [ "-s" "-w" "-buildmode=c-archive" ];
  tags = [ "daita" ];

  postInstall = ''
    mv $out/lib/libwg{,.a}
@@ -30,7 +30,7 @@ buildGoModule {

  meta = with lib; {
    description = "Tiny wrapper around wireguard-go";
    homepage = "https://github.com/mullvad/mullvadvpn-app/tree/main/wireguard/libwg";
    homepage = "https://github.com/mullvad/mullvadvpn-app/tree/main/wireguard-go-rs/libwg";
    license = licenses.gpl3Only;
    maintainers = with maintainers; [ cole-h ];
  };
+14 −9
Original line number Diff line number Diff line
@@ -14,16 +14,27 @@
, openvpn-mullvad
, shadowsocks-rust
, installShellFiles
, writeShellScriptBin
}:
let
  # NOTE(cole-h): This is necessary because wireguard-go-rs executes go in its build.rs (whose goal
  # is to  produce $OUT_DIR/libwg.a), and a mixed Rust-Go build is non-trivial (read: I didn't want
  # to attempt it). So, we just fake the "go" binary and do what it would have done: put libwg.a
  # under $OUT_DIR so that it can be linked against.
  fakeGoCopyLibwg = writeShellScriptBin "go" ''
    [ ! -e "$OUT_DIR"/libwg.a ] && cp ${libwg}/lib/libwg.a "$OUT_DIR"/libwg.a
  '';
in
rustPlatform.buildRustPackage rec {
  pname = "mullvad";
  version = "2024.4";
  version = "2024.7";

  src = fetchFromGitHub {
    owner = "mullvad";
    repo = "mullvadvpn-app";
    rev = version;
    hash = "sha256-d7poR1NnvqaPutXLFizpQnyipl+38N1Qe2zVXeV7v1Q=";
    fetchSubmodules = true;
    hash = "sha256-me0e8Cb1dRrnAeiCmsXiclcDMruVLV3t0eGAM3RU1es=";
  };

  cargoLock = {
@@ -41,6 +52,7 @@ rustPlatform.buildRustPackage rec {
    makeWrapper
    git
    installShellFiles
    fakeGoCopyLibwg
  ];

  buildInputs = [
@@ -49,13 +61,6 @@ rustPlatform.buildRustPackage rec {
    libmnl
  ];

  # talpid-core wants libwg.a in build/lib/{triple}
  preBuild = ''
    dest=build/lib/${stdenv.hostPlatform.config}
    mkdir -p $dest
    ln -s ${libwg}/lib/libwg.a $dest
  '';

  postInstall = ''
    compdir=$(mktemp -d)
    for shell in bash zsh fish; do