Skip to content

Commit

Permalink
Add references, docs and minor improvements
Browse files Browse the repository at this point in the history
default.nix: cosmetic: fx align
  • Loading branch information
layus authored and Anton-Latukha committed Dec 31, 2020
1 parent 46f6330 commit 0b9c888
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
33 changes: 17 additions & 16 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,19 @@

let

getDefaultGHC = "ghc${
(
# Remove '.' from the string 8.8.4 -> 884
pkgs.lib.stringAsChars (c: if c == "." then "" else c)
# Get default GHC version,
(pkgs.lib.getVersion pkgs.haskellPackages.ghc)
)
}";

compilerPackage =
if ((compiler == "") || (compiler == "default"))
then getDefaultGHC
else compiler;
getDefaultGHC = "ghc${
(
# Remove '.' from the string 8.8.4 -> 884
pkgs.lib.stringAsChars (c: if c == "." then "" else c)
# Get default GHC version,
(pkgs.lib.getVersion pkgs.haskellPackages.ghc)
)
}";

compilerPackage =
if ((compiler == "") || (compiler == "default"))
then getDefaultGHC
else compiler;

# 2020-12-31: NOTE: Remove after `hnix-store 0.4` arrives into Nixpkgs
hnix-store-src = pkgs.fetchFromGitHub {
Expand Down Expand Up @@ -226,13 +226,14 @@ let
# 2020-12-07 We really want cryptohash-sha512, but it conflicts with
# recent versions of base, for seemingly no valid reason.
# As the update is slow to happen, just jailbreak here
# See https://github.com/haskell-hvr/cryptohash-sha512/pull/3
# and https://github.com/haskell-hvr/cryptohash-sha512/pull/5
# See https://github.com/haskell-hvr/cryptohash-sha512 PRs 3, 5 and issue 4
# See also https://github.com/NixOS/nixpkgs/pull/106333 for a temporary fix.
cryptohash-sha512 = pkgs.haskell.lib.unmarkBroken ( pkgs.haskell.lib.doJailbreak super.cryptohash-sha512 );

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

# 2020-08-04 hnix uses custom LayoutOptions and therefore is
# likely to be affected by the change in the ribbon width
Expand Down
9 changes: 5 additions & 4 deletions src/Nix/Effects.hs
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,15 @@ type StorePathSet = HS.HashSet StorePath

class Monad m => MonadStore m where

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

-- | Add a nar (action) to the store
-- addToStore' :: StorePathName -> IO Nar -> RecursiveFlag -> RepairFlag -> m (Either ErrorCall StorePath)

-- | Like addToStore, but the contents written to the output path is a
-- regular file containing the given string.
addTextToStore' :: StorePathName -> Text -> Store.StorePathSet -> RepairFlag -> m (Either ErrorCall StorePath)
default addTextToStore' :: (MonadTrans t, MonadStore m', m ~ t m') => StorePathName -> Text -> Store.StorePathSet -> RepairFlag -> m (Either ErrorCall StorePath)
addTextToStore' a b c d = lift $ addTextToStore' a b c d
Expand Down
6 changes: 3 additions & 3 deletions src/Nix/Effects/Derivation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ derivationParser = do
let (hashType, hashMode) = case Text.splitOn ":" rht of
["r", ht] -> (ht, Recursive)
[ht] -> (ht, Flat)
_ -> undefined -- What ?! -- TODO: Throw a proper error
_ -> error $ "Unsupported hash type for output of fixed-output derivation in .drv file: " ++ show fullOutputs
in case Store.mkNamedDigest hashType hash of
Right digest -> (Just digest, hashMode)
Left _err -> undefined -- TODO: Raise a proper parse error.
Left err -> error $ "Unsupported hash " ++ show (hashType <> ":" <> hash) ++ "in .drv file: " ++ err
_ -> (Nothing, Flat)


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


-- | Build a derivation in a context collecting string contexts.
Expand Down

0 comments on commit 0b9c888

Please sign in to comment.