stylix icon indicating copy to clipboard operation
stylix copied to clipboard

stylix: remove human name duplication

Open trueNAHO opened this issue 5 months ago • 5 comments

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>";
    }
    

trueNAHO avatar Jul 09 '25 14:07 trueNAHO

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 -

0xda157 avatar Jul 09 '25 15:07 0xda157

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.

trueNAHO avatar Jul 09 '25 15:07 trueNAHO

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's humanName argument in favor of meta.nix's name attribute, it might be a lot easier once the mkTarget migration is done.

This wouldn't work for modules with multiple targets like Discord or Firefox

Ideally, mkTarget's currently mandatory humanName argument is removed and meta.nix's name attribute becomes mandatory instead.

meta.nix's name attribute is already required

Flameopathic avatar Jul 09 '25 19:07 Flameopathic

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.

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.

trueNAHO avatar Jul 10 '25 14:07 trueNAHO

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.

danth avatar Jul 13 '25 19:07 danth