Skip to content

Use known folders for nix data on windows#14973

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

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

Conversation

@xokdvium
Copy link
Copy Markdown
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
Comment thread src/libstore/meson.build Outdated
@Eveeifyeve
Copy link
Copy Markdown
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
Comment thread src/nix/man-pages.cc
Comment thread src/libutil/windows/users.cc Outdated
@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
brittonr pushed a commit to brittonr/nix that referenced this pull request Apr 1, 2026
Use known folders for nix data on windows
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