Skip to content
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
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ Input:
}: null
```

### `callLocklessFlake -> { path, inputs ? { } } -> attrs`

Imports a flake.nix without acknowledging its lock file, useful for
referencing subflakes from a parent flake. The second argument allows
specifying the inputs of this flake.

Example:
```
callLocklessFlake {
path = ./directoryContainingFlake;
inputs = { inherit nixpkgs; };
}
```

#### Example

Here is how it looks like in practice:
Expand Down
16 changes: 16 additions & 0 deletions call-lockless-flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
Imports a flake.nix without acknowledging its lock file, useful for
referencing subflakes from a parent flake. The second argument allows
specifying the inputs of this flake.
Example:
callLocklessFlake {
path = ./directoryContainingFlake;
inputs = { inherit nixpkgs; };
}
*/
{ path, inputs ? { } }:
let
self = { outPath = path; } //
((import (path + "/flake.nix")).outputs (inputs // { self = self; }));
in
self
2 changes: 2 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ let
# }
filterPackages = import ./filterPackages.nix { inherit allSystems; };

callLocklessFlake = import ./call-lockless-flake.nix;

# Returns the structure used by `nix app`
mkApp =
{ drv
Expand Down