Skip to content
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

Module Can Cause System Build Failures Even If Not Enabled #152

Closed
Infinidoge opened this issue Nov 1, 2022 · 2 comments · Fixed by #151
Closed

Module Can Cause System Build Failures Even If Not Enabled #152

Infinidoge opened this issue Nov 1, 2022 · 2 comments · Fixed by #151
Labels
bug Something isn't working

Comments

@Infinidoge
Copy link

Bug description

When the module has been imported and no options are set, a rebuild can fail with "error: attribute 'nixos' missing".
This is due to 27679db causing cfg.defaultUser to be eagerly evaluated regardless of cfg.enable being false/the default.
This causes a rebuild failure when the user nixos doesn't exist.

To Reproduce

Import module and set no options.
Experience rebuild failure

Expected behavior
No rebuild failure

Logs

error: attribute 'nixos' missing

       at /nix/store/pqfb6jic287q3d7s9jvz1w8lgrjnm3bi-source/modules/wsl-distro.nix:40:23:

           39|         inherit (cfg) automountPath;
           40|         defaultUser = config.users.users.${cfg.defaultUser};
             |                       ^
           41|       };

       … while evaluating the attribute 'uid' of the derivation 'syschdemd'

Additional Context

For simplicity, I have modules imported by all of the NixOS configurations I have in my configuration flake, and was confused to find that after bumping NixOS-WSL, the rebuild on my very-not-Windows laptop failed with a WSL-related issue.

The best solution would be to just not import the WSL module unless I absolutely need it, or to set defaultUser, but ideally the module wouldn't cause any problems by merely being imported, only when actually enabled.

@Infinidoge Infinidoge added the bug Something isn't working label Nov 1, 2022
@Infinidoge Infinidoge changed the title Module Can Cause Build Failures Even If Not Enabled Module Can Cause System Build Failures Even If Not Enabled Nov 1, 2022
@SuperSandro2000
Copy link
Member

Fixed by #151

@nzbr nzbr closed this as completed in #151 Nov 2, 2022
@nzbr
Copy link
Member

nzbr commented Nov 2, 2022

This wasn't supposed to happen, I'm very sorry for that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants