diff options
author | Karel Kočí <cynerd@email.cz> | 2022-04-09 16:23:35 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2022-04-09 16:23:35 +0200 |
commit | 4c0a4740a76ce61b419d51336073764284118aaf (patch) | |
tree | 24f3f50a36cc66f37e849f47bdab3f0ab1852c97 /nixos/modules/services.nix | |
parent | 6a039e268369f7e9055e19d733849da26ab0208b (diff) | |
download | nix-openrc-4c0a4740a76ce61b419d51336073764284118aaf.tar.gz nix-openrc-4c0a4740a76ce61b419d51336073764284118aaf.tar.bz2 nix-openrc-4c0a4740a76ce61b419d51336073764284118aaf.zip |
Diffstat (limited to 'nixos/modules/services.nix')
-rw-r--r-- | nixos/modules/services.nix | 93 |
1 files changed, 93 insertions, 0 deletions
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" + ''; + }; + +} |