stylix: remove human name duplication
Once the mkTarget migration is complete, our future custom module system could be adapted to avoid duplicating the target's human name:
-
# /modules/<MODULE>/meta.nix { name = "<HUMAN_NAME>"; } -
# /modules/<MODULE>/<PLATFORM>.nix { mkTarget, ... }: mkTarget { name = "<MODULE>"; humanName = "<HUMAN_NAME>"; }
note that this can be accomplished now with, I'll make a pr as soon as I work out some issues with using callPackage with our doc eval.
{ callPackage }:
{
name,
humanName ? (callPackage ./meta.nix { }).${name}.name,
# - snip -
note that this can be accomplished now
Yes, but if we remove mkTarget's humanName argument in favor of meta.nix's name attribute, it might be a lot easier once the mkTarget migration is done.
Ideally, mkTarget's currently mandatory humanName argument is removed and meta.nix's name attribute becomes mandatory instead.
note that this can be accomplished now with, I'll make a pr as soon as I work out of issues with using callPackage with our doc eval.
{ callPackage }: { name, humanName ? (callPackage ./meta.nix { }).${name}.name, # - snip -
This looks great. Maybe we could also default name to the name of the module directory, too.
note that this can be accomplished now
Yes, but if we remove
mkTarget'shumanNameargument in favor ofmeta.nix'snameattribute, it might be a lot easier once themkTargetmigration is done.
This wouldn't work for modules with multiple targets like Discord or Firefox
Ideally,
mkTarget's currently mandatoryhumanNameargument is removed andmeta.nix'snameattribute becomes mandatory instead.
meta.nix's name attribute is already required
note that this can be accomplished now with, I'll make a pr as soon as I work out of issues with using callPackage with our doc eval.
{ callPackage }: { name, humanName ? (callPackage ./meta.nix { }).${name}.name, # - snip -This looks great. Maybe we could also default
nameto the name of the module directory, too.
Unsure whether this would be too magical. Maybe once we have implemented our custom module system, this will be easier to estimate. I suggest leaving the name inference for later.
Unsure whether this would be too magical. Maybe once we have implemented our custom module system, this will be easier to estimate.
I agree, this could be confusing for contributors who aren't too familiar with how mkTarget works.
This wouldn't work for modules with multiple targets like Discord or Firefox
Technically, the name in meta.nix is the name of the module, while the name in mkTarget is the name of the target. One could argue that this isn't duplication at all, since they are two different things which just happen to have the same value most of the time. It only really makes sense to apply a default when there's only one target in a module.