Document relative and tilde paths #497

Open
opened 2024-09-01 22:36:08 +00:00 by rbt · 2 comments
Owner

With #482 closed, path configuration settings (some of them, at least) can support relative and tilde paths. Here's how I described it in the release notes (the links won't work):

Configuration settings can now refer to files with paths relative to the file they're written in or relative to your home directory (with ~/).

This makes settings like repl-overlays and secret-key-files much easier to set, especially if you'd like to refer to files in an existing dotfiles repo cloned into your home directory.

If you put repl-overlays = repl.nix in your ~/.config/nix/nix.conf, it'll load ~/.config/nix/repl.nix. Similarly, you can set repl-overlays = ~/.dotfiles/repl.nix to load a file relative to your home directory.

Configuration files can also include paths relative to your home directory.

Only user configuration files (like $XDG_CONFIG_HOME/nix/nix.conf or the files listed in $NIX_USER_CONF_FILES) can use tilde paths relative to your home directory. Configuration listed in the $NIX_CONFIG environment variable may not use relative paths.

Let's add something to the nix.conf docs explaining this.

With #482 closed, path configuration settings (some of them, at least) can support relative and tilde paths. Here's how I described it in the release notes (the links won't work): > [Configuration settings](@docroot@/command-ref/conf-file.md) can now refer to files with paths relative to the file they're written in or relative to your home directory (with `~/`). > > This makes settings like [`repl-overlays`](@docroot@/command-ref/conf-file.md#conf-repl-overlays) and [`secret-key-files`](@docroot@/command-ref/conf-file.md#conf-repl-overlays) much easier to set, especially if you'd like to refer to files in an existing dotfiles repo cloned into your home directory. > > If you put `repl-overlays = repl.nix` in your `~/.config/nix/nix.conf`, it'll load `~/.config/nix/repl.nix`. Similarly, you can set `repl-overlays = ~/.dotfiles/repl.nix` to load a file relative to your home directory. > > Configuration files can also [`include`](@docroot@/command-ref/conf-file.md#file-format) paths relative to your home directory. > > Only user configuration files (like `$XDG_CONFIG_HOME/nix/nix.conf` or the files listed in `$NIX_USER_CONF_FILES`) can use tilde paths relative to your home directory. Configuration listed in the `$NIX_CONFIG` environment variable may not use relative paths. Let's add something to the `nix.conf` docs explaining this.
rbt added the
docs
label 2024-09-01 22:36:08 +00:00
rbt added the
E/easy
E/help wanted
labels 2024-09-01 22:42:52 +00:00

I would like to try to work on this.

I would like to try to work on this.
Member

This issue was mentioned on Gerrit on the following CLs:

  • commit message in cl/2145 ("Mention support for ~/ paths in nix.conf in manual")
<!-- GERRIT_LINKBOT: {"cls": [{"backlink": "https://gerrit.lix.systems/c/lix/+/2145", "number": 2145, "kind": "commit message"}], "cl_meta": {"2145": {"change_title": "Mention support for `~/` paths in nix.conf in manual"}}} --> This issue was mentioned on Gerrit on the following CLs: * commit message in [cl/2145](https://gerrit.lix.systems/c/lix/+/2145) ("Mention support for `~/` paths in nix.conf in manual")
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#497
No description provided.