nixos: Fix up systemd shutdown ramfs

This commit is contained in:
Will Fancher 2022-04-24 14:47:28 -04:00
parent e325f7aeaa
commit 69d8047516
7 changed files with 76 additions and 43 deletions

View file

@ -1,4 +1,4 @@
{ lib, systemdUtils }:
{ lib, systemdUtils, pkgs }:
with systemdUtils.lib;
with systemdUtils.unitOptions;
@ -34,4 +34,36 @@ rec {
automounts = with types; listOf (submodule [ stage2AutomountOptions unitConfig automountConfig ]);
initrdAutomounts = with types; attrsOf (submodule [ stage1AutomountOptions unitConfig automountConfig ]);
initrdContents = types.attrsOf (types.submodule ({ config, options, name, ... }: {
options = {
enable = mkEnableOption "copying of this file and symlinking it" // { default = true; };
target = mkOption {
type = types.path;
description = ''
Path of the symlink.
'';
default = name;
};
text = mkOption {
default = null;
type = types.nullOr types.lines;
description = "Text of the file.";
};
source = mkOption {
type = types.path;
description = "Path of the source file.";
};
};
config = {
source = mkIf (config.text != null) (
let name' = "initrd-" + baseNameOf name;
in mkDerivedConfig options.text (pkgs.writeText name')
);
};
}));
}