File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1424,6 +1424,18 @@ hashStringNix nsAlgo ns =
14241424 mkHash s = hash $ encodeUtf8 s
14251425
14261426
1427+ -- | hashFileNix
1428+ -- use hashStringNix to hash file content
1429+ hashFileNix
1430+ :: forall e t f m . MonadNix e t f m => NixString -> Path -> Prim m NixString
1431+ hashFileNix nsAlgo nvfilepath = Prim $ hash =<< fileContent
1432+ where
1433+ hash = outPrim . hashStringNix nsAlgo
1434+ outPrim (Prim x) = x
1435+ fileContent :: m NixString
1436+ fileContent = mkNixStringWithoutContext <$> Nix.Render. readFile nvfilepath
1437+
1438+
14271439placeHolderNix :: forall t f m e . MonadNix e t f m => NValue t f m -> m (NValue t f m )
14281440placeHolderNix p =
14291441 do
@@ -1853,6 +1865,7 @@ builtinsList =
18531865 , add2 Normal " hasAttr" hasAttrNix
18541866 , add Normal " hasContext" hasContextNix
18551867 , add' Normal " hashString" (hashStringNix @ e @ t @ f @ m )
1868+ , add' Normal " hashFile" hashFileNix
18561869 , add Normal " head" headNix
18571870 , add2 Normal " intersectAttrs" intersectAttrsNix
18581871 , add Normal " isAttrs" isAttrsNix
Original file line number Diff line number Diff line change @@ -56,8 +56,8 @@ groupBy key = Map.fromListWith (<>) . fmap (key &&& pure)
5656-- previously passed.
5757newFailingTests :: Set String
5858newFailingTests = Set. fromList
59- [ " eval-okay-hash "
60- , " eval-okay-hashfile "
59+ [
60+ " eval-okay-hash "
6161 , " eval-okay-path" -- #128
6262 , " eval-okay-fromTOML"
6363 , " eval-okay-ind-string" -- #1000 #610
You can’t perform that action at this time.
0 commit comments