{ config, lib, pkgs, ... }: with lib; let upstreamServices = [ "aggety" "binfmt" "bootmisc" "cgroups" "consolefont" "devfs" "dmesg" "fsck" "hostname" "hwclock" "keymaps" "killprocs" "local" "localmount" "loopback" "modules" "mount-ro" "mtab" "netmount" "net-online" "network" "numlock" "osclock" "procfs" "root" "runsvdir" "s6-svscan" "savecache" "save-keymaps" "save-termencoding" "staticroute" "swap" "swclock" "sysctl" "sysfs" "termencoding" "urandom" ]; in { options = { rc = { services = mkOption { default = {}; type = types.attrsOf (types.submodule { enable = { type = types.bool; default = false; description = "Enable service spawning."; }; runlevel = { type = types.enum [ "boot" "default" "nonetwork" "shutdown" "sysinit" ]; default = "default"; description = "Select runlevel the services should be activated in."; }; description = { type = types.str; description = "Service description."; }; command = { type = types.package; description = "Command to be started."; }; }); description = "Definition of system service."; }; }; }; config = let rc_bool = enabled: if enabled then "YES" else "NO"; in { environment.etc."init.d".source = pkgs.runCommand "rc-init.d" { } '' mkdir -p "$out" ''; }; }