From 707aa140e422ed2ae0988f22fcd7ec5ce6680067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?PedroHLC=20=E2=98=AD?= Date: Thu, 28 Sep 2023 15:37:43 -0300 Subject: [PATCH 1/3] add {with,}{all,}System{s,} --- README.md | 29 +++++++++++++++++++---------- flake.nix | 6 +++++- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d026ba7..21db797 100644 --- a/README.md +++ b/README.md @@ -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; + }; } ``` @@ -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 `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 ... { }; }`. @@ -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` diff --git a/flake.nix b/flake.nix index 4fcb5b4..db40208 100644 --- a/flake.nix +++ b/flake.nix @@ -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" ]; From a0676b3cd5f0626872d186a087e297ab1ad7701e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?PedroHLC=20=E2=98=AD?= Date: Thu, 28 Sep 2023 15:39:13 -0300 Subject: [PATCH 2/3] oops --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 21db797..8a7043a 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ A minimalist pipeless 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 `systems`, `withSystems`, and `withSystem`. +NOTE: This does not impact `system`, `systems`, `withSystems`, and `withSystem`. ### Constructors From bf4df63acb44c260c441518f029c2bafe74186e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?PedroHLC=20=E2=98=AD?= Date: Thu, 28 Sep 2023 15:39:24 -0300 Subject: [PATCH 3/3] fmt --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index db40208..aaa9609 100644 --- a/flake.nix +++ b/flake.nix @@ -94,7 +94,7 @@ allSystems = support importedSystems; systems = support; system = target: support [ target ]; - + allLinux = support linuxes; allDarwin = support darwins;