module System.Nix.Build
( BuildMode(..)
, BuildStatus(..)
, buildSuccess
, BuildResult(..)
) where
import Data.Map (Map)
import Data.Time (UTCTime)
import Data.Text (Text)
import GHC.Generics (Generic)
import System.Nix.OutputName (OutputName)
import System.Nix.Realisation (DerivationOutput, Realisation)
data BuildMode
= BuildMode_Normal
| BuildMode_Repair
| BuildMode_Check
deriving (BuildMode
BuildMode -> BuildMode -> Bounded BuildMode
forall a. a -> a -> Bounded a
$cminBound :: BuildMode
minBound :: BuildMode
$cmaxBound :: BuildMode
maxBound :: BuildMode
Bounded, BuildMode -> BuildMode -> Bool
(BuildMode -> BuildMode -> Bool)
-> (BuildMode -> BuildMode -> Bool) -> Eq BuildMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BuildMode -> BuildMode -> Bool
== :: BuildMode -> BuildMode -> Bool
$c/= :: BuildMode -> BuildMode -> Bool
/= :: BuildMode -> BuildMode -> Bool
Eq, (forall x. BuildMode -> Rep BuildMode x)
-> (forall x. Rep BuildMode x -> BuildMode) -> Generic BuildMode
forall x. Rep BuildMode x -> BuildMode
forall x. BuildMode -> Rep BuildMode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BuildMode -> Rep BuildMode x
from :: forall x. BuildMode -> Rep BuildMode x
$cto :: forall x. Rep BuildMode x -> BuildMode
to :: forall x. Rep BuildMode x -> BuildMode
Generic, Eq BuildMode
Eq BuildMode =>
(BuildMode -> BuildMode -> Ordering)
-> (BuildMode -> BuildMode -> Bool)
-> (BuildMode -> BuildMode -> Bool)
-> (BuildMode -> BuildMode -> Bool)
-> (BuildMode -> BuildMode -> Bool)
-> (BuildMode -> BuildMode -> BuildMode)
-> (BuildMode -> BuildMode -> BuildMode)
-> Ord BuildMode
BuildMode -> BuildMode -> Bool
BuildMode -> BuildMode -> Ordering
BuildMode -> BuildMode -> BuildMode
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: BuildMode -> BuildMode -> Ordering
compare :: BuildMode -> BuildMode -> Ordering
$c< :: BuildMode -> BuildMode -> Bool
< :: BuildMode -> BuildMode -> Bool
$c<= :: BuildMode -> BuildMode -> Bool
<= :: BuildMode -> BuildMode -> Bool
$c> :: BuildMode -> BuildMode -> Bool
> :: BuildMode -> BuildMode -> Bool
$c>= :: BuildMode -> BuildMode -> Bool
>= :: BuildMode -> BuildMode -> Bool
$cmax :: BuildMode -> BuildMode -> BuildMode
max :: BuildMode -> BuildMode -> BuildMode
$cmin :: BuildMode -> BuildMode -> BuildMode
min :: BuildMode -> BuildMode -> BuildMode
Ord, Int -> BuildMode
BuildMode -> Int
BuildMode -> [BuildMode]
BuildMode -> BuildMode
BuildMode -> BuildMode -> [BuildMode]
BuildMode -> BuildMode -> BuildMode -> [BuildMode]
(BuildMode -> BuildMode)
-> (BuildMode -> BuildMode)
-> (Int -> BuildMode)
-> (BuildMode -> Int)
-> (BuildMode -> [BuildMode])
-> (BuildMode -> BuildMode -> [BuildMode])
-> (BuildMode -> BuildMode -> [BuildMode])
-> (BuildMode -> BuildMode -> BuildMode -> [BuildMode])
-> Enum BuildMode
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: BuildMode -> BuildMode
succ :: BuildMode -> BuildMode
$cpred :: BuildMode -> BuildMode
pred :: BuildMode -> BuildMode
$ctoEnum :: Int -> BuildMode
toEnum :: Int -> BuildMode
$cfromEnum :: BuildMode -> Int
fromEnum :: BuildMode -> Int
$cenumFrom :: BuildMode -> [BuildMode]
enumFrom :: BuildMode -> [BuildMode]
$cenumFromThen :: BuildMode -> BuildMode -> [BuildMode]
enumFromThen :: BuildMode -> BuildMode -> [BuildMode]
$cenumFromTo :: BuildMode -> BuildMode -> [BuildMode]
enumFromTo :: BuildMode -> BuildMode -> [BuildMode]
$cenumFromThenTo :: BuildMode -> BuildMode -> BuildMode -> [BuildMode]
enumFromThenTo :: BuildMode -> BuildMode -> BuildMode -> [BuildMode]
Enum, Int -> BuildMode -> ShowS
[BuildMode] -> ShowS
BuildMode -> String
(Int -> BuildMode -> ShowS)
-> (BuildMode -> String)
-> ([BuildMode] -> ShowS)
-> Show BuildMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BuildMode -> ShowS
showsPrec :: Int -> BuildMode -> ShowS
$cshow :: BuildMode -> String
show :: BuildMode -> String
$cshowList :: [BuildMode] -> ShowS
showList :: [BuildMode] -> ShowS
Show)
data BuildStatus =
BuildStatus_Built
| BuildStatus_Substituted
| BuildStatus_AlreadyValid
| BuildStatus_PermanentFailure
| BuildStatus_InputRejected
| BuildStatus_OutputRejected
| BuildStatus_TransientFailure
| BuildStatus_CachedFailure
| BuildStatus_TimedOut
| BuildStatus_MiscFailure
| BuildStatus_DependencyFailed
| BuildStatus_LogLimitExceeded
| BuildStatus_NotDeterministic
| BuildStatus_ResolvesToAlreadyValid
| BuildStatus_NoSubstituters
deriving (BuildStatus
BuildStatus -> BuildStatus -> Bounded BuildStatus
forall a. a -> a -> Bounded a
$cminBound :: BuildStatus
minBound :: BuildStatus
$cmaxBound :: BuildStatus
maxBound :: BuildStatus
Bounded, BuildStatus -> BuildStatus -> Bool
(BuildStatus -> BuildStatus -> Bool)
-> (BuildStatus -> BuildStatus -> Bool) -> Eq BuildStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BuildStatus -> BuildStatus -> Bool
== :: BuildStatus -> BuildStatus -> Bool
$c/= :: BuildStatus -> BuildStatus -> Bool
/= :: BuildStatus -> BuildStatus -> Bool
Eq, (forall x. BuildStatus -> Rep BuildStatus x)
-> (forall x. Rep BuildStatus x -> BuildStatus)
-> Generic BuildStatus
forall x. Rep BuildStatus x -> BuildStatus
forall x. BuildStatus -> Rep BuildStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BuildStatus -> Rep BuildStatus x
from :: forall x. BuildStatus -> Rep BuildStatus x
$cto :: forall x. Rep BuildStatus x -> BuildStatus
to :: forall x. Rep BuildStatus x -> BuildStatus
Generic, Eq BuildStatus
Eq BuildStatus =>
(BuildStatus -> BuildStatus -> Ordering)
-> (BuildStatus -> BuildStatus -> Bool)
-> (BuildStatus -> BuildStatus -> Bool)
-> (BuildStatus -> BuildStatus -> Bool)
-> (BuildStatus -> BuildStatus -> Bool)
-> (BuildStatus -> BuildStatus -> BuildStatus)
-> (BuildStatus -> BuildStatus -> BuildStatus)
-> Ord BuildStatus
BuildStatus -> BuildStatus -> Bool
BuildStatus -> BuildStatus -> Ordering
BuildStatus -> BuildStatus -> BuildStatus
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: BuildStatus -> BuildStatus -> Ordering
compare :: BuildStatus -> BuildStatus -> Ordering
$c< :: BuildStatus -> BuildStatus -> Bool
< :: BuildStatus -> BuildStatus -> Bool
$c<= :: BuildStatus -> BuildStatus -> Bool
<= :: BuildStatus -> BuildStatus -> Bool
$c> :: BuildStatus -> BuildStatus -> Bool
> :: BuildStatus -> BuildStatus -> Bool
$c>= :: BuildStatus -> BuildStatus -> Bool
>= :: BuildStatus -> BuildStatus -> Bool
$cmax :: BuildStatus -> BuildStatus -> BuildStatus
max :: BuildStatus -> BuildStatus -> BuildStatus
$cmin :: BuildStatus -> BuildStatus -> BuildStatus
min :: BuildStatus -> BuildStatus -> BuildStatus
Ord, Int -> BuildStatus
BuildStatus -> Int
BuildStatus -> [BuildStatus]
BuildStatus -> BuildStatus
BuildStatus -> BuildStatus -> [BuildStatus]
BuildStatus -> BuildStatus -> BuildStatus -> [BuildStatus]
(BuildStatus -> BuildStatus)
-> (BuildStatus -> BuildStatus)
-> (Int -> BuildStatus)
-> (BuildStatus -> Int)
-> (BuildStatus -> [BuildStatus])
-> (BuildStatus -> BuildStatus -> [BuildStatus])
-> (BuildStatus -> BuildStatus -> [BuildStatus])
-> (BuildStatus -> BuildStatus -> BuildStatus -> [BuildStatus])
-> Enum BuildStatus
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: BuildStatus -> BuildStatus
succ :: BuildStatus -> BuildStatus
$cpred :: BuildStatus -> BuildStatus
pred :: BuildStatus -> BuildStatus
$ctoEnum :: Int -> BuildStatus
toEnum :: Int -> BuildStatus
$cfromEnum :: BuildStatus -> Int
fromEnum :: BuildStatus -> Int
$cenumFrom :: BuildStatus -> [BuildStatus]
enumFrom :: BuildStatus -> [BuildStatus]
$cenumFromThen :: BuildStatus -> BuildStatus -> [BuildStatus]
enumFromThen :: BuildStatus -> BuildStatus -> [BuildStatus]
$cenumFromTo :: BuildStatus -> BuildStatus -> [BuildStatus]
enumFromTo :: BuildStatus -> BuildStatus -> [BuildStatus]
$cenumFromThenTo :: BuildStatus -> BuildStatus -> BuildStatus -> [BuildStatus]
enumFromThenTo :: BuildStatus -> BuildStatus -> BuildStatus -> [BuildStatus]
Enum, Int -> BuildStatus -> ShowS
[BuildStatus] -> ShowS
BuildStatus -> String
(Int -> BuildStatus -> ShowS)
-> (BuildStatus -> String)
-> ([BuildStatus] -> ShowS)
-> Show BuildStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BuildStatus -> ShowS
showsPrec :: Int -> BuildStatus -> ShowS
$cshow :: BuildStatus -> String
show :: BuildStatus -> String
$cshowList :: [BuildStatus] -> ShowS
showList :: [BuildStatus] -> ShowS
Show)
data BuildResult = BuildResult
{ BuildResult -> BuildStatus
buildResultStatus :: BuildStatus
, BuildResult -> Maybe Text
buildResultErrorMessage :: Maybe Text
, BuildResult -> Maybe Int
buildResultTimesBuilt :: Maybe Int
, BuildResult -> Maybe Bool
buildResultIsNonDeterministic :: Maybe Bool
, BuildResult -> Maybe UTCTime
buildResultStartTime :: Maybe UTCTime
, BuildResult -> Maybe UTCTime
buildResultStopTime :: Maybe UTCTime
, BuildResult
-> Maybe (Map (DerivationOutput OutputName) Realisation)
buildResultBuiltOutputs :: Maybe (Map (DerivationOutput OutputName) Realisation)
}
deriving (BuildResult -> BuildResult -> Bool
(BuildResult -> BuildResult -> Bool)
-> (BuildResult -> BuildResult -> Bool) -> Eq BuildResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BuildResult -> BuildResult -> Bool
== :: BuildResult -> BuildResult -> Bool
$c/= :: BuildResult -> BuildResult -> Bool
/= :: BuildResult -> BuildResult -> Bool
Eq, (forall x. BuildResult -> Rep BuildResult x)
-> (forall x. Rep BuildResult x -> BuildResult)
-> Generic BuildResult
forall x. Rep BuildResult x -> BuildResult
forall x. BuildResult -> Rep BuildResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BuildResult -> Rep BuildResult x
from :: forall x. BuildResult -> Rep BuildResult x
$cto :: forall x. Rep BuildResult x -> BuildResult
to :: forall x. Rep BuildResult x -> BuildResult
Generic, Eq BuildResult
Eq BuildResult =>
(BuildResult -> BuildResult -> Ordering)
-> (BuildResult -> BuildResult -> Bool)
-> (BuildResult -> BuildResult -> Bool)
-> (BuildResult -> BuildResult -> Bool)
-> (BuildResult -> BuildResult -> Bool)
-> (BuildResult -> BuildResult -> BuildResult)
-> (BuildResult -> BuildResult -> BuildResult)
-> Ord BuildResult
BuildResult -> BuildResult -> Bool
BuildResult -> BuildResult -> Ordering
BuildResult -> BuildResult -> BuildResult
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: BuildResult -> BuildResult -> Ordering
compare :: BuildResult -> BuildResult -> Ordering
$c< :: BuildResult -> BuildResult -> Bool
< :: BuildResult -> BuildResult -> Bool
$c<= :: BuildResult -> BuildResult -> Bool
<= :: BuildResult -> BuildResult -> Bool
$c> :: BuildResult -> BuildResult -> Bool
> :: BuildResult -> BuildResult -> Bool
$c>= :: BuildResult -> BuildResult -> Bool
>= :: BuildResult -> BuildResult -> Bool
$cmax :: BuildResult -> BuildResult -> BuildResult
max :: BuildResult -> BuildResult -> BuildResult
$cmin :: BuildResult -> BuildResult -> BuildResult
min :: BuildResult -> BuildResult -> BuildResult
Ord, Int -> BuildResult -> ShowS
[BuildResult] -> ShowS
BuildResult -> String
(Int -> BuildResult -> ShowS)
-> (BuildResult -> String)
-> ([BuildResult] -> ShowS)
-> Show BuildResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BuildResult -> ShowS
showsPrec :: Int -> BuildResult -> ShowS
$cshow :: BuildResult -> String
show :: BuildResult -> String
$cshowList :: [BuildResult] -> ShowS
showList :: [BuildResult] -> ShowS
Show)
buildSuccess :: BuildStatus -> Bool
buildSuccess :: BuildStatus -> Bool
buildSuccess BuildStatus
x =
BuildStatus
x BuildStatus -> [BuildStatus] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem`
[ BuildStatus
BuildStatus_Built
, BuildStatus
BuildStatus_Substituted
, BuildStatus
BuildStatus_AlreadyValid
]