From 43c723b3c60350eb72b11e658b2e6a122fda6bfc Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 22 Feb 2019 18:47:53 +0000 Subject: s6 experiments --- nixos/modules/services/hardware/mdevd.nix | 71 +++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 nixos/modules/services/hardware/mdevd.nix (limited to 'nixos/modules/services/hardware/mdevd.nix') diff --git a/nixos/modules/services/hardware/mdevd.nix b/nixos/modules/services/hardware/mdevd.nix new file mode 100644 index 000000000000..b141bfc875eb --- /dev/null +++ b/nixos/modules/services/hardware/mdevd.nix @@ -0,0 +1,71 @@ +{ pkgs, lib, config, ... }: + +let + inherit (lib) mkDefault mkIf mkOption; + +in { + options = { + services.mdevd.enable = mkOption { + default = false; + description = "Whether to use the mdevd kernel hotplug management daemon"; + }; + + services.mdevd.package = mkOption { + default = pkgs.mdevd; + description = "Package providing the mdevd command"; + }; + + services.mdevd.verbosity = mkOption { + default = 1; + description = "Log level between 0 and 3. 3 is the most verbose."; + }; + + services.mdevd.notif = mkOption { + default = 3; + description = "File descriptor to use to notify s6 of readiness."; + internal = true; + }; + + services.mdevd.kbufsz = mkOption { + default = 500000; + description = "Bytes of buffer to reserve for the netlink queue"; + }; + + services.mdevd.slashsys = mkOption { + default = "/sys"; + description = "Location of the sysfs"; + }; + + services.mdevd.slashdev = mkOption { + default = "/dev"; + description = "Location of the device nodes"; + }; + + services.mdevd.fwbase = mkOption { + description = "Location of the firmware files, if any"; + }; + }; + + config = mkIf config.services.mdevd.enable { + services.mdevd.fwbase = mkDefault "${config.hardware.firmware}/lib/firmware"; + + # s6.rc.services.mdevd = { + # type = "longrun"; + # notification-fd = config.services.mdevd.notif; + # run = '' + # #!${pkgs.execline}/bin/execlineb -P + # ${config.services.mdevd.package}/bin/mdevd + # -v ${toString config.services.mdevd.verbosity} + # -D ${toString config.services.mdevd.notif} + # -b ${toString config.services.mdevd.kbufsz} + # -f ${pkgs.writeText "mdev.conf" '' + # SUBSYSTEM=net;.* root:root 600 @${pkgs.nettools}/bin/nameif + # tun[0-9]* root:root 600 =net/ + # tap[0-9]* root:root 600 =net/ + # ''} + # -s ${config.services.mdevd.slashdev} + # -F ${config.services.mdevd.fwbase} + # ''; + # }; + }; +} -- cgit 1.4.1