{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Update.Nix.FetchGit.Types where
import Data.Data (Data)
import Data.Text (Text)
import qualified Data.Time (Day)
import Nix.Expr (NExprLoc)
type Day = Data.Time.Day
data FetchTree fetchInfo = Node { nodeVersionExpr :: Maybe NExprLoc
, nodeChildren :: [FetchTree fetchInfo]
}
| FetchNode fetchInfo
deriving (Show, Data, Functor, Foldable, Traversable)
data FetchGitArgs = FetchGitArgs { repoLocation :: RepoLocation
, revExpr :: NExprLoc
, sha256Expr :: Maybe NExprLoc
}
deriving (Show, Data)
data FetchGitLatestInfo = FetchGitLatestInfo { originalInfo :: FetchGitArgs
, latestRev :: Text
, latestSha256 :: Text
, latestDate :: Day
}
deriving (Show, Data)
data RepoLocation = URL Text
| GitHub { owner :: Text
, repo :: Text
}
| GitLab { owner :: Text
, repo :: Text
}
deriving (Show, Data)