From 4c0a4740a76ce61b419d51336073764284118aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sat, 9 Apr 2022 16:23:35 +0200 Subject: WIP --- nixos/modules/services.nix | 93 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 nixos/modules/services.nix (limited to 'nixos/modules/services.nix') diff --git a/nixos/modules/services.nix b/nixos/modules/services.nix new file mode 100644 index 0000000..3fa6835 --- /dev/null +++ b/nixos/modules/services.nix @@ -0,0 +1,93 @@ +{ 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" + ''; + }; + +} -- cgit v1.2.3