feat: enable dual use for subflakes until is fixed https://github.com/NixOS/nix/issues/6352

This commit is contained in:
David Arnold 2023-04-15 22:29:12 -05:00
parent 6f56392cc4
commit 3ae3af556f
No known key found for this signature in database
GPG key ID: 0318D822BAC965CC
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`.
## 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
rec {
inherit result; # consumed by flake.nix
defaultNix =
(builtins.removeAttrs result ["__functor"])
// (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; }; }