mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-09 03:55:44 +03:00
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
This commit is contained in:
parent
18597ff658
commit
c1ee8fefd4
9 changed files with 1523 additions and 1 deletions
|
@ -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
|
||||
|
|
60
nixos/modules/services/networking/ubuntu-fan.nix
Normal file
60
nixos/modules/services/networking/ubuntu-fan.nix
Normal file
|
@ -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";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue