diff options
author | Charles Strahan <charles.c.strahan@gmail.com> | 2015-08-09 19:13:40 -0400 |
---|---|---|
committer | Charles Strahan <charles.c.strahan@gmail.com> | 2015-08-13 14:27:14 -0400 |
commit | c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9 (patch) | |
tree | 1788d9e9cb6b79510ffbe19859743e692c3ce822 /nixos/modules | |
parent | 18597ff6588402c0c3b11e71e6ab81a4fee81595 (diff) | |
download | nixlib-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar nixlib-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar.gz nixlib-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar.bz2 nixlib-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar.lz nixlib-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar.xz nixlib-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar.zst nixlib-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.zip |
nixos: add support for Ubuntu Fan Networking
This provides support for Ubuntu Fan Networking [1]. This includes: * The fanctl package, and a corresponding NixOS service. * iproute patches. * kernel patches. closes #9188 1: https://wiki.ubuntu.com/FanNetworking
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/module-list.nix | 1 | ||||
-rw-r--r-- | nixos/modules/services/networking/ubuntu-fan.nix | 60 |
2 files changed, 61 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 93d378aa95f8..733f3c5d853d 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -344,6 +344,7 @@ ./services/networking/tlsdated.nix ./services/networking/tox-bootstrapd.nix ./services/networking/tvheadend.nix + ./services/networking/ubuntu-fan.nix ./services/networking/unbound.nix ./services/networking/unifi.nix ./services/networking/vsftpd.nix diff --git a/nixos/modules/services/networking/ubuntu-fan.nix b/nixos/modules/services/networking/ubuntu-fan.nix new file mode 100644 index 000000000000..2759a671b81f --- /dev/null +++ b/nixos/modules/services/networking/ubuntu-fan.nix @@ -0,0 +1,60 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.networking.ubuntu-fan; + modprobe = "${config.system.sbin.modprobe}/sbin/modprobe"; + +in + +{ + + ###### interface + + options = { + + networking.ubuntu-fan = { + + enable = mkEnableOption "Ubuntu FAN Networking"; + + }; + + }; + + + ###### implementation + + config = mkIf cfg.enable { + + environment.systemPackages = [ pkgs.fanctl ]; + + systemd.services.ubuntu-fan = { + description = "Ubuntu FAN Networking"; + wantedBy = [ "multi-user.target" ]; + after = [ "network-online.target" ]; + before = [ "docker.service" ]; + restartIfChanged = false; + preStart = '' + if [ ! -f /proc/sys/net/fan/version ]; then + ${modprobe} ipip + if [ ! -f /proc/sys/net/fan/version ]; then + echo "The Ubuntu Fan Networking patches have not been applied to this kernel!" 1>&2 + exit 1 + fi + fi + + mkdir -p /var/lib/ubuntu-fan + ''; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStart = "${pkgs.fanctl}/bin/fanctl up -a"; + ExecStop = "${pkgs.fanctl}/bin/fanctl down -a"; + }; + }; + + }; + +} |