Skip to content

Use known folders for nix data on windows#14973

Merged
xokdvium merged 2 commits intomasterfrom
windows-known-folders
Jan 17, 2026
Merged

Use known folders for nix data on windows#14973
xokdvium merged 2 commits intomasterfrom
windows-known-folders

Conversation

@xokdvium
Copy link
Contributor

Motivation

This is the usual conventions on windows.

See https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid and https://github.com/adrg/xdg for examples of the mapping of XDG paths to Windows known folders.

Tested on wine.

Sample output:

System type: x86_64-windows
Additional system types:
Features: signed-caches
System configuration file: "C:\\ProgramData\\nix\\nix.conf"
User configuration files: C:\users\xokdvium\AppData\Roaming\nix\config\nix.conf
Store directory: Z:/tmp/nix-wine/store
State directory: Z:\tmp\nix-wine\var
Data directory: Z:\tmp\nix-wine\share

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@Ericson2314 Ericson2314 force-pushed the windows-known-folders branch 2 times, most recently from b09e9ba to 93b4260 Compare January 11, 2026 03:31
@Eveeifyeve
Copy link
Member

Good point this might be useful for msys2/MINGW-packages#22499

@Ericson2314 Ericson2314 force-pushed the windows-known-folders branch 2 times, most recently from 7e2502a to 0777ac0 Compare January 16, 2026 20:57
@github-actions github-actions bot added the new-cli Relating to the "nix" command label Jan 16, 2026
It does not belong in libutil.
@Ericson2314 Ericson2314 force-pushed the windows-known-folders branch 2 times, most recently from 89218c8 to 8bf2f1d Compare January 16, 2026 22:39
@xokdvium xokdvium enabled auto-merge January 16, 2026 23:11
This is the usual conventions on windows.

See https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid and
https://github.com/adrg/xdg for examples of the mapping of XDG paths to Windows
known folders.

Additionally, on Windows, this allows us to dispense with a hard-coded
default for `nixConfDir`, which is both nice (fewer compile-time
configuration options) and necessary, because we don't know what drive
the `ProgramData` directory will live on.

Tested on wine.

Co-Authored-By: John Ericson <John.Ericson@Obsidian.Systems>
@xokdvium xokdvium force-pushed the windows-known-folders branch from 8bf2f1d to 5d29385 Compare January 16, 2026 23:13
@xokdvium xokdvium added this pull request to the merge queue Jan 16, 2026
Merged via the queue into master with commit af7c7b6 Jan 17, 2026
18 checks passed
@xokdvium xokdvium deleted the windows-known-folders branch January 17, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-cli Relating to the "nix" command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants