42struct ManifestDescriptor;
51namespace flox::resolver {
57 "resolution failure" );
122 using Upgrades = std::variant<bool, std::vector<InstallID>>;
129 std::optional<RegistryRaw> combinedRegistryRaw;
131 std::optional<Options> combinedOptions;
133 std::optional<pkgdb::PkgQueryArgs> combinedBaseQueryArgs;
138 std::shared_ptr<Registry<pkgdb::PkgDbInputFactory>> dbs;
142 lockPackage(
const LockedInputRaw & input,
152 return lockPackage( LockedInputRaw( input ),
162 [[nodiscard]] std::vector<InstallDescriptors>
166 [[nodiscard]] std::vector<InstallDescriptors>
182 [[nodiscard]] std::optional<pkgdb::row_id>
206 [[nodiscard]] std::variant<InstallID, SystemPackages>
250 [[nodiscard]] std::optional<LockedInputRaw>
253 const System & system )
const;
267 const System & system )
const;
282 explicit Environment( EnvironmentManifest
manifest,
283 std::optional<Lockfile>
oldLockfile = std::nullopt )
289 [[nodiscard]]
const std::optional<GlobalManifest> &
290 getGlobalManifest()
const
295 [[nodiscard]] std::optional<GlobalManifestRaw>
296 getGlobalManifestRaw()
const
298 const auto & global = this->getGlobalManifest();
299 if ( ! global.has_value() ) {
return std::nullopt; }
300 return global->getManifestRaw();
303 [[nodiscard]]
const EnvironmentManifest &
309 [[nodiscard]]
const ManifestRaw &
310 getManifestRaw()
const
312 return this->getManifest().getManifestRaw();
316 [[nodiscard]] std::optional<ManifestRaw>
319 [[nodiscard]] std::optional<Lockfile>
320 getOldLockfile()
const
334 [[nodiscard]] RegistryRaw &
341 [[nodiscard]]
const pkgdb::PkgQueryArgs &
345 [[nodiscard]] std::vector<System>
352 [[nodiscard]] nix::ref<Registry<pkgdb::PkgDbInputFactory>>
Mixin which provides a lazy handle to a nix store connection.
Definition: nix-state.hh:59
A SQLite3 database used to cache derivation/package information about a single locked flake.
Definition: read.hh:135
A collection of data associated with an environment and its state.
Definition: environment.hh:97
Lockfile createLockfile()
Create a new lockfile from manifest.
Definition: environment.cc:692
nix::ref< Registry< pkgdb::PkgDbInputFactory > > getPkgDbRegistry()
Lazily initialize and get the combined registry's DBs.
Definition: environment.cc:94
std::optional< ManifestRaw > getOldManifestRaw() const
Get the old manifest from oldLockfile if it exists.
Definition: environment.cc:116
std::vector< System > getSystems() const
Get the set of supported systems.
Definition: environment.hh:346
const pkgdb::PkgQueryArgs & getCombinedBaseQueryArgs()
Get a base set of flox::pkgdb::PkgQueryArgs from combined options.
Definition: environment.cc:320
std::optional< LockedInputRaw > getGroupInput(const InstallDescriptors &group, const Lockfile &oldLockfile, const System &system) const
Get locked input from a lockfile to try to use to resolve a group of packages.
Definition: environment.cc:387
const Options & getCombinedOptions()
Get a merged form of oldLockfile or globalManifest ( if available ) and manifest options.
Definition: environment.cc:288
EnvironmentManifest manifest
Definition: environment.hh:109
ResolutionResult tryResolveGroup(const InstallDescriptors &group, const System &system)
Try to resolve a group of descriptors.
Definition: environment.cc:463
std::optional< GlobalManifest > globalManifest
Definition: environment.hh:106
std::variant< bool, std::vector< InstallID > > Upgrades
Indicator for lockfile upgrade operations.
Definition: environment.hh:122
bool groupIsLocked(const InstallDescriptors &group, const Lockfile &oldLockfile, const System &system) const
Check if lock from @ oldLockfile can be reused for a group.
Definition: environment.cc:146
std::variant< InstallID, SystemPackages > tryResolveGroupIn(const InstallDescriptors &group, const pkgdb::PkgDbInput &input, const System &system)
Try to resolve a group of descriptors in a given package database.
Definition: environment.cc:550
std::optional< pkgdb::row_id > tryResolveDescriptorIn(const ManifestDescriptor &descriptor, const pkgdb::PkgDbInput &input, const System &system)
Try to resolve a descriptor in a given package database.
Definition: environment.cc:334
RegistryRaw & getCombinedRegistryRaw()
Get a merged form of oldLockfile ( if available ), globalManifest ( if available ) and manifest regis...
Definition: environment.cc:52
std::optional< LockfileRaw > lockfileRaw
Definition: environment.hh:127
void lockSystem(const System &system)
Lock all descriptors for a given system. This is a helper function of flox::resolver::Environment::cr...
Definition: environment.cc:603
Upgrades upgrades
Definition: environment.hh:124
std::vector< InstallDescriptors > getUnlockedGroups(const System &system)
Get groups that need to be locked as opposed to reusing locks from oldLockfile.
Definition: environment.cc:240
std::vector< InstallDescriptors > getLockedGroups(const System &system)
Get groups with locks that can be reused from oldLockfile.
Definition: environment.cc:263
std::optional< Lockfile > oldLockfile
Definition: environment.hh:112
std::optional< RegistryRaw > lockedRegistry
Definition: environment.hh:136
A locked representation of an environment.
Definition: lockfile.hh:238
std::vector< System > getSystems() const
Get the list of systems requested by the manifest.
Definition: manifest.hh:170
std::variant< ResolutionFailure, SystemPackages > ResolutionResult
Either a set of resolved packages ( for a given system ) or a memo indicating that resolution failed ...
Definition: environment.hh:81
std::vector< std::pair< InstallID, std::string > > ResolutionFailure
A pair of install ID and locked flake URLs used to record failed resolution attempts for a given desc...
Definition: environment.hh:68
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
A lockfile representing a resolved environment.
An abstract description of an environment in its unresolved state. This representation is intended fo...
An abstract description of an environment in its unresolved state.
std::unordered_map< InstallID, ManifestDescriptor > InstallDescriptors
A map of install IDs to manifest descriptors.
Definition: manifest.hh:259
uint64_t row_id
Definition: pkg-query.hh:48
Interfaces for use by flox.
Definition: command.cc:29
@ EC_RESOLUTION_FAILURE
Definition: exceptions.hh:77
std::string System
A system pair indicating architecture and platform.
Definition: types.hh:62
Manages a nix runtime state blob with associated helpers.
Interfaces for constructing complex ‘Packages’ queries.
A set of user inputs used to set input preferences during search and resolution.
A locked package's installable URI.
Definition: lockfile.hh:125
A set of user defined requirements describing a package/dependency.
Definition: descriptor.hh:221
A set of options that apply to an entire environment.
Definition: manifest-raw.hh:73
Miscellaneous typedefs and aliases.