add builtins.placeHolder to builtins

This commit is contained in:
Guru Devanla 2018-04-28 15:35:01 -07:00
parent 6946e713c0
commit 8ba302265b

View file

@ -163,6 +163,7 @@ builtinsList = sequence [
, add Normal "parseDrvName" parseDrvName
, add2 Normal "partition" partition_
, add Normal "pathExists" pathExists_
, add' TopLevel "placeHolder" placeHolder
, add Normal "readDir" readDir_
, add Normal "readFile" readFile_
, add2 TopLevel "removeAttrs" removeAttrs
@ -187,7 +188,6 @@ builtinsList = sequence [
, add Normal "typeOf" typeOf
, add Normal "unsafeDiscardStringContext" unsafeDiscardStringContext
, add2 Normal "unsafeGetAttrPos" unsafeGetAttrPos
]
where
wrap t n f = Builtin t (n, f)
@ -682,6 +682,9 @@ hashString algo s = Prim $ do
++ "expected \"md5\", \"sha1\", \"sha256\", or \"sha512\", got " ++ show algo
pure $ decodeUtf8 $ Base16.encode $ hash $ encodeUtf8 s
placeHolder:: MonadNix e m => Text -> Prim m Text
placeHolder output = hashString "sha256" output
absolutePathFromValue :: MonadNix e m => NValue m -> m FilePath
absolutePathFromValue = \case
NVStr pathText _ -> do