Skip to content

Commit 1927b42

Browse files
committed
use & support recent hnix-store master == 0.4
M default.nix M hnix.cabal M src/Nix/Effects/Derivation.hs default.nix: fx overlay call
1 parent 801e32b commit 1927b42

File tree

3 files changed

+26
-15
lines changed

3 files changed

+26
-15
lines changed

default.nix

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
# , nixos-20.03 # Last stable release, gets almost no updates to recipes, gets only required backports
9292
# ...
9393
# }
94-
, rev ? "24eb3f87fc610f18de7076aee7c5a84ac5591e3e"
94+
, rev ? "8ba15f6383c74e981d8038fa19cc77ed0c53ba22"
9595

9696
, pkgs ?
9797
if builtins.compareVersions builtins.nixVersion "2.0" < 0
@@ -125,16 +125,16 @@ let
125125
then getDefaultGHC
126126
else compiler;
127127

128-
# 2020-05-23: NOTE: Currently HNix-store needs no overlay
129-
# hnix-store-src = pkgs.fetchFromGitHub {
130-
# owner = "haskell-nix";
131-
# repo = "hnix-store";
132-
# rev = "0.2.0.0";
133-
# sha256 = "1qf5rn43d46vgqqgmwqdkjh78rfg6bcp4kypq3z7mx46sdpzvb78";
134-
# };
128+
# 2020-12-31: NOTE: Remove after `hnix-store 0.4` arrives into Nixpkgs
129+
hnix-store-src = pkgs.fetchFromGitHub {
130+
owner = "haskell-nix";
131+
repo = "hnix-store";
132+
rev = "fd09d29b8bef4904058f033d693e7d928a4a92dc";
133+
sha256 = "0fxig1ckzknm5g19jzg7rrcpz7ssn4iiv9bs9hff9gfy3ciq4zrs";
134+
};
135135

136136
overlay = pkgs.lib.foldr pkgs.lib.composeExtensions (_: _: {}) [
137-
# (import "${hnix-store-src}/overlay.nix")
137+
(import "${hnix-store-src}/overlay.nix" pkgs pkgs.haskell.lib)
138138
(self: super:
139139
pkgs.lib.optionalAttrs withHoogle {
140140
ghc = super.ghc // { withPackages = super.ghc.withHoogle; };
@@ -223,6 +223,17 @@ let
223223
root = packageRoot;
224224

225225
overrides = self: super: {
226+
# 2020-12-07 We really want cryptohash-sha512, but it conflicts with
227+
# recent versions of base, for seemingly no valid reason.
228+
# As the update is slow to happen, just jailbreak here
229+
# See https://github.com/haskell-hvr/cryptohash-sha512/pull/3
230+
# and https://github.com/haskell-hvr/cryptohash-sha512/pull/5
231+
cryptohash-sha512 = pkgs.haskell.lib.unmarkBroken ( pkgs.haskell.lib.doJailbreak super.cryptohash-sha512 );
232+
233+
# 2020-12-07 hnix-store-remote fails when trying to connect to a real hnix daemon.
234+
# probably due to nix sandbox restrictions.
235+
hnix-store-remote = pkgs.haskell.lib.dontCheck super.hnix-store-remote;
236+
226237
# 2020-08-04 hnix uses custom LayoutOptions and therefore is
227238
# likely to be affected by the change in the ribbon width
228239
# calculation in prettyprinter-1.7.0.

hnix.cabal

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,8 @@ library
402402
, gitrev >= 1.1.0 && < 1.4
403403
, hashable >= 1.2.5 && < 1.4
404404
, hashing >= 0.1.0 && < 0.2
405-
, hnix-store-core >= 0.3.0 && < 0.4
406-
, hnix-store-remote >= 0.2.0 && < 0.3
405+
, hnix-store-core >= 0.4.0 && < 0.5
406+
, hnix-store-remote >= 0.4.0 && < 0.5
407407
, http-client >= 0.5.14 && < 0.6 || >= 0.6.4 && < 0.7
408408
, http-client-tls >= 0.3.5 && < 0.4
409409
, http-types >= 0.12.2 && < 0.13

src/Nix/Effects/Derivation.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ hashDerivationModulo (Derivation {
112112
$ "fixed:out"
113113
<> (if hashMode == Recursive then ":r" else "")
114114
<> ":" <> (Store.algoName @hashType)
115-
<> ":" <> (Store.encodeBase16 digest)
115+
<> ":" <> (Store.encodeInBase Store.Base16 digest)
116116
<> ":" <> path
117117
outputsList -> throwError $ ErrorCall $ "This is weird. A fixed output drv should only have one output named 'out'. Got " ++ show outputsList
118118
hashDerivationModulo drv@(Derivation {inputs = (inputSrcs, inputDrvs)}) = do
@@ -122,7 +122,7 @@ hashDerivationModulo drv@(Derivation {inputs = (inputSrcs, inputDrvs)}) = do
122122
Just hash -> return (hash, outs)
123123
Nothing -> do
124124
drv' <- readDerivation $ Text.unpack path
125-
hash <- Store.encodeBase16 <$> hashDerivationModulo drv'
125+
hash <- Store.encodeInBase Store.Base16 <$> hashDerivationModulo drv'
126126
return (hash, outs)
127127
)
128128
return $ Store.hash @'Store.SHA256 $ Text.encodeUtf8 $ unparseDrv (drv {inputs = (inputSrcs, inputsModulo)})
@@ -135,7 +135,7 @@ unparseDrv (Derivation {..}) = Text.append "Derive" $ parens
135135
case mFixed of
136136
Nothing -> parens [s outputName, s outputPath, s "", s ""]
137137
Just (Store.SomeDigest (digest :: Store.Digest hashType)) ->
138-
parens [s outputName, s outputPath, s $ prefix <> Store.algoName @hashType, s $ Store.encodeBase16 digest]
138+
parens [s outputName, s outputPath, s $ prefix <> Store.algoName @hashType, s $ Store.encodeInBase Store.Base16 digest]
139139
)
140140
, -- inputDrvs
141141
list $ flip map (Map.toList $ snd inputs) (\(path, outs) ->
@@ -257,7 +257,7 @@ defaultDerivationStrict = fromValue @(AttrSet (NValue t f m)) >=> \s -> do
257257
drvPath <- pathToText <$> writeDerivation drv'
258258

259259
-- Memoize here, as it may be our last chance in case of readonly stores.
260-
drvHash <- Store.encodeBase16 <$> hashDerivationModulo drv'
260+
drvHash <- Store.encodeInBase Store.Base16 <$> hashDerivationModulo drv'
261261
modify (\(a, b) -> (a, MS.insert drvPath drvHash b))
262262

263263
let outputsWithContext = Map.mapWithKey (\out path -> principledMakeNixStringWithSingletonContext path (StringContext drvPath (DerivationOutput out))) (outputs drv')

0 commit comments

Comments
 (0)