Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add NetworkManager-sstp #28616

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions nixos/modules/config/no-x-libs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ with lib;
dbus = pkgs.dbus.override { x11Support = false; };
networkmanager_fortisslvpn = pkgs.networkmanager_fortisslvpn.override { withGnome = false; };
networkmanager_l2tp = pkgs.networkmanager_l2tp.override { withGnome = false; };
networkmanager_sstp = pkgs.networkmanager_sstp.override { withGnome = false; };
networkmanager_openconnect = pkgs.networkmanager_openconnect.override { withGnome = false; };
networkmanager_openvpn = pkgs.networkmanager_openvpn.override { withGnome = false; };
networkmanager_pptp = pkgs.networkmanager_pptp.override { withGnome = false; };
Expand Down
6 changes: 5 additions & 1 deletion nixos/modules/services/networking/networkmanager.nix
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ in {
default = { inherit networkmanager modemmanager wpa_supplicant
networkmanager_openvpn networkmanager_vpnc
networkmanager_openconnect networkmanager_fortisslvpn
networkmanager_pptp networkmanager_l2tp; };
networkmanager_pptp networkmanager_l2tp
networkmanager_sstp; };
internal = true;
};

Expand Down Expand Up @@ -252,6 +253,9 @@ in {
{ source = "${networkmanager_l2tp}/etc/NetworkManager/VPN/nm-l2tp-service.name";
target = "NetworkManager/VPN/nm-l2tp-service.name";
}
{ source = "${networkmanager_sstp}/etc/NetworkManager/VPN/nm-sstp-service.name";
target = "NetworkManager/VPN/nm-sstp-service.name";
}
{ source = "${networkmanager_strongswan}/etc/NetworkManager/VPN/nm-strongswan-service.name";
target = "NetworkManager/VPN/nm-strongswan-service.name";
}
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/desktop-managers/gnome3.nix
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ in {
{ inherit (pkgs) networkmanager modemmanager wpa_supplicant;
inherit (gnome3) networkmanager_openvpn networkmanager_vpnc
networkmanager_openconnect networkmanager_fortisslvpn networkmanager_pptp
networkmanager_l2tp; };
networkmanager_l2tp networkmanager_sstp; };

# Needed for themes and backgrounds
environment.pathsToLink = [ "/share" ];
Expand Down
4 changes: 4 additions & 0 deletions pkgs/desktops/gnome-3/3.22/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ let
inherit gnome3;
};

networkmanager_sstp = pkgs.networkmanager_sstp.override {
inherit gnome3;
};

networkmanagerapplet = pkgs.networkmanagerapplet.override {
inherit gnome3 gsettings_desktop_schemas glib_networking;
};
Expand Down
38 changes: 38 additions & 0 deletions pkgs/tools/networking/network-manager/sstp.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{ stdenv, fetchFromGitHub, networkmanager, sstp-client, ppp, intltool
, pkgconfig, libsecret, withGnome ? true, gnome3 }:

stdenv.mkDerivation rec {
name = "${pname}${if withGnome then "-gnome" else ""}-${version}";
pname = "NetworkManager-sstp";
major = "1.2";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you splitting the version?

version = "${major}.2";

src = fetchFromGitHub {
owner = "enaess";
repo = "network-manager-sstp";
rev = "${version}";
sha256 = "4449b09c7debaf6b086ca020052b55beb86753ad6b22180db1b8dde824b7340d";
};

buildInputs = [ networkmanager sstp-client ppp libsecret ]
++ stdenv.lib.optionals withGnome [ gnome3.gtk gnome3.libgnome_keyring
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

libgnome-keyring was replaced by libsecret.

gnome3.networkmanagerapplet ];

nativeBuildInputs = [ intltool pkgconfig ];

postPatch = ''
sed -i -e 's%"\(/usr/sbin\|/usr/pkg/sbin\|/usr/local/sbin\)/[^"]*",%%g' ./src/nm-sstp-service.c

substituteInPlace ./src/nm-sstp-service.c \
--replace /sbin/sstp-client ${sstp-client}/bin/sstp-client \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file contains /sbin/sstpc instead of /sbin/sstp-client.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, using a patch with substituteAll would be better, as it prevents trivial errors like this one.

--replace /sbin/pppd ${ppp}/bin/pppd
'';

configureFlags =
if withGnome then "--with-gnome --with-gtkver=3" else "--without-gnome";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configureFlags are preferred to form a list instead of string of space-separated list. This will be more future-proof (#15799).


meta = {
description = "SSTP plugin for NetworkManager";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a license.

inherit (networkmanager.meta) maintainers platforms;
};
}
6 changes: 4 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3378,6 +3378,8 @@ with pkgs;

networkmanager_l2tp = callPackage ../tools/networking/network-manager/l2tp.nix { };

networkmanager_sstp = callPackage ../tools/networking/network-manager/sstp.nix { };

networkmanager_vpnc = callPackage ../tools/networking/network-manager/vpnc.nix { };

networkmanager_openconnect = callPackage ../tools/networking/network-manager/openconnect.nix { };
Expand Down Expand Up @@ -11096,7 +11098,7 @@ with pkgs;
dex-oidc = callPackage ../servers/dex { };

dgraph = callPackage ../servers/dgraph { };

dico = callPackage ../servers/dico { };

dict = callPackage ../servers/dict {
Expand Down Expand Up @@ -18678,7 +18680,7 @@ with pkgs;
hplip_3_15_9 = callPackage ../misc/drivers/hplip/3.15.9.nix { };

hplipWithPlugin_3_15_9 = hplip_3_15_9.override { withPlugin = true; };

epkowa = callPackage ../misc/drivers/epkowa { };

illum = callPackage ../tools/system/illum { };
Expand Down