File tree Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Expand file tree Collapse file tree 2 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -442,7 +442,7 @@ library
442442 exposed-modules :
443443 Nix.Options.Parser
444444 build-depends :
445- base16-bytestring >= 0.1.1 && < 0.2
445+ base16-bytestring >= 0.1.1 && < 1.1
446446 , pretty-show >= 1.9.5 && < 1.11
447447 , serialise >= 0.2.1 && < 0.3
448448 -- if !flag(profiling)
Original file line number Diff line number Diff line change @@ -1198,6 +1198,7 @@ listToAttrs = fromValue @[NValue t f m] >=> \l ->
11981198-- prim_hashString from nix/src/libexpr/primops.cc
11991199-- fail if context in the algo arg
12001200-- propagate context from the s arg
1201+ -- | The result coming out of hashString is base16 encoded
12011202hashString
12021203 :: forall e t f m . MonadNix e t f m => NixString -> NixString -> Prim m NixString
12031204hashString nsAlgo ns = Prim $ do
@@ -1233,10 +1234,16 @@ placeHolder = fromValue >=> fromStringNoContext >=> \t -> do
12331234 $ principledMakeNixStringWithoutContext
12341235 $ Text. cons ' /'
12351236 $ Base32. encode
1236- $ fst -- The result coming out of hashString is base16 encoded
1237- $ Base16. decode
1238- $ encodeUtf8
1239- $ principledStringIgnoreContext h
1237+ $ case Base16. decode (text h) of -- The result coming out of hashString is base16 encoded
1238+ #if MIN_VERSION_base16_bytestring(1,0,0)
1239+ Right d -> d
1240+ Left e -> error $ " Couldn't Base16 decode the text: '" <> show (text h) <> " '.\n The Left error content: '" <> e <> " '."
1241+ #else
1242+ (d, " " ) -> d
1243+ (_, e) -> error $ " Couldn't Base16 decode the text: '" <> show (text h) <> " '.\n Undecodable remainder: '" <> show e <> " '."
1244+ #endif
1245+ where
1246+ text h = encodeUtf8 $ principledStringIgnoreContext h
12401247
12411248absolutePathFromValue :: MonadNix e t f m => NValue t f m -> m FilePath
12421249absolutePathFromValue = \ case
You can’t perform that action at this time.
0 commit comments