Pipe-optimized with-pattern-functions for making Nix-flakes' output easier to use.
E.g.:
{
inputs = whatever0;
outputs = { nixpkgs, yafas, ... }@inputs:
yafas.allLinux nixpkgs
({ pkgs, system }: { packages.default = whatever1; })
|> yafas.withAarch64Darwin nixpkgs
(_prev: { pkgs, ... }: { packages.default = whatever2; })
|> yafas.withOverlays
(_prev: { default = whatever3; })
|> yafas.withOverlay "cool"
(_prev: whatever3)
|> yafas.withUniversals
(_prev: { myLibs = whatever4; })
|> yafas.map
(prev: prev // { myLibs = prev.myLibs // { }; });
}A minimalist pipeless example:
{
inputs = whatever0;
outputs = { nixpkgs, yafas, ... }@inputs: yafas.withAllSystems nixpkgs
(universals: { pkgs, ... }: with universals; {
packages.default = pkgs.callPackage ./some-drv.nix { inherit myLibs; }
})
rec {
myLibs = import ./pure-lib.nix;
};
}We use github.com:nix-systems/default as inputs.systems, feel free to override it.
NOTE: This does not impact system, systems, withSystems, and withSystem.
-
Recommended:
allSystems: nixpkgs -> applier -> ouputssystems: system[] -> nixpkgs -> applier -> ouputssystem: system -> nixpkgs -> applier -> ouputs
-
Filtered:
allDarwin: nixpkgs -> applier -> ouputsallLinux: nixpkgs -> applier -> ouputs
Where applier is the lambda { pkgs, system }: { package.default = pkgs.callPackage ... { }; }.
NOTE: These function will do a system-name injection, so all the outputs here have to be system-specific:
packages.default = x; -> packages.${system}.default = x;
formatter = y; -> formatter.${system} = y;
map: applier -> outputs -> x
Where applier is a map applier.
-
Multiple:
withAllSystems: nixpkgs -> applier -> outputs -> outputswithSystems: system[] -> nixpkgs -> applier -> outputs -> outputswithDarwin: nixpkgs -> applier -> outputs -> outputswithLinux: nixpkgs -> applier -> outputs -> outputs
-
Single:
withSystem: system -> nixpkgs -> applier -> outputs -> outputswithAarch64Linux: nixpkgs -> applier -> outputs -> outputswithAMD64Linux: nixpkgs -> applier -> outputs -> outputswithAarch64Darwin: nixpkgs -> applier -> outputs -> outputswithAMD64Darwin: nixpkgs -> applier -> outputs -> outputs
Where applier is the lambda _prevOutputs: { pkgs, system }: { package.default = pkgs.callPackage ... { }; }.
NOTE: Read Constructors' notes.
-
Generic:
withNestedSystem: outputName -> applier -> outputs -> outputs
-
Specific:
withApps: applier -> outputs -> outputswithDevShells: applier -> outputs -> outputswithLegacyPackages: applier -> outputs -> outputswithPackages: applier -> outputs -> outputswithFormatter: applier -> outputs -> outputs
Where applier is the lambda _prevOutputs: { pkgs, system }: { default = pkgs.callPackage ... { }; }.
-
Generic:
withUniversals: applier -> outputs -> outputswithUniversal: outputName -> applier -> ouputs -> ouputs
-
Specific:
withHomeManagerModules: applier -> ouputs -> ouputswithNixOSModules: applier -> ouputs -> ouputswithOverlays: applier -> ouputs -> ouputswithSchemas: applier -> ouputs -> ouputs
Where applier is the lambda _prevOutputs: { <name> = <value>; }.
-
Generic:
withNestedUniversal: outputName -> name -> outputs -> outputs
-
Specific:
withHomeManagerModule: name -> outputs -> outputswithNixOSModule: name -> outputs -> outputswithOverlay: name -> outputs -> outputswithSchema: name -> outputs -> outputs
Where applier is the lambda _prevOutputs: { <name> = <value>; }.