-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use proper option types for wsl.conf
#153
Conversation
description = "Support running Windows binaries from the linux shell."; | ||
}; | ||
appendWindowsPath = mkOption { | ||
type = bool; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is currently a string which contains the boolean.
error: A definition for option `wsl.wslConf.interop.appendWindowsPath' is not of type `boolean'. Definition values:
- In `/nix/store/byrkin8wmr9hbzqhnsfa01bj2g7xij81-source/common/modules.nix': "false"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is that string? Was it an old default config? The current default configuration.nix as well as my flake config build just fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is some option I have currently set but I no longer know why and from where I got it. Also can't find any reference in code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I now know the root cause of this: before wslConf was a freeform setting that accepted a lot more than it should. Now that the options are properly typed errors are properly surfaced and you can no longer set an identical string to an otherwise boolean option.
systemd = mkOption { | ||
type = bool; | ||
default = false; | ||
description = "Use systemd as init. There's no need to enable this manually, use the wsl.nativeSystemd option instead"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should assert or warn this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I'll add a warning
boot = { | ||
command = mkOption { | ||
type = str; | ||
default = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example would be great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't really useful on NixOS, because we have systemd. The command is started using the root shell, so syschdemd would drop it to user privileges anyway. MS intends this to be used to start a daemon in the background (their example is starting docker)
Co-authored-by: Sandro <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't test again but looks alright
* upstream/main: Fix syschdemd exit code (nix-community#140) update remaining references to wsl.automountPath (nix-community#158) Update flakes (nix-community#124) wsl.conf: proper option types (nix-community#153) Fix eval by disabling module completely when wsl.enable = false (nix-community#151) NixOS users.users.<user> attribute name and .name can differ (nix-community#147) switch nixpkgs.overlays to inline overlay (nix-community#150) feat: native systemd support (nix-community#134) remove boot.isContainer (nix-community#145) Do not import minimal profile by default (nix-community#144)
wsl.conf
Added proper types for all options that can be set in wsl.conf to avoid typos and using wrong types