flake-utils icon indicating copy to clipboard operation
flake-utils copied to clipboard

Add convenient generic attribute

Open jD91mZM2 opened this issue 3 years ago • 4 comments

Doing

{
  lib = {
    test = 1;
  };
} // eachDefaultSystem (system: {
  packages = { /* ... */ };
})

is really inconvenient. This lets you do

eachDefaultSystem (system: {
  lib.generic = {
    test = 1;
  };
  packages = { /* ... */ };
})

jD91mZM2 avatar Mar 14 '21 08:03 jD91mZM2

Agreed with the observation that the current situation could be better.

The proposed solution is not super discoverable and also re-instantiates the generic bits multiple times even if a single one will be used in the end.

What do you think of this instead?

eachDefaultSystem2 {
  generic = { lib.test = 1; };
  eachSystem = system: {
    packages = { /* ... */ };
  };
}

zimbatm avatar Mar 16 '21 20:03 zimbatm

Good idea!

jD91mZM2 avatar Mar 19 '21 12:03 jD91mZM2

@jD91mZM2: pushed another proposal. I think that generic should just override the top-level.

zimbatm avatar Mar 24 '21 21:03 zimbatm

https://www.redox-os.org/news/open-source-mental-health/

amitojsingh366 avatar Jun 14 '21 20:06 amitojsingh366