mirror of
https://github.com/haskell-nix/hnix.git
synced 2024-09-11 06:55:38 +03:00
add builtins.hashfile
This commit is contained in:
parent
4f94e33de0
commit
8e64e98fd8
@ -1424,6 +1424,18 @@ hashStringNix nsAlgo ns =
|
||||
mkHash s = hash $ encodeUtf8 s
|
||||
|
||||
|
||||
-- | hashFileNix
|
||||
-- use hashStringNix to hash file content
|
||||
hashFileNix
|
||||
:: forall e t f m . MonadNix e t f m => NixString -> Path -> Prim m NixString
|
||||
hashFileNix nsAlgo nvfilepath = Prim $ hash =<< fileContent
|
||||
where
|
||||
hash = outPrim . hashStringNix nsAlgo
|
||||
outPrim (Prim x) = x
|
||||
fileContent :: m NixString
|
||||
fileContent = mkNixStringWithoutContext <$> Nix.Render.readFile nvfilepath
|
||||
|
||||
|
||||
placeHolderNix :: forall t f m e . MonadNix e t f m => NValue t f m -> m (NValue t f m)
|
||||
placeHolderNix p =
|
||||
do
|
||||
@ -1853,6 +1865,7 @@ builtinsList =
|
||||
, add2 Normal "hasAttr" hasAttrNix
|
||||
, add Normal "hasContext" hasContextNix
|
||||
, add' Normal "hashString" (hashStringNix @e @t @f @m)
|
||||
, add' Normal "hashFile" hashFileNix
|
||||
, add Normal "head" headNix
|
||||
, add2 Normal "intersectAttrs" intersectAttrsNix
|
||||
, add Normal "isAttrs" isAttrsNix
|
||||
|
@ -56,8 +56,8 @@ groupBy key = Map.fromListWith (<>) . fmap (key &&& pure)
|
||||
-- previously passed.
|
||||
newFailingTests :: Set String
|
||||
newFailingTests = Set.fromList
|
||||
[ "eval-okay-hash"
|
||||
, "eval-okay-hashfile"
|
||||
[
|
||||
"eval-okay-hash"
|
||||
, "eval-okay-path" -- #128
|
||||
, "eval-okay-fromTOML"
|
||||
, "eval-okay-ind-string" -- #1000 #610
|
||||
|
Loading…
Reference in New Issue
Block a user