summary refs log tree commit diff
path: root/pkgs/os-specific/linux/fanctl/default.nix
diff options
context:
space:
mode:
authorCharles Strahan <charles.c.strahan@gmail.com>2015-08-09 19:13:40 -0400
committerCharles Strahan <charles.c.strahan@gmail.com>2015-08-13 14:27:14 -0400
commitc1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9 (patch)
tree1788d9e9cb6b79510ffbe19859743e692c3ce822 /pkgs/os-specific/linux/fanctl/default.nix
parent18597ff6588402c0c3b11e71e6ab81a4fee81595 (diff)
downloadnixpkgs-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar
nixpkgs-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar.gz
nixpkgs-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar.bz2
nixpkgs-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar.lz
nixpkgs-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar.xz
nixpkgs-c1ee8fefd40bdd6acb3d0eb3ed27f47674fc33f9.tar.zst
nixpkgs-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 'pkgs/os-specific/linux/fanctl/default.nix')
-rw-r--r--pkgs/os-specific/linux/fanctl/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/fanctl/default.nix b/pkgs/os-specific/linux/fanctl/default.nix
new file mode 100644
index 00000000000..f0b863e0148
--- /dev/null
+++ b/pkgs/os-specific/linux/fanctl/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, lib, fetchbzr, makeWrapper, bridge-utils, iproute, dnsmasq, iptables, kmod, utillinux }:
+
+stdenv.mkDerivation rec {
+  name = "fanctl-${version}";
+
+  version = "0.3.0";
+
+  src = fetchbzr {
+    url = "https://code.launchpad.net/~ubuntu-branches/ubuntu/vivid/ubuntu-fan/vivid-updates";
+    rev = 2;
+    sha256 = "1vcr2rg99g7sx1zynhiggjzc9y9z591i4535hbm21dysy3cisp7i";
+  };
+
+  buildInputs = [ makeWrapper ];
+
+  # When given --conf-file="", dnsmasq still attempts to read /etc/dnsmasq.conf;
+  # if that files does not exist, dnsmasq subsequently fails,
+  # so we'll use /dev/null.
+  #
+  # Also, make sure /var/lib/ubuntu-fan exists before starting dnsmasq.
+  buildPhase = ''
+    substituteInPlace fanctl \
+      --replace '--conf-file= ' \
+                '--conf-file=/dev/null ' \
+      --replace '/var/lib/misc' \
+                '/var/lib/ubuntu-fan'
+
+    sed -i '/dnsmasq -u/i \
+    mkdir -p /var/lib/ubuntu-fan' fanctl
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin $out/man/man8
+    cp fanctl.8 $out/man/man8
+    cp fanctl $out/bin
+    wrapProgram $out/bin/fanctl --prefix PATH : \
+      ${lib.makeSearchPath "bin" [ bridge-utils iproute dnsmasq iptables kmod utillinux ]};
+  '';
+
+  meta = with lib; {
+    description = "Ubuntu FAN network support enablement";
+    homepage = "https://launchpad.net/ubuntu/+source/ubuntu-fan";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ cstrahan ];
+  };
+}