14#include <unordered_map>
16#include <nlohmann/json.hpp>
28namespace flox::resolver {
53 ~LockedInputRaw() =
default;
54 LockedInputRaw() : fingerprint( nix::htSHA256 ) {}
55 LockedInputRaw(
const LockedInputRaw & ) =
default;
56 LockedInputRaw( LockedInputRaw && ) =
default;
59 operator=(
const LockedInputRaw & )
62 operator=( LockedInputRaw && )
65 explicit LockedInputRaw(
const pkgdb::PkgDbReadOnly & pdb )
66 : fingerprint( pdb.fingerprint )
67 , url( pdb.lockedRef.string )
68 , attrs( pdb.lockedRef.attrs )
71 explicit LockedInputRaw(
const pkgdb::PkgDbInput & input )
72 : LockedInputRaw( *input.getDbReadOnly() )
75 explicit operator nix::FlakeRef()
const
77 return nix::FlakeRef::fromAttrs(
78 nix::fetchers::jsonToAttrs( this->attrs ) );
81 explicit operator RegistryInput()
const
83 return RegistryInput(
static_cast<nix::FlakeRef
>( *
this ) );
87 operator==(
const LockedInputRaw & other )
const
89 return ( this->fingerprint == other.fingerprint )
90 && ( this->url == other.url ) && ( this->attrs == other.attrs );
94 operator!=(
const LockedInputRaw & other )
const
96 return ! ( ( *this ) == other );
107from_json(
const nlohmann::json & jfrom, LockedInputRaw & raw );
111to_json( nlohmann::json & jto,
const LockedInputRaw & raw );
118operator<<( std::ostream & oss,
const LockedInputRaw & raw );
127 LockedInputRaw input;
135 return ( this->input == other.input )
136 && ( this->attrPath == other.attrPath )
137 && ( this->priority == other.priority )
138 && ( this->info == other.info );
144 return ! ( ( *this ) == other );
172 = std::unordered_map<InstallID, std::optional<LockedPackageRaw>>;
185 std::unordered_map<System, SystemPackages> packages;
186 unsigned lockfileVersion = 0;
298 explicit Lockfile( std::filesystem::path lockfilePath );
337 [[nodiscard]]
const std::unordered_map<InstallID, ManifestDescriptor> &
const InstallDescriptors & getDescriptors() const
Get descriptors from the manifest's ‘install’ field.
Definition: manifest.hh:384
An exception thrown when a lockfile is invalid.
A locked representation of an environment.
Definition: lockfile.hh:238
const LockfileRaw & getLockfileRaw() const
Get the raw representation of the lockfile.
Definition: lockfile.hh:310
LockfileRaw lockfileRaw
Definition: lockfile.hh:243
RegistryRaw packagesRegistryRaw
Definition: lockfile.hh:251
EnvironmentManifest manifest
Definition: lockfile.hh:249
void checkGroups() const
Check the lockfile's packages.** locked inputs align with the requested groups in manifest....
Definition: lockfile.cc:41
const EnvironmentManifest & getManifest() const
Get old manifest.
Definition: lockfile.hh:331
void init()
Initialize manifest and packagesRegistryRaw from lockfileRaw.
Definition: lockfile.cc:126
const RegistryRaw & getPackagesRegistryRaw() const
Get the packagesRegistryRaw, containing all inputs used by packages.** members of the lockfile.
Definition: lockfile.hh:350
const RegistryRaw & getRegistryRaw() const
Get the locked registry from the raw lockfile.
Definition: lockfile.hh:324
std::size_t removeUnusedInputs()
Drop any registry.inputs and registry.priority members that are not explicitly declared in the manife...
Definition: lockfile.cc:442
const ManifestRaw & getManifestRaw() const
Get the original manifest used to create the lockfile.
Definition: lockfile.hh:317
const std::unordered_map< InstallID, ManifestDescriptor > & getDescriptors() const
Get old descriptors.
Definition: lockfile.hh:338
void check() const
Check the lockfile's validity, throwing an exception for invalid contents.
Definition: lockfile.cc:102
Definitions of various std::exception children used for throwing errors with nice messages and typed ...
#define FLOX_DEFINE_EXCEPTION(NAME, ERROR_CODE, CATEGORY_MSG)
Generate a class definition with an error code and category message.
Definition: exceptions.hh:206
An abstract description of an environment in its unresolved state.
nix::flake::Fingerprint Fingerprint
Definition: read.hh:93
std::ostream & operator<<(std::ostream &oss, const SqlVersions &versions)
Emit version information to an output stream.
Definition: read.cc:44
@ EC_INVALID_LOCKFILE
Definition: exceptions.hh:73
void from_json(const nlohmann::json &jfrom, RawPackage &pkg)
Convert a JSON object to a flox::RawPackage.
Definition: raw-package.cc:27
void to_json(nlohmann::json &jto, const FloxException &err)
Convert a flox::FloxException to a JSON object.
Definition: exceptions.cc:27
std::vector< std::string > AttrPath
A list of key names addressing a location in a nested JSON-like object.
Definition: types.hh:33
Interfaces for reading a SQLite3 package set database.
A set of user inputs used to set input preferences during search and resolution.
A set of user inputs used to set input preferences during search and resolution.
Definition: registry.hh:297
A locked package's installable URI.
Definition: lockfile.hh:125
An environment lockfile in its raw form.
Definition: lockfile.hh:181
void check() const
Check the lockfile for validity, throw and exception if it is invalid.
Definition: lockfile.cc:27
void clear()
Reset to default/empty state.
Definition: lockfile.cc:335
A raw description of an environment to be read from a file.
Definition: manifest-raw.hh:264
Miscellaneous typedefs and aliases.