aboutsummaryrefslogtreecommitdiff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-02-20 22:14:44 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-02-20 22:14:44 +0100
commitd068f9ffff3d2a98e6dde0834a250e4930d44778 (patch)
treeea9359e05ea924fb32fe11c190bdefd13437d4b4 /src/nix
parent890df325c76a9acd90300bb3590e7d1b102e2c28 (diff)
Restore subdir support in registries
Hacky...
Diffstat (limited to 'src/nix')
-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);
}
};