Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dual use #55

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ../.;
}
```
2 changes: 2 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 {})
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ outputs = _: { __functor = _: src: (import ./. {inherit src;}).result; }; }