Skip to content

Commit

Permalink
add withAllSystems, systems, system (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
PedroHLC authored Sep 28, 2023
1 parent 081a69e commit 7772afd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@ E.g.:
}
```

A minimalist example:
A minimalist pipeless example:

```nix
{
inputs = whatever0;
outputs = { nixpkgs, yafas, ... }@inputs:
yafas.withSystem "riscv64-linux" nixpkgs
(_prev: { pkgs, ... }: { packages.default = whatever2; })
{
myLibs = whatever1;
}
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;
};
}
```

Expand All @@ -45,11 +46,18 @@ A minimalist example:

We use [github.com:nix-systems/default](https://github.com/nix-systems/default) as `inputs.systems`, feel free to override it.

NOTE: This does not impact `system`, `systems`, `withSystems`, and `withSystem`.

### Constructors

- `allDarwin: nixpkgs -> applier -> ouputs`
- `allLinux: nixpkgs -> applier -> ouputs`
- `allSystems: system[] -> nixpkgs -> applier -> ouputs`
- Recommended:
- `allSystems: nixpkgs -> applier -> ouputs`
- `systems: system[] -> nixpkgs -> applier -> ouputs`
- `system: system -> nixpkgs -> applier -> ouputs`

- Filtered:
- `allDarwin: nixpkgs -> applier -> ouputs`
- `allLinux: nixpkgs -> applier -> ouputs`

Where `applier` is the lambda `{ pkgs, system }: { package.default = pkgs.callPackage ... { }; }`.

Expand All @@ -68,6 +76,7 @@ Where `applier` is a map applier.
### With per-system

- Multiple:
- `withAllSystems: nixpkgs -> applier -> outputs -> outputs`
- `withSystems: system[] -> nixpkgs -> applier -> outputs -> outputs`
- `withDarwin: nixpkgs -> applier -> outputs -> outputs`
- `withLinux: nixpkgs -> applier -> outputs -> outputs`
Expand Down
6 changes: 5 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,18 @@
in
withSchemas (import ./schemas.nix flake-schemas) {
# Constructors
allSystems = support importedSystems;
systems = support;
system = target: support [ target ];

allLinux = support linuxes;
allDarwin = support darwins;
allSystems = support (linuxes ++ darwins);

# With per-system
withSystems = support';
withDarwin = support' darwins;
withLinux = support' linuxes;
withAllSystems = support' importedSystems;

withSystem = target: support' [ target ];
withAarch64Linux = support' [ "aarch64-linux" ];
Expand Down

0 comments on commit 7772afd

Please sign in to comment.