diff options
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/mail/opensmtpd.nix | 20 | ||||
-rw-r--r-- | nixos/modules/services/networking/networkmanager.nix | 5 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 6 | ||||
-rw-r--r-- | nixos/modules/tasks/network-interfaces.nix | 45 |
4 files changed, 51 insertions, 25 deletions
diff --git a/nixos/modules/services/mail/opensmtpd.nix b/nixos/modules/services/mail/opensmtpd.nix index a1cfd84365a..a3e50b42292 100644 --- a/nixos/modules/services/mail/opensmtpd.nix +++ b/nixos/modules/services/mail/opensmtpd.nix @@ -46,17 +46,6 @@ in { is left empty, the OpenSMTPD server will not start. ''; }; - - procPackages = mkOption { - type = types.listOf types.path; - default = []; - description = '' - Packages to search for filters, tables, queues, and schedulers. - - Add OpenSMTPD-extras here if you want to use the filters, etc. from - that package. - ''; - }; }; }; @@ -83,19 +72,12 @@ in { }; }; - systemd.services.opensmtpd = let - procEnv = pkgs.buildEnv { - name = "opensmtpd-procs"; - paths = [ opensmtpd ] ++ cfg.procPackages; - pathsToLink = [ "/libexec/opensmtpd" ]; - }; - in { + systemd.services.opensmtpd = { wantedBy = [ "multi-user.target" ]; wants = [ "network.target" ]; after = [ "network.target" ]; preStart = "mkdir -p /var/spool"; serviceConfig.ExecStart = "${opensmtpd}/sbin/smtpd -d -f ${conf} ${args}"; - environment.OPENSMTPD_PROC_PATH = "${procEnv}/libexec/opensmtpd"; }; environment.systemPackages = [ (pkgs.runCommand "opensmtpd-sendmail" {} '' diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix index 7df194fa419..19ff73ad1b8 100644 --- a/nixos/modules/services/networking/networkmanager.nix +++ b/nixos/modules/services/networking/networkmanager.nix @@ -72,10 +72,11 @@ let ${coreutils}/bin/rm -f $tmp $tmp.ns ''; + # pre-up and pre-down hooks were added in NM 0.9.10, but we still use 0.9.0 dispatcherTypesSubdirMap = { "basic" = ""; - "pre-up" = "pre-up.d/"; - "pre-down" = "pre-down.d/"; + /*"pre-up" = "pre-up.d/"; + "pre-down" = "pre-down.d/";*/ }; in { diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 4704b3981e4..0b7647093e0 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -69,6 +69,7 @@ let "systemd-journal-flush.service" "systemd-journal-gatewayd.socket" "systemd-journal-gatewayd.service" + "systemd-journald-audit.socket" "systemd-journald-dev-log.socket" "syslog.socket" @@ -99,7 +100,7 @@ let # Maintaining state across reboots. "systemd-random-seed.service" "systemd-backlight@.service" - "systemd-rfkill@.service" + "systemd-rfkill.service" # Hibernate / suspend. "hibernate.target" @@ -109,8 +110,6 @@ let "systemd-hibernate.service" "systemd-suspend.service" "systemd-hybrid-sleep.service" - "systemd-shutdownd.socket" - "systemd-shutdownd.service" # Reboot stuff. "reboot.target" @@ -758,7 +757,6 @@ in systemd.services."systemd-rfkill@".restartIfChanged = false; systemd.services."user@".restartIfChanged = false; systemd.services.systemd-journal-flush.restartIfChanged = false; - systemd.services.systemd-journald.restartIfChanged = false; # FIXME: shouldn't be necessary with systemd 219 systemd.services.systemd-random-seed.restartIfChanged = false; systemd.services.systemd-remount-fs.restartIfChanged = false; systemd.services.systemd-update-utmp.restartIfChanged = false; diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix index 2d6522a1bf9..d042ee094cf 100644 --- a/nixos/modules/tasks/network-interfaces.nix +++ b/nixos/modules/tasks/network-interfaces.nix @@ -46,6 +46,51 @@ let ''; }); + # Collect all interfaces that are defined for a device + # as device:interface key:value pairs. + wlanDeviceInterfaces = + let + allDevices = unique (mapAttrsToList (_: v: v.device) cfg.wlanInterfaces); + interfacesOfDevice = d: filterAttrs (_: v: v.device == d) cfg.wlanInterfaces; + in + genAttrs allDevices (d: interfacesOfDevice d); + + # Convert device:interface key:value pairs into a list, and if it exists, + # place the interface which is named after the device at the beginning. + wlanListDeviceFirst = device: interfaces: + if hasAttr device interfaces + then [{"${device}"=interfaces.device; _iName=device;}] ++ mapAttrsToList (n: v: v//{_iName=n;}) (filterAttrs (n: _: n!=device) interfaces) + else mapAttrsToList (n: v: v // {_iName = n;}) interfaces; + + # udev script that configures a physical wlan device and adds virtual interfaces + wlanDeviceUdevScript = device: interfaceList: pkgs.writeScript "wlan-${device}-udev-script" '' + #!${pkgs.stdenv.shell} + + # Change the wireless phy device to a predictable name. + if [ -e "/sys/class/net/${device}/phy80211/name" ]; then + ${pkgs.iw}/bin/iw phy `${pkgs.coreutils}/bin/cat /sys/class/net/${device}/phy80211/name` set name ${device} || true + fi + + # Crate new, virtual interfaces and configure them at the same time + ${flip concatMapStrings (drop 1 interfaceList) (i: '' + ${pkgs.iw}/bin/iw dev ${device} interface add ${i._iName} type ${i.type} \ + ${optionalString (i.type == "mesh" && i.meshID != null) "mesh_id ${i.meshID}"} \ + ${optionalString (i.type == "monitor" && i.flags != null) "flags ${i.flags}"} \ + ${optionalString (i.type == "managed" && i.fourAddr != null) "4addr ${if i.fourAddr then "on" else "off"}"} \ + ${optionalString (i.mac != null) "addr ${i.mac}"} + '')} + + # Reconfigure and rename the default interface that already exists + ${flip concatMapStrings (take 1 interfaceList) (i: '' + ${pkgs.iw}/bin/iw dev ${device} set type ${i.type} + ${optionalString (i.type == "mesh" && i.meshID != null) "${pkgs.iw}/bin/iw dev ${device} set meshid ${i.meshID}"} + ${optionalString (i.type == "monitor" && i.flags != null) "${pkgs.iw}/bin/iw dev ${device} set monitor ${i.flags}"} + ${optionalString (i.type == "managed" && i.fourAddr != null) "${pkgs.iw}/bin/iw dev ${device} set 4addr ${if i.fourAddr then "on" else "off"}"} + ${optionalString (i.mac != null) "${pkgs.iproute}/bin/ip link set dev ${device} address ${i.mac}"} + ${optionalString (device != i._iName) "${pkgs.iproute}/bin/ip link set dev ${device} name ${i._iName}"} + '')} + ''; + # We must escape interfaces due to the systemd interpretation subsystemDevice = interface: "sys-subsystem-net-devices-${escapeSystemdPath interface}.device"; |