nixos/connman: add option to use specific package

This commit is contained in:
Doron Behar 2020-03-28 12:06:54 +03:00
parent b03bf779ae
commit 480397693e

View File

@ -77,6 +77,13 @@ in {
''; '';
}; };
package = mkOption {
type = types.path;
description = "The connman package / build flavor";
default = connman;
example = literalExample "pkgs.connmanFull";
};
}; };
}; };
@ -93,7 +100,7 @@ in {
message = "You can not use services.connman with networking.networkmanager"; message = "You can not use services.connman with networking.networkmanager";
}]; }];
environment.systemPackages = [ connman ]; environment.systemPackages = [ cfg.package ];
systemd.services.connman = { systemd.services.connman = {
description = "Connection service"; description = "Connection service";
@ -105,7 +112,7 @@ in {
BusName = "net.connman"; BusName = "net.connman";
Restart = "on-failure"; Restart = "on-failure";
ExecStart = toString ([ ExecStart = toString ([
"${pkgs.connman}/sbin/connmand" "${cfg.package}/sbin/connmand"
"--config=${configFile}" "--config=${configFile}"
"--nodaemon" "--nodaemon"
] ++ optional enableIwd "--wifi=iwd_agent" ] ++ optional enableIwd "--wifi=iwd_agent"
@ -122,7 +129,7 @@ in {
serviceConfig = { serviceConfig = {
Type = "dbus"; Type = "dbus";
BusName = "net.connman.vpn"; BusName = "net.connman.vpn";
ExecStart = "${pkgs.connman}/sbin/connman-vpnd -n"; ExecStart = "${cfg.package}/sbin/connman-vpnd -n";
StandardOutput = "null"; StandardOutput = "null";
}; };
}; };
@ -132,7 +139,7 @@ in {
serviceConfig = { serviceConfig = {
Name = "net.connman.vpn"; Name = "net.connman.vpn";
before = [ "connman" ]; before = [ "connman" ];
ExecStart = "${pkgs.connman}/sbin/connman-vpnd -n"; ExecStart = "${cfg.package}/sbin/connman-vpnd -n";
User = "root"; User = "root";
SystemdService = "connman-vpn.service"; SystemdService = "connman-vpn.service";
}; };