From a1b45cd4a224023888702a60d6830bc0ab40c038 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 27 Nov 2024 16:44:58 +0100 Subject: [PATCH] Return all outputs They were already exposed in `defaultNix` and `shellNix`, but "polluted" by a `default` attribute and probably not very intuitive to find. Issue #15. --- README.md | 6 ++++++ default.nix | 2 ++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 3e99466..7dd387c 100644 --- a/README.md +++ b/README.md @@ -27,3 +27,9 @@ Afterwards, create a `default.nix` file containing the following: ``` If you would like a `shell.nix` file, create one containing the above, replacing `defaultNix` with `shellNix`. + +You can access any flake output via the `outputs` attribute returned by `flake-compat`, e.g. + +```nix +(import ... { src = ./.; }).outputs.packages.x86_64-linux.default +``` diff --git a/default.nix b/default.nix index 766844b..4d3fc32 100644 --- a/default.nix +++ b/default.nix @@ -229,6 +229,8 @@ let in rec { + outputs = result; + defaultNix = (builtins.removeAttrs result ["__functor"]) // (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {})