mirror of
https://github.com/haskell-nix/hnix.git
synced 2024-09-20 19:27:15 +03:00
Merge pull request #263 from gdevanla/master
add TopLevel placeHolder to builtins module
This commit is contained in:
commit
431006f524
@ -167,6 +167,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
|
||||
@ -766,6 +767,11 @@ 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 => m (NValue m) -> m (NValue m)
|
||||
placeHolder = fromValue @Text >=> \_ -> hash $ Text.pack "fdasdfas"
|
||||
where
|
||||
hash x = (toBuiltin "") . hashString (Text.pack "sha256") $ x
|
||||
|
||||
absolutePathFromValue :: MonadNix e m => NValue m -> m FilePath
|
||||
absolutePathFromValue = \case
|
||||
NVStr pathText _ -> do
|
||||
|
@ -144,6 +144,9 @@ let
|
||||
in [ (fix toFixFold) (fix toFix) ]
|
||||
|]
|
||||
|
||||
case_placeholder =
|
||||
constantEqualText "\"ed0d01fb5aba979d0beeffb3c2bdffb5cfda021955b776cce0a47058708b3157\"" "builtins.placeholder \"out\""
|
||||
|
||||
-----------------------
|
||||
|
||||
tests :: TestTree
|
||||
|
Loading…
Reference in New Issue
Block a user