diff options
author | Will Fancher <elvishjerricco@gmail.com> | 2022-04-24 14:47:28 -0400 |
---|---|---|
committer | Will Fancher <elvishjerricco@gmail.com> | 2022-04-28 14:12:14 -0400 |
commit | 69d804751678ca42175203252251cd74ff362812 (patch) | |
tree | c283f3c63eaaeb7adac4624b8882f2ac2adb16b3 /nixos/lib | |
parent | e325f7aeaafa51db41bd7e8d86d04b934dbab949 (diff) | |
download | nixpkgs-69d804751678ca42175203252251cd74ff362812.tar nixpkgs-69d804751678ca42175203252251cd74ff362812.tar.gz nixpkgs-69d804751678ca42175203252251cd74ff362812.tar.bz2 nixpkgs-69d804751678ca42175203252251cd74ff362812.tar.lz nixpkgs-69d804751678ca42175203252251cd74ff362812.tar.xz nixpkgs-69d804751678ca42175203252251cd74ff362812.tar.zst nixpkgs-69d804751678ca42175203252251cd74ff362812.zip |
nixos: Fix up systemd shutdown ramfs
Diffstat (limited to 'nixos/lib')
-rw-r--r-- | nixos/lib/systemd-types.nix | 34 | ||||
-rw-r--r-- | nixos/lib/utils.nix | 2 |
2 files changed, 34 insertions, 2 deletions
diff --git a/nixos/lib/systemd-types.nix b/nixos/lib/systemd-types.nix index 71962fab2e1..961b6d7f985 100644 --- a/nixos/lib/systemd-types.nix +++ b/nixos/lib/systemd-types.nix @@ -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') + ); + }; + })); } diff --git a/nixos/lib/utils.nix b/nixos/lib/utils.nix index 497d98aa4d1..d7671a37499 100644 --- a/nixos/lib/utils.nix +++ b/nixos/lib/utils.nix @@ -213,6 +213,6 @@ rec { systemdUtils = { lib = import ./systemd-lib.nix { inherit lib config pkgs; }; unitOptions = import ./systemd-unit-options.nix { inherit lib systemdUtils; }; - types = import ./systemd-types.nix { inherit lib systemdUtils; }; + types = import ./systemd-types.nix { inherit lib systemdUtils pkgs; }; }; } |