Open roberth opened 11 months ago
https://en.m.wikipedia.org/wiki/SUBST / https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-definedosdevicew are old things that allow us to mount directories as drives. This will keep MS-DOS paths working.
I do think we could end up using more UNC paths for path length reasons, however.
Therefore, I think we will be best off with
N:\x\store
Note that it is the same length as
/nix/store
which can allow for some janky rewrites :)
:
looking like i
is clever.
Still not a fan of "just" claiming a drive. This could be a huge blocker in established environments.
Can a network drive symlink to an arbitrary path? If so, that might be a workaround in such situations, but the workaround will be observable. Granted, Windows software is less aware of the existence of symlinks, as those were not traditionally part of the operating system.
same length
Should the UNC path then be \\ix\store
?
(\\
looks like n
if you squint really hard...)
Still not a fan of "just" claiming a drive. This could be a huge blocker in established environments.
Well, remember we're not claiming the whole drive, just the x
subdirectory at the root of it. I hope that is OK, and for situations where it really is not, they hopefully have enough resources to rebuild the world with a different store path?
Can a network drive symlink to an arbitrary path? If so, that might be a workaround in such situations, but the workaround will be observable. Granted, Windows software is less aware of the existence of symlinks, as those were not traditionally part of the operating system.
That seems like something that should work too. And yeah I think both will be observable so it's an OK place to start. I just worry that supposedly lots of software does not work with UNC paths.
You have to give the user the choice of drive in windows environment. The old cmd.exe doesn't like unc path for shell prompts, but powershell is fine with that. Windows users typically mount another drive letter for a UNC path to get around those limitations
Windows isn't as happy with symlinks and networks as linux is, hence allow any drive to be specified. :)
@ChristineBoersen I think we would indeed allow a user the choice of drive and directory within that drive, but a non-standard choice will result in not being able to use the cache. (At least, safely use the cache. Sedding is possible but only semi-reliable as it can mess up orderings, checksum, etc.)
https://github.com/NixOS/nix/issues/9549 I wrote this up for the much harder "true" solution of store objects that simple aren't allowed to know their own store dir, so we can be sure they are safe to relocate.
Hi! I am eager to see Nix on Windows. I hope you'll find this context useful:
One category of use cases for Nix is when the user (human using the computer) does not interact with Nix directly; rather, it's just a dependency of some dependencies of software that they need in order to do their job. This can become a likely case in corporate environments, when the system administration / devops / etc. team sets up software for non-technical users.
In corporate environments, Windows drive letters have very strong semantic significance. "The J drive" or "The P drive" is common lingo. These are usually configured to be mapped to network shares by system administrators.
As such, I think any proposal to claim a drive letter for the project's use is going to have a non-trivial risk of significantly impacting Nix adoption in such environments, for these reasons:
I would especially not recommend using N:\x
. It is non-descriptive and difficult to search for.
C:\nix\store
and \\nix\store
(if it can be made to work) sound great to me!
Requires admin permissions to modify
C:\
I believe that creating new directories in C:\
is usually allowed for unprivileged users.
However, a hypothetical "Nix for Windows" will be distributed in a format that's common for the platform, i.e. a Windows installer, right? In which case, requiring administrator permissions to install it is expected. It would also allow configuring permissions for the Nix store so that only the Nix daemon can write to it.
Hope this helps!
Hi!
I just finished trying some nix evals in Windows with the amazing job done by @Ericson2314 .
I'm pretty hyped for this, but I have several concerns about the Nix Store.
Also, this concern seems valid:
Windows isn't as happy with symlinks and networks as linux is, hence allow any drive to be specified. :)
Maybe making the nix store a vhdx mounted into a C:\nix is a good solution, it would mean that it can be easily replaced by any fs, easily copied and easy removed, but that may be more an user choice than a nix-lang design choice.
Another alternative, although it may seem a bit hacky is to use https://github.com/ModOrganizer2/usvfs MO2 team faced the problem of "symlinks on windows", and the solution for them was to hook the API to present a virtual fs.
This approach could also be used for nix store on windows, which would mean that we don't care where the store is anymore. However, this introduces complexity and points of failure, I would only consider this if symlinks become a problem when interacting with apps in Windows.
The most obvious choice however seems to be C:\nix, but maybe we can also get away with %appdata% on windows?
Other concern that comes to mind is the usual lenght-limit for paths: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
Which means that we have to tweak the windows registry to allow large paths, and minimum supported version may be Windows 10, version 1607
Is your feature request related to a problem? Please describe.
I don't know how we'd best present a store on windows. I'm anything but an expert on this, so I can only hope to provide seeds for a productive discussion.
Possible solutions
C:\nix\store
: works on most systems?C:\
\\nix\store
Priorities
Add :+1: to issues you find important.