summaryrefslogtreecommitdiff
path: root/nixos/modules/services.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/services.nix')
-rw-r--r--nixos/modules/services.nix93
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"
+ '';
+ };
+
+}