1 { lib, systemdUtils, pkgs }:
4 inherit (systemdUtils.lib)
18 inherit (systemdUtils.unitOptions)
20 stage1AutomountOptions
21 stage1CommonUnitOptions
28 stage2AutomountOptions
29 stage2CommonUnitOptions
60 initrdStorePathModule = { config, ... }: {
62 enable = (mkEnableOption "copying of this file and symlinking it") // { default = true; };
74 description = "Path of the source file.";
78 usePriority = mkOption {
79 type = enum [ "required" "recommended" "suggested" ];
80 default = "recommended";
82 Priority of dlopen ELF notes to include. "required" is
83 minimal, "recommended" includes "required", and
84 "suggested" includes "recommended".
86 See: https://systemd.io/ELF_DLOPEN_METADATA/
91 type = listOf singleLineStr;
94 Features to enable via dlopen ELF notes. These will be in
95 addition to anything included via 'usePriority',
96 regardless of their priority.
106 units = attrsOf (submodule ({ name, config, ... }: {
107 options = concreteUnitOptions;
109 name = mkDefault name;
110 unit = mkDefault (makeUnit name config);
114 services = attrsOf (submodule [ stage2ServiceOptions unitConfig stage2ServiceConfig ]);
115 initrdServices = attrsOf (submodule [ stage1ServiceOptions unitConfig stage1ServiceConfig ]);
117 targets = attrsOf (submodule [ stage2CommonUnitOptions unitConfig targetConfig ]);
118 initrdTargets = attrsOf (submodule [ stage1CommonUnitOptions unitConfig targetConfig ]);
120 sockets = attrsOf (submodule [ stage2SocketOptions unitConfig socketConfig]);
121 initrdSockets = attrsOf (submodule [ stage1SocketOptions unitConfig socketConfig ]);
123 timers = attrsOf (submodule [ stage2TimerOptions unitConfig timerConfig ]);
124 initrdTimers = attrsOf (submodule [ stage1TimerOptions unitConfig timerConfig ]);
126 paths = attrsOf (submodule [ stage2PathOptions unitConfig pathConfig ]);
127 initrdPaths = attrsOf (submodule [ stage1PathOptions unitConfig pathConfig ]);
129 slices = attrsOf (submodule [ stage2SliceOptions unitConfig sliceConfig ]);
130 initrdSlices = attrsOf (submodule [ stage1SliceOptions unitConfig sliceConfig ]);
132 mounts = listOf (submodule [ stage2MountOptions unitConfig mountConfig ]);
133 initrdMounts = listOf (submodule [ stage1MountOptions unitConfig mountConfig ]);
135 automounts = listOf (submodule [ stage2AutomountOptions unitConfig automountConfig ]);
136 initrdAutomounts = attrsOf (submodule [ stage1AutomountOptions unitConfig automountConfig ]);
138 initrdStorePath = listOf (coercedTo
139 (oneOf [ singleLineStr package ])
140 (source: { inherit source; })
141 (submodule initrdStorePathModule));
143 initrdContents = attrsOf (submodule ({ config, options, name, ... }: {
144 imports = [ initrdStorePathModule ];
149 description = "Text of the file.";
154 target = mkDefault name;
155 source = mkIf (config.text != null) (
156 let name' = "initrd-" + baseNameOf name;
157 in mkDerivedConfig options.text (pkgs.writeText name')