I don’t think it is possible with the current library, but I do have a case where it could be useful.
In a recent change to services-flake, I made the default value for socketDir
option as ””
and when it is an empty-string, I don’t want the users to refer to this config, it doesn’t make sense. It only makes sense to refer to it when it is non-empty.
Is there a better way I can implement this? or is it a problem worth being solved upstream?
One way is types.nullOr types.string
This is much better since it will throw a “cannot coerce null to string” error, when trying to use the option in any shell script.
Last updated: Nov 15 2024 at 12:33 UTC