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

nixos/config/timezone: Disallow spaces #30258

Merged
merged 1 commit into from Oct 14, 2017
Merged

Conversation

srhb
Copy link
Contributor

@srhb srhb commented Oct 9, 2017

Motivation for this change

#20115 causes a very strange and hard to debug error, and it's easy to accidentally write "New York" instead of "New_York"

I would have preferred a check morally equivalent to tz: lib.pathExists "${pkgs.tzdata}/share/zoneinfo/right/${tz}", but I can't figure out how to do so in a pure manner without hardcoding an enum with all the contents.

This should prevent the most frequent mistake anyway.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@danbst
Copy link
Contributor

danbst commented Oct 9, 2017

What's the error when user writes timezone with space?

@srhb
Copy link
Contributor Author

srhb commented Oct 9, 2017

Sorry, I forgot to link issue #20115.

We also just had a user in #nixos who had nixos-install fail in an even wonkier fashion

[...]
setting up /etc...
/etc/resolvconf.conf: line 5: hopopt: command not found
/etc/resolvconf.conf: line 6: icmp: command not found
/etc/resolvconf.conf: line 7: igmp: command not found
/etc/resolvconf.conf: line 8: ggp: command not found
/etc/resolvconf.conf: line 9: ipv4: command not found
/etc/resolvconf.conf: line 10: st: command not found
/etc/resolvconf.conf: line 11: tcp: command not found
/etc/resolvconf.conf: line 12: cbt: command not found`
[... etc.]

@danbst
Copy link
Contributor

danbst commented Oct 9, 2017

No, I mean, with this PR, what would be the error message?

@srhb
Copy link
Contributor Author

srhb commented Oct 9, 2017

Oh!

The option value `time.timeZone' in `/etc/nixos/configuration.nix' is not a null or string without spaces.

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

Successfully merging this pull request may close these issues.

None yet

3 participants