parent
ad18b950ac
commit
b24598b3a3
10
default.nix
10
default.nix
|
@ -22,6 +22,16 @@ let inherit (nixpkgs) pkgs;
|
|||
then doJailbreak super.compact
|
||||
else super.compact;
|
||||
serialise = dontCheck super.serialise;
|
||||
ghc-datasize =
|
||||
pkgs.haskell.lib.overrideCabal super.ghc-datasize (attrs: {
|
||||
enableLibraryProfiling = false;
|
||||
enableExecutableProfiling = false;
|
||||
});
|
||||
ghc-heap-view =
|
||||
pkgs.haskell.lib.overrideCabal super.ghc-heap-view (attrs: {
|
||||
enableLibraryProfiling = false;
|
||||
enableExecutableProfiling = false;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
--
|
||||
-- see: https://github.com/sol/hpack
|
||||
--
|
||||
-- hash: 760d308ea1a1df341e0191fee145518d3901d2eef3e8c4ee7c1f43a3de3acaad
|
||||
-- hash: 0ae6db7ef792f86593ae6684bf7ab48b8e79cc147213ef6ab88475c142f9507a
|
||||
|
||||
name: hnix
|
||||
version: 0.5.0
|
||||
|
@ -94,6 +94,7 @@ library
|
|||
, directory
|
||||
, exceptions
|
||||
, filepath
|
||||
, ghc-datasize
|
||||
, hashable
|
||||
, haskeline
|
||||
, megaparsec
|
||||
|
|
|
@ -68,6 +68,7 @@ library:
|
|||
- cryptohash
|
||||
- deriving-compat >= 0.3 && < 0.5
|
||||
- directory
|
||||
- ghc-datasize
|
||||
- hashable
|
||||
- haskeline
|
||||
- megaparsec
|
||||
|
|
|
@ -191,7 +191,7 @@ builtinsList = sequence [
|
|||
, add Normal "typeOf" typeOf
|
||||
, add Normal "unsafeDiscardStringContext" unsafeDiscardStringContext
|
||||
, add2 Normal "unsafeGetAttrPos" unsafeGetAttrPos
|
||||
|
||||
, add TopLevel "__valueSize" getRecursiveSize
|
||||
]
|
||||
where
|
||||
wrap t n f = Builtin t (n, f)
|
||||
|
|
|
@ -30,3 +30,5 @@ class MonadFile m => MonadEffects m where
|
|||
derivationStrict :: NValue m -> m (NValue m)
|
||||
|
||||
nixInstantiateExpr :: String -> m (NValue m)
|
||||
|
||||
getRecursiveSize :: a -> m (NValue m)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{-# LANGUAGE AllowAmbiguousTypes #-}
|
||||
{-# LANGUAGE ApplicativeDo #-}
|
||||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE ConstraintKinds #-}
|
||||
{-# LANGUAGE DeriveFunctor #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
|
@ -73,6 +74,10 @@ import System.Process (readProcessWithExitCode)
|
|||
import Text.PrettyPrint.ANSI.Leijen (text)
|
||||
import qualified Text.PrettyPrint.ANSI.Leijen as P
|
||||
|
||||
#if MIN_VERSION_ghc_datasize(0,2,0)
|
||||
import GHC.DataSize
|
||||
#endif
|
||||
|
||||
type MonadNix e m =
|
||||
(Scoped e (NThunk m) m, Framed e m, Has e SrcSpan, Has e Options,
|
||||
Typeable m, MonadVar m, MonadEffects m, MonadFix m, MonadCatch m,
|
||||
|
@ -552,6 +557,13 @@ instance (MonadFix m, MonadCatch m, MonadThrow m, MonadIO m,
|
|||
Success v -> evalExprLoc v
|
||||
err -> throwError $ "nix-instantiate failed: " ++ show err
|
||||
|
||||
getRecursiveSize =
|
||||
#if MIN_VERSION_ghc_datasize(0,2,0)
|
||||
toNix @Integer <=< fmap fromIntegral . liftIO . recursiveSize
|
||||
#else
|
||||
toNix (0 :: Integer)
|
||||
#endif
|
||||
|
||||
runLazyM :: Options -> MonadIO m => Lazy m a -> m a
|
||||
runLazyM opts = (`evalStateT` M.empty)
|
||||
. (`runReaderT` newContext opts)
|
||||
|
|
Loading…
Reference in a new issue