8 cfg = config.services.fanout;
11 lib.lists.imap0 (i: s: "mknod /dev/fanout${builtins.toString i} c $MAJOR ${builtins.toString i}") (
12 lib.lists.replicate n ""
16 options.services.fanout = {
17 enable = lib.mkEnableOption "fanout";
18 fanoutDevices = lib.mkOption {
21 description = "Number of /dev/fanout devices";
23 bufferSize = lib.mkOption {
26 description = "Size of /dev/fanout buffer in bytes";
30 config = lib.mkIf cfg.enable {
31 boot.extraModulePackages = [ config.boot.kernelPackages.fanout.out ];
33 boot.kernelModules = [ "fanout" ];
35 boot.extraModprobeConfig = ''
36 options fanout buffersize=${builtins.toString cfg.bufferSize}
39 systemd.services.fanout = {
40 description = "Bring up /dev/fanout devices";
42 MAJOR=$(${pkgs.gnugrep}/bin/grep fanout /proc/devices | ${pkgs.gawk}/bin/awk '{print $1}')
43 ${lib.strings.concatLines (mknodCmds cfg.fanoutDevices)}
46 wantedBy = [ "multi-user.target" ];
51 RemainAfterExit = "yes";