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

A flox::Package implementation which are pulled from evaluation of a nix flake. More...

#include <flake-package.hh>

Inheritance diagram for flox::FlakePackage:
flox::Package

Public Member Functions

 FlakePackage (Cursor cursor, const AttrPath &path, bool checkDrv=true)
 
 FlakePackage (Cursor cursor, nix::SymbolTable *symtab, bool checkDrv=true)
 
std::vector< std::string > getOutputsToInstall () const override
 
std::optional< bool > isBroken () const override
 
std::optional< bool > isUnfree () const override
 
AttrPath getPathStrs () const override
 
std::string getFullName () const override
 
std::string getPname () const override
 
Cursor getCursor () const
 
Subtree getSubtreeType () const override
 
nix::DrvName getParsedDrvName () const override
 
std::optional< std::string > getVersion () const override
 
std::optional< std::string > getSemver () const override
 
std::optional< std::string > getLicense () const override
 
std::vector< std::string > getOutputs () const override
 
std::optional< std::string > getDescription () const override
 
- Public Member Functions inherited from flox::Package
 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.
 

Private Member Functions

void init (bool checkDrv=true)
 

Private Attributes

Cursor _cursor
 
AttrPath _pathS
 
bool _hasMetaAttr = false
 
bool _hasPnameAttr = false
 
bool _hasVersionAttr = false
 
std::string _fullName
 
std::string _pname
 
std::string _version
 
std::optional< std::string > _semver
 
System _system
 
Subtree _subtree
 
std::optional< std::string > _license
 

Friends

class pkgdb::PkgDb
 

Detailed Description

A flox::Package implementation which are pulled from evaluation of a nix flake.

Member Function Documentation

◆ getDescription()

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

Implements flox::Package.

◆ getFullName()

std::string flox::FlakePackage::getFullName ( ) const
inlineoverridevirtual
Returns
the derivation name field.

Implements flox::Package.

◆ getLicense()

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

Implements flox::Package.

◆ getOutputs()

std::vector< std::string > flox::FlakePackage::getOutputs ( ) const
inlineoverridevirtual
Returns
The derivation outputs list.

Implements flox::Package.

◆ getOutputsToInstall()

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

Implements flox::Package.

◆ getParsedDrvName()

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

Reimplemented from flox::Package.

◆ getPathStrs()

AttrPath flox::FlakePackage::getPathStrs ( ) const
inlineoverridevirtual
Returns
attribute path where package is defined

Implements flox::Package.

◆ getPname()

std::string flox::FlakePackage::getPname ( ) const
inlineoverridevirtual
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.

Implements flox::Package.

◆ getSemver()

std::optional< std::string > flox::FlakePackage::getSemver ( ) const
inlineoverridevirtual
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 from flox::Package.

◆ getSubtreeType()

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

Reimplemented from flox::Package.

◆ getVersion()

std::optional< std::string > flox::FlakePackage::getVersion ( ) const
inlineoverridevirtual
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.

Implements flox::Package.

◆ isBroken()

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

Implements flox::Package.

◆ isUnfree()

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

Implements flox::Package.


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