hlissner / dotfiles

And I say hey, what's going on?

Home Page:https://youtu.be/ZZ5LpwO-An4

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unnecessary type definition either str path

NANASHI0X74 opened this issue · comments

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?

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.