# Motivation
I've always had a nagging feeling that sprinkles,
despite my love for it, was just really fucking ugly. I understand why this route was taken,
it is far more logically consistent than mine (e.g the attrSet passed to
outputs is the return value of the sprinkle), but it just feels terrible to use.
So, taking inspiration from the UX of flakes and trimming all the fat I could, I
came up with this.
# Comparison
# Before
{ sprinkles ? null }:
let
sources = {
sprinkles = <sprinkles>;
nixpkgs = <nixpkgs>;
};
inputs = sources: {
sprinkles = if sprinkles == null
then import sources.sprinkles
else sprinkles;
pkgs = import sources.nixpkgs {};
};
in
(inputs sources).sprinkles.new {
inherit inputs sources;
outputs = self: {
default = self.inputs.pkgs.hello;
};
}# After
{ sprinkles ? <sprinkles> } @ overrides:
(import sprinkles).new {
inherit overrides;
sources = { nixpkgs = <nixpkgs>; };
inputs = {nixpkgs}: { pkgs = import nixpkgs {}; };
outputs = {pkgs}: pkgs.hello;
}# Documented Changes
Theres a chance I've missed some changes since I didn't record an indev changelog, but these are all the major changes.
sprinklesis now imported in the sprinkle's top level parameters.- Overrides are now performed using the top level parameters of a sprinkle.
- There is no longer a let-in block to define
sourcesandinputs. inputsnow expects an attrSet which can containsources,inputsor any attr ofsources.inputscan be self-referential.sprinkles.newis now called using the one passed via the top level parameters, rather than frominputs.outputsnow expects an attrSet which can containsources,inputs,outputs, or any attr ofinputs.outputsnow no longer needs to return an attrSet.- Sprinkles no longer return an attrSet with
sources,inputs,outputs, andoverride. Instead, they return the attrs ofoutputs.