nix-paths-1.0.1: Knowledge of Nix's installation directories.

Safe HaskellSafe
LanguageHaskell2010

Nix.FindFile

Synopsis

Documentation

findFile :: FilePath -> IO (Maybe FilePath) Source #

Use nix-instantiate --find-file to resolve an abbreviated path into a full absolute path using $NIX_PATH.

>>> findFile "nixpkgs/pkgs/development/haskell-modules/configuration-hackage2nix.yaml"
Just "/home/foobar/.nix-defexpr/pkgs/development/haskell-modules/configuration-hackage2nix.yaml"
>>> findFile "nixpkgs/crazy/non-existent-path"
Nothing

findFileWithDefault :: FilePath -> FilePath -> IO FilePath Source #

A convenience wrapper around findFile that returns the given default value in case the function returns nothing.

findFileWithDefault def = fmap (fromMaybe def) . findFile