Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

errors during install on wsl2 nixos #32

Open
sls opened this issue May 28, 2024 · 2 comments
Open

errors during install on wsl2 nixos #32

sls opened this issue May 28, 2024 · 2 comments

Comments

@sls
Copy link

sls commented May 28, 2024

I understand that this is a niche use case, but I want to document my results here for whatever benefit it may have. This WSL2 instance is a vanilla nixos stable:

$ sudo nix-channel --list
nixos https://nixos.org/channels/nixos-23.11
nixos-wsl https://github.com/nix-community/NixOS-WSL/archive/refs/heads/main.tar.gz

Following the description in https://github.com/auxolotl/templates "Getting Started" / "With Nixos", at the step:
$ nixos-generate-config --show-hardware-config > hardware-configuration.nix
the system responds with these errors:

ERROR: Not a Btrfs filesystem: Invalid argument
ERROR: Not a Btrfs filesystem: Invalid argument
ERROR: Not a Btrfs filesystem: Invalid argument

A hardware-configuration.nix is generated with a considerable numbers of stanzas that appear to correctly describe the instance, but it's not clear what effect if any the errors may have had on the output.

Subsequently trying to switch to a system based on this flake produces these errors:

$ sudo nixos-rebuild build --flake .#_hostname elided_
building the system configuration...
error:
       … while calling the 'head' builtin

         at /nix/store/62ca8xfz3n92p57sdds15r4s07kyls6i-source/lib/attrsets.nix:1575:11:

         1574|         || pred here (elemAt values 1) (head values) then
         1575|           head values
             |           ^
         1576|         else

       … while evaluating the attribute 'value'

         at /nix/store/62ca8xfz3n92p57sdds15r4s07kyls6i-source/lib/modules.nix:809:9:

          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: A definition for option `fileSystems."/mnt/wslg/distro".device' is not of type `null or string (with check: non-empty)'. Definition values:
       - In `/nix/store/dvgvzizjxrq0a157pilqnkb10pr9wkyh-source/hardware-configuration.nix': ""
@liketechnik
Copy link

liketechnik commented May 28, 2024

I believe the /mnt/wslg directory (and subdirectories) are WSL2 specific mounts, and it looks like nixos-generate-config doesn't handle those correctly for some reason.

Unfortunately, I'm not quite sure how this directory is mounted into WSL2 instances and how that might cause nixos-generate-config to fail (and I don't have a Windows to test/look into it).

(Side note: You might be interested in using NixOs-WSL for your nixos wsl configuration.)

@sls
Copy link
Author

sls commented May 29, 2024

I believe the /mnt/wslg directory (and subdirectories) are WSL2 specific mounts, and it looks like nixos-generate-config doesn't handle those correctly for some reason.

Unfortunately, I'm not quite sure how this directory is mounted into WSL2 instances and how that might cause nixos-generate-config to fail (and I don't have a Windows to test/look into it).

No worries, I wanted to document this issue for others and future attention, but I understand that aux is probably going to be concerned with more foundational issues for some time. This just happened to be the NixOs install I had to experiment with. Thanks for taking a look at it.

(Side note: You might be interested in using NixOs-WSL for your nixos wsl configuration.)

Yes, that's how this install was done. You'll see that in the nix-channel list at the top of the issue. A good pointer for anyone hoping to do this same thing, I agree.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants