Commit Graph

12 Commits

Author SHA1 Message Date
polykernel 7cb118c9d2
xdg: coerce XDG base directories settings to strings
Currently, when a custom path is set for any of the XDG base
directories (i.e XDG_DATA_HOME, XDG_CONFIG_HOME, ...), the path will
be coerced into a string when consumed by other options such as
xdg.configFile et al. This causes the the given path to be copied to
the nix store which in the case of xdg.configFile et al, translate to
the file being written there as it is a absolute path.

Interestingly, the default base directories all work as intended as
they are encoded as a string.

This commit converts the option to a string regardless of whether it
is a primitive path or a string encoded path. This allows downstream
consumers to use the base directories in arbitrary way without
accidentally copying the content of the directory to the store. It is
implemented in a similar manner as how home.homeDirectory undergoes
string conversion.

The existing file-attr-name test was modified to test also custom xdg
base directories, and the home.file generation test was removed as
there is a dedicated test for this case in the files module. The test
case was renamed to file-gen to better reflect the new scope.
2021-09-21 21:29:44 +02:00
Robert Helgesson 41903a14b0
Remove a few format exceptions 2021-07-18 23:34:50 +02:00
Robert Helgesson e42e147b58
Remove some usage of config.lib.dag
The `lib.hm.dag` attribute set should always be preferred.
2021-05-09 12:13:31 +02:00
arcnmx 9bf1f40af1
xdg: disambiguate `home.file` attribute names 2020-10-22 23:51:01 +02:00
Robert Helgesson b95ad63201
Deprecate use of `builtins.getEnv`
This removes the use of the non-deterministic function
`builtins.getEnv` for state version ≥ 20.09.

PR #1269
2020-05-26 00:28:59 +02:00
Robert Helgesson 54de0e1d79
xdg: create cache directory using keep file
We can avoid the activation block by instead creating a hidden file in
the directory.
2019-07-26 23:23:51 +02:00
Matthieu Coudron 7a8d50a803
xdg: create $XDG_CACHE_HOME
Some programs fail silently (bash with HISTFILE for instance) when the
folder doesn't exist.
2018-08-20 20:37:26 +02:00
Robert Helgesson a977c79f9f
xdg: add option 'xdg.dataFile'
This allows creating files within the user's XDG data directory.
2017-11-11 00:30:53 +01:00
Robert Helgesson 549deb51d6
xdg: use `fileType` for `xdg.configFile` 2017-11-06 14:24:04 +01:00
Cornelius Mika ccb291ce66
files: add option 'executable'
This also deprecates the `home.file.<name?>.mode` option, which is
misleading because the Nix store only allows modes 'r--' and 'r-x'.
2017-11-06 14:24:04 +01:00
Robert Helgesson 82d6aa0c97
xdg: fix use of base path 2017-10-31 12:26:39 +01:00
Robert Helgesson 54a9058ee0
xdg: add module
When enabled this module will cause Home Manager to manage the user
environment XDG variables. When disabled, then Home Manager will use
the XDG variables taken from the user environment.
2017-10-29 01:59:34 +02:00