Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::RestrictionContext Struct Referenceabstract

#include <restricted-store.hh>

Inheritance diagram for nix::RestrictionContext:
nix::DerivationBuilder nix::DerivationBuilderImpl nix::UnixDerivationBuilderImpl nix::ChrootDerivationBuilder nix::DarwinDerivationBuilder nix::FreeBSDDerivationBuilder nix::LinuxDerivationBuilder nix::ChrootFreeBSDDerivationBuilder nix::ChrootLinuxDerivationBuilder nix::ChrootFreeBSDDerivationBuilder nix::ChrootLinuxDerivationBuilder

Classes

struct  State

Public Member Functions

virtual const StorePathSet & originalPaths ()=0
virtual bool isAllowed (const StorePath &)=0
virtual bool isAllowed (const DrvOutput &id)=0
bool isAllowed (const DerivedPath &id)
virtual bool shouldModifySandbox ()=0
virtual void submitOutput (const SingleDerivedPath &path, const OutputName &output)=0
void addDependency (const StorePath &path)

Public Attributes

Sync< State > state_

Protected Member Functions

virtual void addDependencyImpl (const StorePath &path)=0

Detailed Description

A restricted store has a pointer to one of these, which manages the restrictions that are in place.

This is a separate data type so the whitelists can be mutated before the restricted store is created: put differently, someones we don't know whether we will in fact create a restricted store, but we need to prepare the whitelists just in case.

It is possible there are other ways to solve this problem. This was just the easiest place to begin, when this was extracted from LocalDerivationGoal.

Member Function Documentation

◆ addDependency()

void nix::RestrictionContext::addDependency ( const StorePath & path)
inline

Add 'path' to the set of paths that may be referenced by the outputs, and make it appear in the sandbox.

◆ addDependencyImpl()

virtual void nix::RestrictionContext::addDependencyImpl ( const StorePath & path)
protectedpure virtual

This is the underlying implementation to be defined. The caller will ensure that this is only called on newly added dependencies, and that idempotent calls are a no-op.

Implemented in nix::ChrootFreeBSDDerivationBuilder, nix::ChrootLinuxDerivationBuilder, and nix::UnixDerivationBuilderImpl.

◆ isAllowed()

virtual bool nix::RestrictionContext::isAllowed ( const StorePath & )
pure virtual

Recursive Nix calls are only allowed to build or realize paths in the original input closure or added via a recursive Nix call (so e.g. you can't do nix-store -r /nix/store/<bla> where /nix/store/<bla> is some arbitrary path in a binary cache).

Implemented in nix::UnixDerivationBuilderImpl.

◆ originalPaths()

virtual const StorePathSet & nix::RestrictionContext::originalPaths ( )
pure virtual

Paths that are already allowed to begin with

Implemented in nix::UnixDerivationBuilderImpl.

◆ shouldModifySandbox()

virtual bool nix::RestrictionContext::shouldModifySandbox ( )
pure virtual

Whether mounting dependencies inside the sandbox should happen, or if it should be entirely skipped.

Implemented in nix::UnixDerivationBuilderImpl.

◆ submitOutput()

virtual void nix::RestrictionContext::submitOutput ( const SingleDerivedPath & path,
const OutputName & output )
pure virtual

Register a store path to an output name For builder-rpc-v0

Implemented in nix::UnixDerivationBuilderImpl.


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