preservation.enable

Whether to enable the preservation module.

Type: boolean

Default: false

Example: true

Declared by:

preservation.preserveAt

Specify a set of locations and the corresponding state that should be preserved there.

Type: attribute set of (submodule)

Default: { }

Example:

{
  "/state" = {
    directories = [ "/var/lib/someservice" ];
    files = [
      {
        file = "/etc/wpa_supplicant.conf";
        how = "symlink";
      }
      {
        file = "/etc/machine-id";
        inInitrd = true;
      }
    ];
    users = {
      alice.directories = [ ".rabbit_hole" ];
      butz = {
        files = [
          {
            file = ".config/foo";
            mode = "0600";
          }
          "bar"
        ];
        directories = [ "unshaved_yaks" ];
      };
    };
  };
}

Declared by:

preservation.preserveAt.<name>.directories

Specify a list of directories that should be preserved. The paths are interpreted as absolute paths.

Type: list of ((submodule) or string convertible to it)

Default: [ ]

Example:

[
  "/var/lib/someservice"
]

Declared by:

preservation.preserveAt.<name>.directories.*.configureParent

Specify whether the parent directory of this directory shall be configured with custom ownership and permissions.

By default, missing parent directories are always created with ownership root:root and mode 0755, as described in tmpfiles.d(5).

Ownership and mode may be configured through the options parent.user, parent.group, parent.mode.

Defaults to true when how is set to symlink and user is not root.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.directories.*.createLinkTarget

Only used when how is set to symlink.

Specify whether to create an empty directory with the specified ownership and permissions as target of the symlink.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.directories.*.directory

Specify the path to the directory that should be preserved.

Type: string

Declared by:

preservation.preserveAt.<name>.directories.*.group

Specify the group that owns the directory.

Type: string

Default: "config.users.users.\${defaultOwner}.group"

Declared by:

preservation.preserveAt.<name>.directories.*.how

Specify how this directory should be preserved.

Type: one of “bindmount”, “symlink”

Default: "bindmount"

Declared by:

preservation.preserveAt.<name>.directories.*.inInitrd

Whether to prepare preservation of this directory in initrd.

Note: For most directories there is no need to enable this option.

Important: Note that both owner and group for this directory need to be available in the initrd for permissions to be set correctly.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.directories.*.mode

Specify the access mode of the directory. See the section Mode in tmpfiles.d(5) for more information.

Type: string

Default: "0755"

Declared by:

preservation.preserveAt.<name>.directories.*.mountOptions

Specify a list of mount options that should be used for this directory. These options are only used when how is set to bindmount. By default, bind and X-fstrim.notrim are added, use mkForce to override these if needed. See also fstrim(8).

Type: list of ((submodule) or string convertible to it)

Declared by:

preservation.preserveAt.<name>.directories.*.mountOptions.*.name

Specify the name of the mount option.

Type: string

Example: "bind"

Declared by:

preservation.preserveAt.<name>.directories.*.mountOptions.*.value

Optionally specify a value for the mount option.

Type: null or string

Default: null

Declared by:

preservation.preserveAt.<name>.directories.*.parent.group

Specify the group that owns the parent directory of this file.

Type: string

Default: "config.users.users.\${defaultOwner}.group"

Declared by:

preservation.preserveAt.<name>.directories.*.parent.mode

Specify the access mode of the parent directory of this file. See the section Mode in tmpfiles.d(5) for more information.

Type: string

Default: "0755"

Declared by:

preservation.preserveAt.<name>.directories.*.parent.user

Specify the user that owns the parent directory of this file.

Type: string

Default: "root"

Declared by:

preservation.preserveAt.<name>.directories.*.user

Specify the user that owns the directory.

Type: string

Default: "root"

Declared by:

preservation.preserveAt.<name>.files

Specify a list of files that should be preserved. The paths are interpreted as absolute paths.

Type: list of ((submodule) or string convertible to it)

Default: [ ]

Example:

[
  {
    file = "/etc/wpa_supplicant.conf";
    how = "symlink";
  }
  {
    file = "/etc/machine-id";
    inInitrd = true;
  }
]

Declared by:

preservation.preserveAt.<name>.files.*.configureParent

Specify whether the parent directory of this file shall be configured with custom ownership and permissions.

By default, missing parent directories are always created with ownership root:root and mode 0755, as described in tmpfiles.d(5).

Ownership and mode may be configured through the options parent.user, parent.group, parent.mode.

Defaults to true when how is set to symlink and user is not root.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.files.*.createLinkTarget

Only used when how is set to symlink.

Specify whether to create an empty file with the specified ownership and permissions as target of the symlink.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.files.*.file

Specify the path to the file that should be preserved.

Type: string

Declared by:

preservation.preserveAt.<name>.files.*.group

Specify the group that owns the file.

Type: string

Default: "config.users.users.\${defaultOwner}.group"

Declared by:

preservation.preserveAt.<name>.files.*.how

Specify how this file should be preserved:

  1. Either a file is placed both on the volatile and on the persistent volume, with a bind mount from the former to the latter.

  2. Or a symlink is created on the volatile volume, pointing to the corresponding location on the persistent volume.

Type: one of “bindmount”, “symlink”

Default: "bindmount"

Declared by:

preservation.preserveAt.<name>.files.*.inInitrd

Whether to prepare preservation of this file in the initrd.

Note: For most files there is no need to enable this option.

/etc/machine-id is an exception because it needs to be populated/read very early.

Important: Note that both owner and group for this file need to be available in the initrd for permissions to be set correctly.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.files.*.mode

Specify the access mode of the file. See the section Mode in tmpfiles.d(5) for more information.

Type: string

Default: "0644"

Declared by:

preservation.preserveAt.<name>.files.*.mountOptions

Specify a list of mount options that should be used for this file. These options are only used when how is set to bindmount. By default, bind is added, use mkForce to override this if needed.

Type: list of ((submodule) or string convertible to it)

Declared by:

preservation.preserveAt.<name>.files.*.mountOptions.*.name

Specify the name of the mount option.

Type: string

Example: "bind"

Declared by:

preservation.preserveAt.<name>.files.*.mountOptions.*.value

Optionally specify a value for the mount option.

Type: null or string

Default: null

Declared by:

preservation.preserveAt.<name>.files.*.parent.group

Specify the group that owns the parent directory of this file.

Type: string

Default: "config.users.users.\${defaultOwner}.group"

Declared by:

preservation.preserveAt.<name>.files.*.parent.mode

Specify the access mode of the parent directory of this file. See the section Mode in tmpfiles.d(5) for more information.

Type: string

Default: "0755"

Declared by:

preservation.preserveAt.<name>.files.*.parent.user

Specify the user that owns the parent directory of this file.

Type: string

Default: "root"

Declared by:

preservation.preserveAt.<name>.files.*.user

Specify the user that owns the file.

Type: string

Default: "root"

Declared by:

preservation.preserveAt.<name>.persistentStoragePath

Specify the location at which the directories, files, users.directories and users.files should be preserved. Defaults to the name of the parent attribute set.

Type: path

Default: "‹name›"

Declared by:

preservation.preserveAt.<name>.users

Specify a set of users with corresponding files and directories that should be preserved.

Type: attribute set of (submodule)

Default: { }

Example:

{
  alice.directories = [ ".rabbit_hole" ];
  butz = {
    files = [
      {
        file = ".config/foo";
        mode = "0600";
      }
      "bar"
    ];
    directories = [ "unshaved_yaks" ];
  };
}

Declared by:

preservation.preserveAt.<name>.users.<name>.directories

Specify a list of directories that should be preserved for this user. The paths are interpreted relative to home.

Type: list of ((submodule) or string convertible to it)

Default: [ ]

Example:

[
  ".rabbit_hole"
]

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.configureParent

Specify whether the parent directory of this directory shall be configured with custom ownership and permissions.

By default, missing parent directories are always created with ownership root:root and mode 0755, as described in tmpfiles.d(5).

Ownership and mode may be configured through the options parent.user, parent.group, parent.mode.

Defaults to true when how is set to symlink and user is not root.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.createLinkTarget

Only used when how is set to symlink.

Specify whether to create an empty directory with the specified ownership and permissions as target of the symlink.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.directory

Specify the path to the directory that should be preserved.

Type: string

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.group

Specify the group that owns the directory.

Type: string

Default: "config.users.users.\${defaultOwner}.group"

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.how

Specify how this directory should be preserved.

Type: one of “bindmount”, “symlink”

Default: "bindmount"

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.inInitrd

Whether to prepare preservation of this directory in initrd.

Note: For most directories there is no need to enable this option.

Important: Note that both owner and group for this directory need to be available in the initrd for permissions to be set correctly.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.mode

Specify the access mode of the directory. See the section Mode in tmpfiles.d(5) for more information.

Type: string

Default: "0755"

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.mountOptions

Specify a list of mount options that should be used for this directory. These options are only used when how is set to bindmount. By default, bind and X-fstrim.notrim are added, use mkForce to override these if needed. See also fstrim(8).

Type: list of ((submodule) or string convertible to it)

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.mountOptions.*.name

Specify the name of the mount option.

Type: string

Example: "bind"

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.mountOptions.*.value

Optionally specify a value for the mount option.

Type: null or string

Default: null

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.parent.group

Specify the group that owns the parent directory of this file.

Type: string

Default: "config.users.users.\${defaultOwner}.group"

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.parent.mode

Specify the access mode of the parent directory of this file. See the section Mode in tmpfiles.d(5) for more information.

Type: string

Default: "0755"

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.parent.user

Specify the user that owns the parent directory of this file.

Type: string

Default: "‹user›"

Declared by:

preservation.preserveAt.<name>.users.<name>.directories.*.user

Specify the user that owns the directory.

Type: string

Default: "‹user›"

Declared by:

preservation.preserveAt.<name>.users.<name>.files

Specify a list of files that should be preserved for this user. The paths are interpreted relative to home.

Type: list of ((submodule) or string convertible to it)

Default: [ ]

Example:

[
  {
    file = ".config/foo";
    mode = "0600";
  }
  "bar"
]

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.configureParent

Specify whether the parent directory of this file shall be configured with custom ownership and permissions.

By default, missing parent directories are always created with ownership root:root and mode 0755, as described in tmpfiles.d(5).

Ownership and mode may be configured through the options parent.user, parent.group, parent.mode.

Defaults to true when how is set to symlink and user is not root.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.createLinkTarget

Only used when how is set to symlink.

Specify whether to create an empty file with the specified ownership and permissions as target of the symlink.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.file

Specify the path to the file that should be preserved.

Type: string

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.group

Specify the group that owns the file.

Type: string

Default: "config.users.users.\${defaultOwner}.group"

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.how

Specify how this file should be preserved:

  1. Either a file is placed both on the volatile and on the persistent volume, with a bind mount from the former to the latter.

  2. Or a symlink is created on the volatile volume, pointing to the corresponding location on the persistent volume.

Type: one of “bindmount”, “symlink”

Default: "bindmount"

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.inInitrd

Whether to prepare preservation of this file in the initrd.

Note: For most files there is no need to enable this option.

/etc/machine-id is an exception because it needs to be populated/read very early.

Important: Note that both owner and group for this file need to be available in the initrd for permissions to be set correctly.

Type: boolean

Default: false

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.mode

Specify the access mode of the file. See the section Mode in tmpfiles.d(5) for more information.

Type: string

Default: "0644"

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.mountOptions

Specify a list of mount options that should be used for this file. These options are only used when how is set to bindmount. By default, bind is added, use mkForce to override this if needed.

Type: list of ((submodule) or string convertible to it)

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.mountOptions.*.name

Specify the name of the mount option.

Type: string

Example: "bind"

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.mountOptions.*.value

Optionally specify a value for the mount option.

Type: null or string

Default: null

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.parent.group

Specify the group that owns the parent directory of this file.

Type: string

Default: "config.users.users.\${defaultOwner}.group"

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.parent.mode

Specify the access mode of the parent directory of this file. See the section Mode in tmpfiles.d(5) for more information.

Type: string

Default: "0755"

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.parent.user

Specify the user that owns the parent directory of this file.

Type: string

Default: "‹user›"

Declared by:

preservation.preserveAt.<name>.users.<name>.files.*.user

Specify the user that owns the file.

Type: string

Default: "‹user›"

Declared by:

preservation.preserveAt.<name>.users.<name>.home

Specify the path to the user’s home directory.

Type: path, not containing newlines or colons

Default: "config.users.users.\${name}.home"

Declared by:

preservation.preserveAt.<name>.users.<name>.username

Specify the user for which the directories and files should be persisted. Defaults to the name of the parent attribute set.

Type: string, not containing newlines or colons

Default: "‹user›"

Declared by: