Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

xdg.enable

Whether to enable management of XDG base directories.

Type: boolean

Default:

false

Example:

true

Declared by:

xdg.autostart.enable

Whether to enable creation of XDG autostart entries.

Type: boolean

Default:

false

Example:

true

Declared by:

xdg.autostart.entries

Paths to desktop files that should be linked to XDG_CONFIG_HOME/autostart

Type: list of absolute path

Default:

[ ]

Example:

[
  "${pkgs.evolution}/share/applications/org.gnome.Evolution.desktop"
]

Declared by:

xdg.autostart.readOnly

Make XDG_CONFIG_HOME/autostart a symlink to a readonly directory so that programs cannot install arbitrary autostart services.

Type: boolean

Default:

false

Example:

true

Declared by:

xdg.binHome

Absolute path to directory holding user-specific executables.

Sets XDG_BIN_HOME for the user if xdg.enable is set true.

Type: absolute path

Default:

"~/.local/bin"

Declared by:

xdg.cacheFile

Attribute set of files to link into the user’s XDG cache home.

Type: attribute set of (submodule)

Default:

{ }

Declared by:

xdg.cacheFile.<name>.enable

Whether this file should be generated. This option allows specific files to be disabled.

Type: boolean

Default:

true

Declared by:

xdg.cacheFile.<name>.executable

Set the execute bit. If null, defaults to the mode of the source file or to false for files created through the text option.

Type: null or boolean

Default:

null

Declared by:

xdg.cacheFile.<name>.force

Whether the target path should be unconditionally replaced by the managed file source. Warning, this will silently delete the target regardless of whether it is a file or link.

Type: boolean

Default:

false

Declared by:

When recursive is enabled, adds the -ignorelinks flag to lndir.

It causes lndir to not treat symbolic links in the source directory specially. The link created in the target directory will point back to the corresponding symbolic link in the source directory. If that link points to a directory, the resulting target will be a link to the source tree’s symlink rather than a recursively linked directory tree.

Type: boolean

Default:

false

Declared by:

xdg.cacheFile.<name>.onChange

Shell commands to run when file has changed between generations. The script will be run after the new files have been linked into place.

Note, this code is always run when recursive is enabled.

Type: strings concatenated with “\n”

Default:

""

Declared by:

xdg.cacheFile.<name>.recursive

If the file source is a directory, then this option determines whether the directory should be recursively linked to the target location. This option has no effect if the source is a file.

If false (the default) then the target will be a symbolic link to the source directory. If true then the target will be a directory structure matching the source’s but whose leaves are symbolic links to the files of the source directory.

Type: boolean

Default:

false

Declared by:

xdg.cacheFile.<name>.source

Path of the source file or directory. If is non-null then this option will automatically point to a file containing that text.

Type: absolute path

Declared by:

xdg.cacheFile.<name>.target

Path to target file relative to xdg.cacheHome.

Type: non-empty string

Default:

name

Declared by:

xdg.cacheFile.<name>.text

Text of the file. If this option is null then must be set.

Type: null or strings concatenated with “\n”

Default:

null

Declared by:

xdg.cacheHome

Absolute path to directory holding application caches.

Sets XDG_CACHE_HOME for the user if xdg.enable is set true.

Type: absolute path

Default:

"~/.cache"

Declared by:

xdg.configFile

Attribute set of files to link into the user’s XDG configuration home.

Type: attribute set of (submodule)

Default:

{ }

Declared by:

xdg.configFile.<name>.enable

Whether this file should be generated. This option allows specific files to be disabled.

Type: boolean

Default:

true

Declared by:

xdg.configFile.<name>.executable

Set the execute bit. If null, defaults to the mode of the source file or to false for files created through the text option.

Type: null or boolean

Default:

null

Declared by:

xdg.configFile.<name>.force

Whether the target path should be unconditionally replaced by the managed file source. Warning, this will silently delete the target regardless of whether it is a file or link.

Type: boolean

Default:

false

Declared by:

When recursive is enabled, adds the -ignorelinks flag to lndir.

It causes lndir to not treat symbolic links in the source directory specially. The link created in the target directory will point back to the corresponding symbolic link in the source directory. If that link points to a directory, the resulting target will be a link to the source tree’s symlink rather than a recursively linked directory tree.

Type: boolean

Default:

false

Declared by:

xdg.configFile.<name>.onChange

Shell commands to run when file has changed between generations. The script will be run after the new files have been linked into place.

Note, this code is always run when recursive is enabled.

Type: strings concatenated with “\n”

Default:

""

Declared by:

xdg.configFile.<name>.recursive

If the file source is a directory, then this option determines whether the directory should be recursively linked to the target location. This option has no effect if the source is a file.

If false (the default) then the target will be a symbolic link to the source directory. If true then the target will be a directory structure matching the source’s but whose leaves are symbolic links to the files of the source directory.

Type: boolean

Default:

false

Declared by:

xdg.configFile.<name>.source

Path of the source file or directory. If is non-null then this option will automatically point to a file containing that text.

Type: absolute path

Declared by:

xdg.configFile.<name>.target

Path to target file relative to xdg.configHome.

Type: non-empty string

Default:

name

Declared by:

xdg.configFile.<name>.text

Text of the file. If this option is null then must be set.

Type: null or strings concatenated with “\n”

Default:

null

Declared by:

xdg.configHome

Absolute path to directory holding application configurations.

Sets XDG_CONFIG_HOME for the user if xdg.enable is set true.

Type: absolute path

Default:

"~/.config"

Declared by:

xdg.dataFile

Attribute set of files to link into the user’s XDG data home.

Type: attribute set of (submodule)

Default:

{ }

Declared by:

xdg.dataFile.<name>.enable

Whether this file should be generated. This option allows specific files to be disabled.

Type: boolean

Default:

true

Declared by:

xdg.dataFile.<name>.executable

Set the execute bit. If null, defaults to the mode of the source file or to false for files created through the text option.

Type: null or boolean

Default:

null

Declared by:

xdg.dataFile.<name>.force

Whether the target path should be unconditionally replaced by the managed file source. Warning, this will silently delete the target regardless of whether it is a file or link.

Type: boolean

Default:

false

Declared by:

When recursive is enabled, adds the -ignorelinks flag to lndir.

It causes lndir to not treat symbolic links in the source directory specially. The link created in the target directory will point back to the corresponding symbolic link in the source directory. If that link points to a directory, the resulting target will be a link to the source tree’s symlink rather than a recursively linked directory tree.

Type: boolean

Default:

false

Declared by:

xdg.dataFile.<name>.onChange

Shell commands to run when file has changed between generations. The script will be run after the new files have been linked into place.

Note, this code is always run when recursive is enabled.

Type: strings concatenated with “\n”

Default:

""

Declared by:

xdg.dataFile.<name>.recursive

If the file source is a directory, then this option determines whether the directory should be recursively linked to the target location. This option has no effect if the source is a file.

If false (the default) then the target will be a symbolic link to the source directory. If true then the target will be a directory structure matching the source’s but whose leaves are symbolic links to the files of the source directory.

Type: boolean

Default:

false

Declared by:

xdg.dataFile.<name>.source

Path of the source file or directory. If is non-null then this option will automatically point to a file containing that text.

Type: absolute path

Declared by:

xdg.dataFile.<name>.target

Path to target file relative to <varname>xdg.dataHome</varname>.

Type: non-empty string

Default:

name

Declared by:

xdg.dataFile.<name>.text

Text of the file. If this option is null then must be set.

Type: null or strings concatenated with “\n”

Default:

null

Declared by:

xdg.dataHome

Absolute path to directory holding application data.

Sets XDG_DATA_HOME for the user if xdg.enable is set true.

Type: absolute path

Default:

"~/.local/share"

Declared by:

xdg.desktopEntries

Desktop Entries allow applications to be shown in your desktop environment’s app launcher.

You can define entries for programs without entries or override existing entries.

See https://specifications.freedesktop.org/desktop-entry-spec/latest/recognized-keys.html for more information on options.

Type: attribute set of (submodule)

Default:

{ }

Example:

{
  firefox = {
    categories = [
      "Network"
      "WebBrowser"
    ];
    exec = "firefox %U";
    genericName = "Web Browser";
    mimeType = [
      "text/html"
      "text/xml"
    ];
    name = "Firefox";
    terminal = false;
  };
}

Declared by:

xdg.desktopEntries.<name>.actions

The set of actions made available to application launchers.

Type: attribute set of (submodule)

Default:

{ }

Example:

{
  "New Window" = {
    exec = "${pkgs.firefox}/bin/firefox --new-window %u";
  };
}

Declared by:

xdg.desktopEntries.<name>.actions.<name>.exec

Program to execute, possibly with arguments.

Type: null or string

Default:

null

Declared by:

xdg.desktopEntries.<name>.actions.<name>.icon

Icon to display in file manager, menus, etc.

Type: null or string or absolute path

Default:

null

Declared by:

xdg.desktopEntries.<name>.actions.<name>.name

Name of the action.

Type: string

Default:

<name>

Declared by:

xdg.desktopEntries.<name>.categories

Categories in which the entry should be shown in a menu.

Type: null or (list of string)

Default:

null

Declared by:

xdg.desktopEntries.<name>.comment

Tooltip for the entry.

Type: null or string

Default:

null

Declared by:

xdg.desktopEntries.<name>.exec

Program to execute, possibly with arguments.

Type: null or string

Default:

null

Declared by:

xdg.desktopEntries.<name>.genericName

Generic name of the application.

Type: null or string

Default:

null

Declared by:

xdg.desktopEntries.<name>.icon

Icon to display in file manager, menus, etc.

Type: null or string or absolute path

Default:

null

Declared by:

xdg.desktopEntries.<name>.mimeType

The MIME type(s) supported by this application.

Type: null or (list of string)

Default:

null

Declared by:

xdg.desktopEntries.<name>.name

Specific name of the application.

Type: string

Declared by:

xdg.desktopEntries.<name>.noDisplay

Means “this application exists, but don’t display it in the menus”. This can be useful to e.g. associate this application with MIME types.

Type: null or boolean

Default:

null

Declared by:

xdg.desktopEntries.<name>.prefersNonDefaultGPU

If true, the application prefers to be run on a more powerful discrete GPU if available.

Type: null or boolean

Default:

null

Declared by:

xdg.desktopEntries.<name>.settings

Extra key-value pairs to add to the [Desktop Entry] section. This may override other values.

Type: attribute set of string

Default:

{ }

Example:

{
  DBusActivatable = "false";
  Keywords = "calc;math";
}

Declared by:

xdg.desktopEntries.<name>.startupNotify

If true, it is KNOWN that the application will send a “remove” message when started with the DESKTOP_STARTUP_ID environment variable set. If false, it is KNOWN that the application does not work with startup notification at all.

Type: null or boolean

Default:

null

Declared by:

xdg.desktopEntries.<name>.terminal

Whether the program runs in a terminal window.

Type: null or boolean

Default:

false

Declared by:

xdg.desktopEntries.<name>.type

The type of the desktop entry.

Type: one of “Application”, “Link”, “Directory”

Default:

"Application"

Declared by:

xdg.localBinInPath

Whether to add xdg.binHome to PATH when xdg.enable is enabled.

Type: boolean

Default:

false

Declared by:

xdg.mime.enable

Whether to install programs and files to support the XDG Shared MIME-info specification and XDG MIME Applications specification at https://specifications.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html and https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html, respectively.

Type: boolean

Default:

true if host platform is Linux, false otherwise

Declared by:

xdg.mime.desktopFileUtilsPackage

The desktop-file-utils package to use. Used when running update-desktop-database.

Type: package

Default:

pkgs.desktop-file-utils

Declared by:

xdg.mime.sharedMimeInfoPackage

The shared-mime-info package to use. Used when running update-mime-database.

Type: package

Default:

pkgs.shared-mime-info

Declared by:

xdg.mimeApps.enable

Whether to manage $XDG_CONFIG_HOME/mimeapps.list.

The generated file is read-only.

Type: boolean

Default:

false

Declared by:

xdg.mimeApps.associations.added

Defines additional associations of applications with mimetypes, as if the .desktop file was listing this mimetype in the first place.

Type: attribute set of ((list of string) or ((list of string) or string) convertible to it)

Default:

{ }

Example:

{
  mimetype1 = [
    "foo1.desktop"
    "foo2.desktop"
    "foo3.desktop"
  ];
  mimetype2 = "foo4.desktop";
}

Declared by:

xdg.mimeApps.associations.removed

Removes associations of applications with mimetypes, as if the .desktop file was not listing this mimetype in the first place.

Type: attribute set of ((list of string) or ((list of string) or string) convertible to it)

Default:

{ }

Example:

{
  mimetype1 = "foo5.desktop";
}

Declared by:

xdg.mimeApps.defaultApplicationPackages

Packages whose .desktop files will be used to establish default mimetype associations.

These associations are appended to the associations in . If multiple packages associate with the same mime type, then the priority among them is determined by their order in the list.

Note: Passing a large number of packages (for example, the system package set or all of home.packages) will significantly slow down builds. Prefer listing only the specific packages whose MIME associations you want to set as defaults.

Type: list of package

Default:

[ ]

Example:

[
  <derivation eog-50.1>
  <derivation evince-48.4>
]

Declared by:

xdg.mimeApps.defaultApplications

The default application to be used for a given mimetype. This is, for instance, the one that will be started when double-clicking on a file in a file manager. If the application is no longer installed, the next application in the list is attempted, and so on.

Type: attribute set of ((list of string) or ((list of string) or string) convertible to it)

Default:

{ }

Example:

{
  mimetype1 = [
    "default1.desktop"
    "default2.desktop"
  ];
}

Declared by:

xdg.portal.enable

Whether to enable XDG desktop integration.

Note, if you installed Home Manager via its NixOS module and ‘home-manager.useUserPackages’ is enabled, make sure to add

environment.pathsToLink = [ "/share/xdg-desktop-portal" "/share/applications" ];

to your NixOS configuration so that the portal definitions and DE provided configurations get linked.

Type: boolean

Default:

false

Example:

true

Declared by:

xdg.portal.config

Sets which portal backend should be used to provide the implementation for the requested interface. For details check portals.conf(5).

These will be written with the name $desktop-portals.conf for xdg.portal.config.$desktop and portals.conf for xdg.portal.config.common as an exception.

These, together with xdg.portal.configPackages, will be joined into a directory and passed to xdg-desktop-portal.service through a NIXOS_XDG_DESKTOP_PORTAL_CONFIG_DIR variable.

Type: attribute set of attribute set of (string or ((list of string) or string) convertible to it)

Default:

{ }

Example:

{
  common = {
    default = [
      "gtk"
    ];
  };
  pantheon = {
    default = [
      "pantheon"
      "gtk"
    ];
    "org.freedesktop.impl.portal.Secret" = [
      "gnome-keyring"
    ];
  };
  x-cinnamon = {
    default = [
      "xapp"
      "gtk"
    ];
  };
}

Declared by:

xdg.portal.configPackages

List of packages that provide XDG desktop portal configuration, usually in the form of share/xdg-desktop-portal/$desktop-portals.conf.

Note that configs in xdg.portal.config will be preferred if set.

Type: list of package

Default:

[ ]

Example:

[ pkgs.gnome.gnome-session ]

Declared by:

xdg.portal.extraPortals

List of additional portals that should be added to the environment.

The directory where the portal definitions have been merged together (likely ~/.nix-profile/share/xdg-desktop-portal/portals) will get passed to xdg-desktop-portal.service via the NIX_XDG_DESKTOP_PORTAL_DIR environment variable.

Portals allow interaction with system, like choosing files or taking screenshots. At minimum, a desktop portal implementation should be listed.

Type: list of package

Default:

[ ]

Declared by:

xdg.portal.xdgOpenUsePortal

Sets environment variable NIXOS_XDG_OPEN_USE_PORTAL to 1 This will make xdg-open use the portal to open programs, which resolves bugs involving programs opening inside FHS envs or with unexpected env vars set from wrappers. See #160923 for more info.

Type: boolean

Default:

false

Declared by:

xdg.stateFile

Attribute set of files to link into the user’s XDG state home.

Type: attribute set of (submodule)

Default:

{ }

Declared by:

xdg.stateFile.<name>.enable

Whether this file should be generated. This option allows specific files to be disabled.

Type: boolean

Default:

true

Declared by:

xdg.stateFile.<name>.executable

Set the execute bit. If null, defaults to the mode of the source file or to false for files created through the text option.

Type: null or boolean

Default:

null

Declared by:

xdg.stateFile.<name>.force

Whether the target path should be unconditionally replaced by the managed file source. Warning, this will silently delete the target regardless of whether it is a file or link.

Type: boolean

Default:

false

Declared by:

When recursive is enabled, adds the -ignorelinks flag to lndir.

It causes lndir to not treat symbolic links in the source directory specially. The link created in the target directory will point back to the corresponding symbolic link in the source directory. If that link points to a directory, the resulting target will be a link to the source tree’s symlink rather than a recursively linked directory tree.

Type: boolean

Default:

false

Declared by:

xdg.stateFile.<name>.onChange

Shell commands to run when file has changed between generations. The script will be run after the new files have been linked into place.

Note, this code is always run when recursive is enabled.

Type: strings concatenated with “\n”

Default:

""

Declared by:

xdg.stateFile.<name>.recursive

If the file source is a directory, then this option determines whether the directory should be recursively linked to the target location. This option has no effect if the source is a file.

If false (the default) then the target will be a symbolic link to the source directory. If true then the target will be a directory structure matching the source’s but whose leaves are symbolic links to the files of the source directory.

Type: boolean

Default:

false

Declared by:

xdg.stateFile.<name>.source

Path of the source file or directory. If is non-null then this option will automatically point to a file containing that text.

Type: absolute path

Declared by:

xdg.stateFile.<name>.target

Path to target file relative to <varname>xdg.stateHome</varname>.

Type: non-empty string

Default:

name

Declared by:

xdg.stateFile.<name>.text

Text of the file. If this option is null then must be set.

Type: null or strings concatenated with “\n”

Default:

null

Declared by:

xdg.stateHome

Absolute path to directory holding application states.

Sets XDG_STATE_HOME for the user if xdg.enable is set true.

Type: absolute path

Default:

"~/.local/state"

Declared by:

xdg.systemDirs.config

Directory names to add to XDG_CONFIG_DIRS in the user session.

Type: list of string

Default:

[ ]

Example:

[
  "/etc/xdg"
]

Declared by:

xdg.systemDirs.data

Directory names to add to XDG_DATA_DIRS in the user session.

Type: list of string

Default:

[ ]

Example:

[
  "/usr/share"
  "/usr/local/share"
]

Declared by:

xdg.terminal-exec.enable

Whether to enable xdg-terminal-exec, the proposed Default Terminal Execution Specification.

Type: boolean

Default:

false

Example:

true

Declared by:

xdg.terminal-exec.package

The xdg-terminal-exec package to use.

Type: null or package

Default:

pkgs.xdg-terminal-exec

Declared by:

xdg.terminal-exec.settings

Configuration options for the Default Terminal Execution Specification.

The keys are the desktop environments that are matched (case-insensitively) against XDG_CURRENT_DESKTOP, or default which is used when the current desktop environment is not found in the configuration. The values are a list of terminals’ desktop file IDs to try in order of decreasing priority.

Type: attribute set of list of string

Default:

{ }

Example:

{
  GNOME = [
    "com.raggesilver.BlackBox.desktop"
    "org.gnome.Terminal.desktop"
  ];
  default = [
    "kitty.desktop"
  ];
}

Declared by:

xdg.userDirs.enable

Whether to manage $XDG_CONFIG_HOME/user-dirs.dirs.

The generated file is read-only.

Type: boolean

Default:

false

Declared by:

xdg.userDirs.package

The xdg-user-dirs package to use.

Type: null or package

Default:

pkgs.xdg-user-dirs

Declared by:

xdg.userDirs.createDirectories

Whether to enable automatic creation of the XDG user directories.

Type: boolean

Default:

false

Example:

true

Declared by:

xdg.userDirs.desktop

The Desktop directory.

Type: null or (string or absolute path convertible to it)

Default:

"${config.home.homeDirectory}/Desktop"

Declared by:

xdg.userDirs.documents

The Documents directory.

Type: null or (string or absolute path convertible to it)

Default:

"${config.home.homeDirectory}/Documents"

Declared by:

xdg.userDirs.download

The Downloads directory.

Type: null or (string or absolute path convertible to it)

Default:

"${config.home.homeDirectory}/Downloads"

Declared by:

xdg.userDirs.extraConfig

Other user directories.

The key ‘MISC’ corresponds to the user-dirs entry ‘XDG_MISC_DIR’.

Type: attribute set of (string or absolute path convertible to it)

Default:

{ }

Example:

{
  MISC = "${config.home.homeDirectory}/Misc";
}

Declared by:

xdg.userDirs.music

The Music directory.

Type: null or (string or absolute path convertible to it)

Default:

"${config.home.homeDirectory}/Music"

Declared by:

xdg.userDirs.pictures

The Pictures directory.

Type: null or (string or absolute path convertible to it)

Default:

"${config.home.homeDirectory}/Pictures"

Declared by:

xdg.userDirs.projects

The Projects directory.

Type: null or (string or absolute path convertible to it)

Default:

"${config.home.homeDirectory}/Projects"

Declared by:

xdg.userDirs.publicShare

The Public share directory.

Type: null or (string or absolute path convertible to it)

Default:

"${config.home.homeDirectory}/Public"

Declared by:

xdg.userDirs.setSessionVariables

Whether to set the XDG user dir environment variables, like XDG_DESKTOP_DIR.

Note: The recommended way to get these values is via the xdg-user-dir command or by processing $XDG_CONFIG_HOME/user-dirs.dirs directly in your application.

This defaults to true for state version < 26.05 and false otherwise.

Type: boolean

Default:

if lib.versionAtLeast config.home.stateVersion "26.05" then false else true

Declared by:

xdg.userDirs.templates

The Templates directory.

Type: null or (string or absolute path convertible to it)

Default:

"${config.home.homeDirectory}/Templates"

Declared by:

xdg.userDirs.videos

The Videos directory.

Type: null or (string or absolute path convertible to it)

Default:

"${config.home.homeDirectory}/Videos"

Declared by: