summaryrefslogtreecommitdiff
path: root/nixos/modules/openrc.nix
blob: 7b68efc087d4ee592efd9116c8159c1321d69d7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ config, lib, pkgs, ... }:

with lib;

{

  options = {

    rc = {
      conf = {
        parallel = mkOption {
          type = types.bool;
          default = false;
          description = ''
            If you want the rc system to try and start services in parallel for
            a slight speed improvement. When running in parallel we prefix the
            service output with its name as the output will get jumbled up.
          '';
        };
        interactive = mkOption {
          type = types.bool;
          default = false;
          description = ''
            Set to true and you'll be able to press the I key during boot so you
            can choose to start specific services. Set to false to disable this
            feature. This feature is automatically disabled if rc_parallel is
            set to false.
          '';
        };
        logger = mkOption {
          type = types.bool;
          default = true;
          description = ''
            Logger launches a logging daemon to log the entire rc process to
            /var/log/rc.log
            NOTE: Linux systems require the devfs service to be started before
            logging can take place and as such cannot log the sysinit runlevel.
          '';
        };
      };
    };

  };


  config = let

    rc_bool = enabled: if enabled then "YES" else "NO";

  in {
    environment.etc."rc.conf".text = ''
      # Global OpenRC configuration settings
      rc_parallel="${rc_bool config.rc.conf.parallel}"
      rc_interactive="${rc_bool config.rc.conf.interactive}"
      rc_logger="${rc_bool config.rc.conf.logger}"
    '';
  };

}