add dual use #55

Closed
blaggacao wants to merge 1 commit from blaggacao/add-dual-use into master
3 changed files with 22 additions and 0 deletions

View file

@ -27,3 +27,22 @@ 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`. If you would like a `shell.nix` file, create one containing the above, replacing `defaultNix` with `shellNix`.
## Call Parent Flake (second use)
To use, add the following to your subflake's flake.nix:
```nix
{
inputs.flake-compat.url = "github:edolstra/flake-compat";
}
```
Afterwards, you can use it to call a flake from anywhere, including a parent directory, as follows:
```nix
{
parent = flake-compat ../.;
}
```

View file

@ -188,6 +188,8 @@ let
in in
rec { rec {
inherit result; # consumed by flake.nix
defaultNix = defaultNix =
(builtins.removeAttrs result ["__functor"]) (builtins.removeAttrs result ["__functor"])
// (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {}) // (if result ? defaultPackage.${system} then { default = result.defaultPackage.${system}; } else {})

1
flake.nix Normal file
View file

@ -0,0 +1 @@
{ outputs = _: { __functor = _: src: (import ./. {inherit src;}).result; }; }