Safe Haskell | None |
---|---|
Language | Haskell2010 |
Build a lookup table from package identifiers to full attribute paths in nixpkgs.
Synopsis
- type PackageMap = Map Identifier (Set Path)
- readNixpkgPackageMap :: String -> Maybe String -> IO PackageMap
- resolve :: PackageMap -> Identifier -> Maybe Binding
Documentation
type PackageMap = Map Identifier (Set Path) Source #
:: String | Path to nixpkgs, must be a valid nix path
(absolute, relative or |
-> 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 Path
s 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"]))