Documentation
¶
Index ¶
- func AddDir(dir string, dependencies []string) []string
- func BuildDependencies(deps []Dependency, cache *Cache) (err error)
- func BuildEnvironment(deps []Dependency, nixpkgs string, cache *Cache, shellCache *ShellCache) (_ []string, err error)
- func DownloadURl() string
- func GenerateKey(dependency Dependency) (_ string, err error)
- func HashDependencies(deps []Dependency) (_ string, err error)
- func IsInstalled() bool
- type Cache
- type CacheOption
- type Dependency
- type ShellCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildDependencies ¶
func BuildDependencies(deps []Dependency, cache *Cache) (err error)
BuildDependencies build nix dependencies and returns a <package>-<nix store path> map
dependencies can be either a package name ex. php or a path to .nix file nixpkgs can be empty which means it will use local nixpkgs channel or a link to desired revision ex. https://github.com/NixOS/nixpkgs/archive/eeefd01d4f630fcbab6588fe3e7fffe0690fbb20.tar.gz
func BuildEnvironment ¶
func BuildEnvironment(deps []Dependency, nixpkgs string, cache *Cache, shellCache *ShellCache) (_ []string, err error)
BuildEnvironment is running nix-shell for a list of dependencies and fetch its whole environment
nix-shell --pure --keep NIX_SSL_CERT_FILE --keep SSL_CERT_FILE -p --command 'env' -E nixExpressionFromDeps
nix shell can be started with empty list of packages so this method works with empty deps as well
func GenerateKey ¶
func GenerateKey(dependency Dependency) (_ string, err error)
GenerateKey generates key for the cache for a Dependency
if it's a .nix file it will hash the nixpkgs + file contents if it's a package name will hash the packageName:nixpkgs content
func HashDependencies ¶
func HashDependencies(deps []Dependency) (_ string, err error)
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
func NewCacheStore ¶
func NewCacheStore(opts ...CacheOption) (_ *Cache, err error)
NewCacheStore initialize a Nix cache store inside dir
type CacheOption ¶
type CacheOption func(f *Cache)
func WithPath ¶
func WithPath(path string) CacheOption
WithPath adds a custom file path which is used to store cache content on the filesystem.
type Dependency ¶
type Dependency struct { // Name of the dependency Name string // Nixpkgs can be empty or a link to desired revision // ex. https://github.com/NixOS/nixpkgs/archive/eeefd01d4f630fcbab6588fe3e7fffe0690fbb20.tar.gz Nixpkgs string }
func AppendUnique ¶
func AppendUnique(a []Dependency, x Dependency) []Dependency
func UniqueDeps ¶
func UniqueDeps(s []Dependency) []Dependency
UniqueDeps removes duplicates from the list by checking against name-nixpkgs key
type ShellCache ¶
type ShellCache struct {
// contains filtered or unexported fields
}
ShellCache caches the output of nix-shell command
func NewShellCache ¶
func NewShellCache(dir string) *ShellCache
NewShellCache creates a new instance of ShellCache
func (*ShellCache) Clean ¶
func (c *ShellCache) Clean() (err error)
Clean will clean entire shell env cache
func (*ShellCache) GenerateKey ¶
func (c *ShellCache) GenerateKey(deps []Dependency, nixShellCmd string) (_ string, err error)
GenerateKey generates key for the cache based on a list of Dependency and nix-shell command
if Dependency it's a .nix file it will hash the nixpkgs + file contents if Dependency it's a package name will hash the packageName:nixpkgs content