Skip to content

Commit 0b9c888

Browse files
layusAnton-Latukha
authored andcommitted
Add references, docs and minor improvements
default.nix: cosmetic: fx align
1 parent 46f6330 commit 0b9c888

File tree

3 files changed

+25
-23
lines changed

3 files changed

+25
-23
lines changed

default.nix

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,19 @@
111111

112112
let
113113

114-
getDefaultGHC = "ghc${
115-
(
116-
# Remove '.' from the string 8.8.4 -> 884
117-
pkgs.lib.stringAsChars (c: if c == "." then "" else c)
118-
# Get default GHC version,
119-
(pkgs.lib.getVersion pkgs.haskellPackages.ghc)
120-
)
121-
}";
122-
123-
compilerPackage =
124-
if ((compiler == "") || (compiler == "default"))
125-
then getDefaultGHC
126-
else compiler;
114+
getDefaultGHC = "ghc${
115+
(
116+
# Remove '.' from the string 8.8.4 -> 884
117+
pkgs.lib.stringAsChars (c: if c == "." then "" else c)
118+
# Get default GHC version,
119+
(pkgs.lib.getVersion pkgs.haskellPackages.ghc)
120+
)
121+
}";
122+
123+
compilerPackage =
124+
if ((compiler == "") || (compiler == "default"))
125+
then getDefaultGHC
126+
else compiler;
127127

128128
# 2020-12-31: NOTE: Remove after `hnix-store 0.4` arrives into Nixpkgs
129129
hnix-store-src = pkgs.fetchFromGitHub {
@@ -226,13 +226,14 @@ let
226226
# 2020-12-07 We really want cryptohash-sha512, but it conflicts with
227227
# recent versions of base, for seemingly no valid reason.
228228
# 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
229+
# See https://github.com/haskell-hvr/cryptohash-sha512 PRs 3, 5 and issue 4
230+
# See also https://github.com/NixOS/nixpkgs/pull/106333 for a temporary fix.
231231
cryptohash-sha512 = pkgs.haskell.lib.unmarkBroken ( pkgs.haskell.lib.doJailbreak super.cryptohash-sha512 );
232232

233233
# 2020-12-07 hnix-store-remote fails when trying to connect to a real hnix daemon.
234234
# probably due to nix sandbox restrictions.
235-
hnix-store-remote = pkgs.haskell.lib.dontCheck super.hnix-store-remote;
235+
# Upstream issue @ https://github.com/haskell-nix/hnix-store/issues/80
236+
hnix-store-remote = pkgs.haskell.lib.removeConfigureFlag super.hnix-store-remote "-fio-testsuite";
236237

237238
# 2020-08-04 hnix uses custom LayoutOptions and therefore is
238239
# likely to be affected by the change in the ribbon width

src/Nix/Effects.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,15 @@ type StorePathSet = HS.HashSet StorePath
244244

245245
class Monad m => MonadStore m where
246246

247-
-- | Add a path to the store, with bells and whistles
247+
-- | Copy the contents of a local path to the store. The resulting store
248+
-- path is returned. Note: This does not support yet support the expected
249+
-- `filter` function that allows excluding some files.
248250
addToStore :: StorePathName -> FilePath -> RecursiveFlag -> RepairFlag -> m (Either ErrorCall StorePath)
249251
default addToStore :: (MonadTrans t, MonadStore m', m ~ t m') => StorePathName -> FilePath -> RecursiveFlag -> RepairFlag -> m (Either ErrorCall StorePath)
250252
addToStore a b c d = lift $ addToStore a b c d
251253

252-
-- | Add a nar (action) to the store
253-
-- addToStore' :: StorePathName -> IO Nar -> RecursiveFlag -> RepairFlag -> m (Either ErrorCall StorePath)
254-
254+
-- | Like addToStore, but the contents written to the output path is a
255+
-- regular file containing the given string.
255256
addTextToStore' :: StorePathName -> Text -> Store.StorePathSet -> RepairFlag -> m (Either ErrorCall StorePath)
256257
default addTextToStore' :: (MonadTrans t, MonadStore m', m ~ t m') => StorePathName -> Text -> Store.StorePathSet -> RepairFlag -> m (Either ErrorCall StorePath)
257258
addTextToStore' a b c d = lift $ addTextToStore' a b c d

src/Nix/Effects/Derivation.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@ derivationParser = do
219219
let (hashType, hashMode) = case Text.splitOn ":" rht of
220220
["r", ht] -> (ht, Recursive)
221221
[ht] -> (ht, Flat)
222-
_ -> undefined -- What ?! -- TODO: Throw a proper error
222+
_ -> error $ "Unsupported hash type for output of fixed-output derivation in .drv file: " ++ show fullOutputs
223223
in case Store.mkNamedDigest hashType hash of
224224
Right digest -> (Just digest, hashMode)
225-
Left _err -> undefined -- TODO: Raise a proper parse error.
225+
Left err -> error $ "Unsupported hash " ++ show (hashType <> ":" <> hash) ++ "in .drv file: " ++ err
226226
_ -> (Nothing, Flat)
227227

228228

@@ -282,7 +282,7 @@ defaultDerivationStrict = fromValue @(AttrSet (NValue t f m)) >=> \s -> do
282282
AllOutputs ->
283283
-- TODO: recursive lookup. See prim_derivationStrict
284284
-- XXX: When is this really used ?
285-
undefined
285+
error "Not implemented: derivations depending on a .drv file are not yet supported."
286286

287287

288288
-- | Build a derivation in a context collecting string contexts.

0 commit comments

Comments
 (0)