aboutsummaryrefslogtreecommitdiff
path: root/src/nix/flake.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/flake.cc')
-rw-r--r--src/nix/flake.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc
index 9c94c59fc..42f5b2ce0 100644
--- a/src/nix/flake.cc
+++ b/src/nix/flake.cc
@@ -70,8 +70,8 @@ struct CmdFlakeList : EvalCommand
registry->type == Registry::Flag ? "flags " :
registry->type == Registry::User ? "user " :
"global",
- entry.first->to_string(),
- entry.second->to_string());
+ std::get<0>(entry)->to_string(),
+ std::get<1>(entry)->to_string());
}
}
}
@@ -506,9 +506,11 @@ struct CmdFlakeAdd : MixEvalArgs, Command
{
auto fromRef = parseFlakeRef(fromUrl);
auto toRef = parseFlakeRef(toUrl);
+ fetchers::Input::Attrs extraAttrs;
+ if (toRef.subdir != "") extraAttrs["subdir"] = toRef.subdir;
auto userRegistry = fetchers::getUserRegistry();
userRegistry->remove(fromRef.input);
- userRegistry->add(fromRef.input, toRef.input);
+ userRegistry->add(fromRef.input, toRef.input, extraAttrs);
userRegistry->write(fetchers::getUserRegistryPath());
}
};
@@ -555,7 +557,9 @@ struct CmdFlakePin : virtual Args, EvalCommand
auto userRegistry = fetchers::getUserRegistry();
userRegistry->remove(ref.input);
auto [tree, resolved] = ref.resolve(store).input->fetchTree(store);
- userRegistry->add(ref.input, resolved);
+ fetchers::Input::Attrs extraAttrs;
+ if (ref.subdir != "") extraAttrs["subdir"] = ref.subdir;
+ userRegistry->add(ref.input, resolved, extraAttrs);
}
};