1{ lib, systemdUtils, pkgs }:
2
3with systemdUtils.lib;
4with systemdUtils.unitOptions;
5with lib;
6
7rec {
8 units = with types;
9 attrsOf (submodule ({ name, config, ... }: {
10 options = concreteUnitOptions;
11 config = { unit = mkDefault (systemdUtils.lib.makeUnit name config); };
12 }));
13
14 services = with types; attrsOf (submodule [ stage2ServiceOptions unitConfig stage2ServiceConfig ]);
15 initrdServices = with types; attrsOf (submodule [ stage1ServiceOptions unitConfig stage1ServiceConfig ]);
16
17 targets = with types; attrsOf (submodule [ stage2CommonUnitOptions unitConfig ]);
18 initrdTargets = with types; attrsOf (submodule [ stage1CommonUnitOptions unitConfig ]);
19
20 sockets = with types; attrsOf (submodule [ stage2SocketOptions unitConfig ]);
21 initrdSockets = with types; attrsOf (submodule [ stage1SocketOptions unitConfig ]);
22
23 timers = with types; attrsOf (submodule [ stage2TimerOptions unitConfig ]);
24 initrdTimers = with types; attrsOf (submodule [ stage1TimerOptions unitConfig ]);
25
26 paths = with types; attrsOf (submodule [ stage2PathOptions unitConfig ]);
27 initrdPaths = with types; attrsOf (submodule [ stage1PathOptions unitConfig ]);
28
29 slices = with types; attrsOf (submodule [ stage2SliceOptions unitConfig ]);
30 initrdSlices = with types; attrsOf (submodule [ stage1SliceOptions unitConfig ]);
31
32 mounts = with types; listOf (submodule [ stage2MountOptions unitConfig mountConfig ]);
33 initrdMounts = with types; listOf (submodule [ stage1MountOptions unitConfig mountConfig ]);
34
35 automounts = with types; listOf (submodule [ stage2AutomountOptions unitConfig automountConfig ]);
36 initrdAutomounts = with types; attrsOf (submodule [ stage1AutomountOptions unitConfig automountConfig ]);
37
38 initrdContents = types.attrsOf (types.submodule ({ config, options, name, ... }: {
39 options = {
40 enable = mkEnableOption (lib.mdDoc "copying of this file and symlinking it") // { default = true; };
41
42 target = mkOption {
43 type = types.path;
44 description = lib.mdDoc ''
45 Path of the symlink.
46 '';
47 default = name;
48 };
49
50 text = mkOption {
51 default = null;
52 type = types.nullOr types.lines;
53 description = lib.mdDoc "Text of the file.";
54 };
55
56 source = mkOption {
57 type = types.path;
58 description = lib.mdDoc "Path of the source file.";
59 };
60 };
61
62 config = {
63 source = mkIf (config.text != null) (
64 let name' = "initrd-" + baseNameOf name;
65 in mkDerivedConfig options.text (pkgs.writeText name')
66 );
67 };
68 }));
69}