Skip to content

Commit

Permalink
refactor: Introduce isRoot in call-flake.nix
Browse files Browse the repository at this point in the history
  • Loading branch information
roberth committed Sep 4, 2023
1 parent ab6dbf3 commit 1f739ff
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libexpr/flake/call-flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ let
builtins.mapAttrs
(key: node:
let
# Flakes should be interchangeable regardless of whether they're at the root, so use with care.
isRoot = key == lockFile.root;

sourceInfo =
if key == lockFile.root
if isRoot
then rootSrc
else fetchTree (node.info or {} // removeAttrs node.locked ["dir"]);

subdir = if key == lockFile.root then rootSubdir else node.locked.dir or "";
subdir = if isRoot then rootSubdir else node.locked.dir or "";

outPath = sourceInfo + ((if subdir == "" then "" else "/") + subdir);

Expand Down

0 comments on commit 1f739ff

Please sign in to comment.