dream2nix
dream2nix copied to clipboard
RFC: a more flexible flake-parts API for dream2nix
trafficstars
Currently, the flake-parts API has two "layers":
dream2nix.inputs.<name>, with the optionssource,settings,inject, and overridesdream2nix.inputs.<name>.projects.<name>, with the optionsname,version,relPath,subsystem,translator
I think these two layers should really be collapsed into one layer, with a "translator inputs" option for each project. This would solve a number of problems:
- A translator's goal is to produce a dream-lock. For the most flexibility, it should be allowed to do so "by any means." For example, the
hackagetranslator takes anameand aversionand produces a dream-lock.sourcedoesn't really make sense as an option for this translator. sourceOverridesandpackageOverrides(in the "inputs" layer) only make sense in the context of a subsystem, butsubsystemis defined later in the "packages" layerrelPathcan always be incorporated intosource, and feels redundant. e.g.${some-path-or-derivation}/subdirectory- For some translators,
versionhas no effect on the output. (cabal-planwrites the same version into the dream-lock regardless of theversioninput.) This could be made less confusing (and overrides more explicit) with custom "translator inputs" types for each translator. - "name" is defined four times in the current API, and it is not clear how each option affects the behavior of dream2nix:
dream2nix.inputs.<name>dream2nix.inputs.<name>.pnamedream2nix.inputs.<name>.projects.<name>dream2nix.inputs.<name>.projects.<name>.name