hlissner / dotfiles

And I say hey, what's going on?
https://youtu.be/ZZ5LpwO-An4
MIT License
1.62k stars 98 forks source link

unnecessary type definition either str path #19

Closed NANASHI0X74 closed 2 years ago

NANASHI0X74 commented 3 years ago

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: https://github.com/hlissner/dotfiles/blob/1173284b76561d41edcb17062badccda012f7f2e/modules/options.nix#L9

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 commented 3 years ago

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.