Flox Package Database 1
CRUD Operations on Nix Package Metadata
Loading...
Searching...
No Matches
Public Member Functions | List of all members
flox::Package Class Referenceabstract

Abstract representation of a "package", analogous to a Nix ‘derivation’. More...

#include <package.hh>

Inheritance diagram for flox::Package:
flox::FlakePackage flox::RawPackage flox::pkgdb::DbPackage

Public Member Functions

 Package (const Package &)=default
 
 Package (Package &&)=default
 
Packageoperator= (const Package &)=default
 
Packageoperator= (Package &&)=default
 
virtual AttrPath getPathStrs () const =0
 
virtual std::string getFullName () const =0
 
virtual std::string getPname () const =0
 
virtual std::optional< std::string > getVersion () const =0
 
virtual std::optional< std::string > getLicense () const =0
 
virtual std::vector< std::string > getOutputs () const =0
 
virtual std::vector< std::string > getOutputsToInstall () const =0
 
virtual std::optional< bool > isBroken () const =0
 
virtual std::optional< bool > isUnfree () const =0
 
virtual std::optional< std::string > getDescription () const =0
 
virtual Subtree getSubtreeType () const
 
virtual nix::DrvName getParsedDrvName () const
 
virtual std::optional< std::string > getSemver () const
 
virtual std::string toURIString (const nix::FlakeRef &ref) const
 Create an installable URI string associated with this package using ref as its input part.
 
virtual nlohmann::json getInfo (bool withDescription=false) const
 Serialize notable package metadata as a JSON object.
 

Detailed Description

Abstract representation of a "package", analogous to a Nix ‘derivation’.

This abstraction provides a common base for various backends that store, evaluate, and communicate package definitions.

Member Function Documentation

◆ getDescription()

virtual std::optional< std::string > flox::Package::getDescription ( ) const
pure virtual
Returns
The meta.description field if defined, otherwise std::nullopt.

Implemented in flox::FlakePackage, and flox::RawPackage.

◆ getFullName()

virtual std::string flox::Package::getFullName ( ) const
pure virtual
Returns
the derivation name field.

Implemented in flox::FlakePackage, and flox::RawPackage.

◆ getInfo()

nlohmann::json flox::Package::getInfo ( bool  withDescription = false) const
virtual

Serialize notable package metadata as a JSON object.

This may only contains a subset of all available information.

Parameters
withDescriptionWhether to include description strings.
Returns
A JSON object with notable package metadata.

◆ getLicense()

virtual std::optional< std::string > flox::Package::getLicense ( ) const
pure virtual
Returns
The meta.license.spdxId field if defined, otherwise std::nullopt

Implemented in flox::FlakePackage, and flox::RawPackage.

◆ getOutputs()

virtual std::vector< std::string > flox::Package::getOutputs ( ) const
pure virtual
Returns
The derivation outputs list.

Implemented in flox::FlakePackage, and flox::RawPackage.

◆ getOutputsToInstall()

virtual std::vector< std::string > flox::Package::getOutputsToInstall ( ) const
pure virtual
Returns
The meta.outputsToInstall field if defined, otherwise the derivation outputs members to the left of and including out.

Implemented in flox::FlakePackage, and flox::RawPackage.

◆ getParsedDrvName()

virtual nix::DrvName flox::Package::getParsedDrvName ( ) const
inlinevirtual
Returns
The parsed "package name" prefix of this package's name field.

Reimplemented in flox::FlakePackage.

◆ getPathStrs()

virtual AttrPath flox::Package::getPathStrs ( ) const
pure virtual
Returns
attribute path where package is defined

Implemented in flox::FlakePackage, and flox::RawPackage.

◆ getPname()

virtual std::string flox::Package::getPname ( ) const
pure virtual
Returns
iff the field pname is defined then pname, otherwise the name field stripped of is version part as recognized by nix::DrvName parsing rules.

Implemented in flox::FlakePackage, and flox::RawPackage.

◆ getSemver()

virtual std::optional< std::string > flox::Package::getSemver ( ) const
inlinevirtual
Returns
std::nullopt iff this package does not use semantic versioning, otherwise a normalized semantic version number coerces from this package's version information.

Reimplemented in flox::FlakePackage, and flox::RawPackage.

◆ getSubtreeType()

virtual Subtree flox::Package::getSubtreeType ( ) const
inlinevirtual
Returns
The flake outputs subtree the package resides in, being one of legacyPackages or packages.

Reimplemented in flox::FlakePackage.

◆ getVersion()

virtual std::optional< std::string > flox::Package::getVersion ( ) const
pure virtual
Returns
iff the field version is defined then version, otherwise the name field stripped of is pname part as recognized by nix::DrvName parsing rules. If version is undefined and name contains no version suffix, then std::nullopt.

Implemented in flox::FlakePackage, and flox::RawPackage.

◆ isBroken()

virtual std::optional< bool > flox::Package::isBroken ( ) const
pure virtual
Returns
The meta.broken field if defined, otherwise std::nullopt.

Implemented in flox::FlakePackage, and flox::RawPackage.

◆ isUnfree()

virtual std::optional< bool > flox::Package::isUnfree ( ) const
pure virtual
Returns
The meta.unfree field if defined, otherwise std::nullopt.

Implemented in flox::FlakePackage, and flox::RawPackage.

◆ toURIString()

std::string flox::Package::toURIString ( const nix::FlakeRef &  ref) const
virtual

Create an installable URI string associated with this package using ref as its input part.

Parameters
refInput flake reference associated with this package. This is used to construct the URI on the left side of #.
Returns
An installable URI string associated with this package using.

The documentation for this class was generated from the following files: