anchor.diff:        not yet supported by the intrd generated with this option.
       '';
   
  -    package = (lib.mkPackageOption pkgs "systemd" {
  +    package = (mkPackageOption pkgs "systemd" {
         default = "systemdMinimal";
       }) // {
         visible = false;
       };
   
  -    objects = mkOption {
  -      description = "List of objects to include in the initrd, and their symlinks";
  +    contents = mkOption {
  +      description = "Set of files that have to be linked into the initrd";
         example = literalExpression ''
  -        [ { object = "''${systemd}/lib/systemd/systemd"; symlink = "/init"; } ]
  -      '';
  -      visible = false;
  -      type = types.listOf (types.submodule {
  +        {
  +          "/etc/hostname".text = "mymachine";
  +        }
  +      '';
  +      visible = false;
  +      default = {};
  +      type = types.attrsOf (types.submodule ({ config, options, name, ... }: {
           options = {
  -          object = mkOption {
  +          enable = mkEnableOption "copying of this file to initrd and symlinking it" // { default = true; };
  +
  +          target = mkOption {
               type = types.path;
  -            description = "The object to include in initrd.";
  +            description = ''
  +              Path of the symlink.
  +            '';
  +            default = name;
             };
  -          symlink = mkOption {
  -            type = types.nullOr types.path;
  -            description = "A symlink to create in initrd pointing to the object.";
  +
  +          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')
  +          );
  +        };
  +      }));
  +    };
  +
  +    storePaths = mkOption {
  +      description = ''
  +        Store paths to copy into the initrd as well.
  +      '';
  +      type = types.listOf types.singleLineStr;
  +      default = [];
  +    };
  +
  +    suppressedStorePaths = mkOption {
  +      description = ''
  +        Store paths specified in the storePaths option that
  +        should not be copied.
  +      '';
  +      type = types.listOf types.singleLineStr;
  +      default = [];
       };
   
       emergencyAccess = mkOption {
  
positive.code:     name = "initrd-emergency-env";
      paths = map getBin cfg.initrdBin;
      pathsToLink = ["/bin" "/sbin"];
    };
  
    initialRamdisk = pkgs.makeInitrdNG {
      contents = cfg.objects;
    };
  
  in {
  
negative.code:     boot.initrd.systemd = {
        initrdBin = [pkgs.bash pkgs.coreutils pkgs.kmod cfg.package] ++ config.system.fsPackages;
  
        contents = {
          "/init".source = "${cfg.package}/lib/systemd/systemd";
          "/etc/systemd/system".source = stage1Units;
  
          "/etc/systemd/system.conf".text = ''
            [Manager]
            DefaultEnvironment=PATH=/bin:/sbin
          '';
  
          "/etc/initrd-release".source = config.environment.etc.os-release.source;
          "/etc/os-release".source = config.environment.etc.os-release.source;
          "/etc/fstab".source = fstab;
  
          "/lib/modules".source = "${modulesClosure}/lib/modules";
  
          "/etc/modules-load.d/nixos.conf".text = concatStringsSep "\n" config.boot.initrd.kernelModules;
  
          "/etc/passwd".source = "${pkgs.fakeNss}/etc/passwd";
          "/etc/shadow".text = "root:${if isBool cfg.emergencyAccess then "!" else cfg.emergencyAccess}:::::::";
  
          "/bin".source = "${initrdBinEnv}/bin";
          "/sbin".source = "${initrdBinEnv}/sbin";
  
          "/etc/sysctl.d/nixos.conf".text = "kernel.modprobe = /sbin/modprobe";
        };
  
        storePaths = [
          # TODO: Limit this to the bare necessities
          "${cfg.package}/lib"
  
          "${cfg.package.util-linux}/bin/mount"
          "${cfg.package.util-linux}/bin/umount"
          "${cfg.package.util-linux}/bin/sulogin"
  
          # so NSS can look up usernames
          "${pkgs.glibc}/lib/libnss_files.so"
        ];
  
        targets.initrd.aliases = ["default.target"];
  