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

unnecessary type definition either str path #19

Closed
NANASHI0X74 opened this issue May 20, 2021 · 1 comment
Closed

unnecessary type definition either str path #19

NANASHI0X74 opened this issue May 20, 2021 · 1 comment

Comments

@NANASHI0X74
Copy link

Hi!

I'm restructuring my nixos configurations and migrating to using flakes and used this as a reference, both to copy parts of code from and to learn some design patterns and generally things about nixos.

Now I'm trying to read and understand the code, and I've noticed that this let seems unnecessary:

dotfiles = let t = either str path; in {

According to https://nixos.org/manual/nixos/stable/index.html#sec-option-types-basic, types.path is defined as
A filesystem path, defined as anything that when coerced to a string starts with a slash.
So that should already include str, right? Or am I missing something?

@hlissner
Copy link
Owner

hlissner commented May 22, 2021

I'm a little foggy on it, but I believe I did this because I didn't want strings to be coerced into paths, because relative paths would be coerced into the nix store. That said, this doesn't apply everywhere (e.g. where absolute paths are concerned), and the reasoning may have been based on a misconception I never bothered to correct. I'll look into it.

hlissner added a commit that referenced this issue Jul 28, 2021
Mentioned in #19
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

No branches or pull requests

2 participants