distribution-nixpkgs-1.7.0: Types and functions to manipulate the Nixpkgs distribution
Safe HaskellNone
LanguageHaskell2010

Distribution.Nixpkgs.PackageMap

Description

Build a lookup table from package identifiers to full attribute paths in nixpkgs.

Synopsis

Documentation

readNixpkgPackageMap Source #

Arguments

:: String

Path to nixpkgs, must be a valid nix path (absolute, relative or NIX_PATH lookup)

-> Maybe String

(Optional) argument attribute set to pass to nixpkgs. Must be a valid nix attribute set.

-> IO PackageMap 

Evaluate nixpkgs at a given (nix) path and build a Map keeping track of all Paths that end in a given Identifier and evaluate to a derivation. This can be used to find an attribute Path for an arbitrary package name using resolve.

Note: Evaluation of nixpkgs is very expensive (takes multiple seconds), so cache the result of this function if possible.

>>> readNixpkgPackageMap "<nixpkgs>" (Just "{ config = { allowAliases = false; }; }")
fromList [ … ]

resolve :: PackageMap -> Identifier -> Maybe Binding Source #

Finds the shortest Path in a PackageMap that has the given Identifier as its last component.

>>> resolve nixpkgs (ident # "pam")
Just (Bind (Identifier "pam") (Path [Identifier "pam"]))