about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/networking/networkmanager/sstp/default.nix
blob: 4178454c4292ed14b9b5cfb339a5674a9f76747c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{ stdenv
, lib
, fetchFromGitLab
, autoreconfHook
, file
, glib
, gnome
, gtk3
, gtk4
, gettext
, libnma
, libnma-gtk4
, libsecret
, networkmanager
, pkg-config
, ppp
, sstp
, withGnome ? true
}:

stdenv.mkDerivation rec {
  pname = "NetworkManager-sstp";
  version = "unstable-2023-03-09";
  name = "${pname}${lib.optionalString withGnome "-gnome"}-${version}";

  src = fetchFromGitLab {
    domain = "gitlab.gnome.org";
    owner = "GNOME";
    repo = "network-manager-sstp";
    rev = "852db07dc7d19c37e398d831410bd94c8659a210";
    hash = "sha256-DxgcuTza2G5a7F2mBtDaEuynu7F1Ex9pnAESAjyoRq8=";
  };

  nativeBuildInputs = [
    autoreconfHook
    file
    gettext
    pkg-config
  ];

  buildInputs = [
    sstp
    networkmanager
    glib
    ppp
  ] ++ lib.optionals withGnome [
    gtk3
    gtk4
    libsecret
    libnma
    libnma-gtk4
  ];

  postPatch = ''
    sed -i 's#/sbin/pppd#${ppp}/bin/pppd#' src/nm-sstp-service.c
    sed -i 's#/sbin/sstpc#${sstp}/bin/sstpc#' src/nm-sstp-service.c
  '';

  configureFlags = [
    "--with-gnome=${if withGnome then "yes" else "no"}"
    "--with-gtk4=${if withGnome then "yes" else "no"}"
    "--with-pppd-plugin-dir=$(out)/lib/pppd/2.5.0"
    "--enable-absolute-paths"
  ];

  passthru = {
    updateScript = gnome.updateScript {
      packageName = pname;
      attrPath = "networkmanager-sstp";
    };
    networkManagerPlugin = "VPN/nm-sstp-service.name";
  };

  meta = with lib; {
    description = "NetworkManager's sstp plugin";
    inherit (networkmanager.meta) maintainers platforms;
    license = licenses.gpl2Plus;
  };
}