Skip to content

nix registry pin: Mark the resulting registry entry as exact #12581

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
8 changes: 5 additions & 3 deletions src/libfetchers/registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,15 @@ void Registry::write(const Path & path)
void Registry::add(
const Input & from,
const Input & to,
const Attrs & extraAttrs)
const Attrs & extraAttrs,
bool exact)
{
entries.emplace_back(
Entry {
.from = from,
.to = to,
.extraAttrs = extraAttrs
.extraAttrs = extraAttrs,
.exact = exact
});
}

Expand Down Expand Up @@ -142,7 +144,7 @@ void overrideRegistry(
const Input & to,
const Attrs & extraAttrs)
{
getFlagRegistry(*from.settings)->add(from, to, extraAttrs);
getFlagRegistry(*from.settings)->add(from, to, extraAttrs, false);
}

static std::shared_ptr<Registry> getGlobalRegistry(const Settings & settings, ref<Store> store)
Expand Down
3 changes: 2 additions & 1 deletion src/libfetchers/registry.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ struct Registry
void add(
const Input & from,
const Input & to,
const Attrs & extraAttrs);
const Attrs & extraAttrs,
bool exact);

void remove(const Input & input);
};
Expand Down
4 changes: 2 additions & 2 deletions src/nix/registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct CmdRegistryAdd : MixEvalArgs, Command, RegistryCommand
fetchers::Attrs extraAttrs;
if (toRef.subdir != "") extraAttrs["dir"] = toRef.subdir;
registry->remove(fromRef.input);
registry->add(fromRef.input, toRef.input, extraAttrs);
registry->add(fromRef.input, toRef.input, extraAttrs, false);
registry->write(getRegistryPath());
}
};
Expand Down Expand Up @@ -193,7 +193,7 @@ struct CmdRegistryPin : RegistryCommand, EvalCommand
warn("flake '%s' is not locked", resolved.to_string());
fetchers::Attrs extraAttrs;
if (ref.subdir != "") extraAttrs["dir"] = ref.subdir;
registry->add(ref.input, resolved, extraAttrs);
registry->add(ref.input, resolved, extraAttrs, true);
registry->write(getRegistryPath());
}
};
Expand Down
Loading