-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Easy dependency management for Nix projects -- -- Easy dependency management for Nix projects. @package niv @version 0.2.21 module Data.Aeson.Extended -- | Efficiently prettify and serialize a JSON value as a lazy -- ByteString and write it to a file. encodeFilePretty :: ToJSON a => FilePath -> a -> IO () module Data.HashMap.Strict.Extended forWithKeyM :: (Eq k, Hashable k, Monad m) => HashMap k v1 -> (k -> v1 -> m v2) -> m (HashMap k v2) forWithKeyM_ :: (Eq k, Hashable k, Monad m) => HashMap k v1 -> (k -> v1 -> m ()) -> m () mapWithKeyM :: (Eq k, Hashable k, Monad m) => (k -> v1 -> m v2) -> HashMap k v1 -> m (HashMap k v2) mapWithKeyM_ :: (Eq k, Hashable k, Monad m) => (k -> v1 -> m ()) -> HashMap k v1 -> m () module Niv.Logger data Colors Always :: Colors Never :: Colors job :: (MonadUnliftIO io, MonadIO io) => String -> io () -> io () setColors :: Colors -> IO () bug :: Text -> Text tsay :: MonadIO io => Text -> io () say :: MonadIO io => String -> io () twarn :: MonadIO io => Text -> io () mkWarn :: Text -> Text mkNote :: Text -> Text green :: S tgreen :: T red :: S tred :: T blue :: S tblue :: T yellow :: S tyellow :: T bold :: S tbold :: T faint :: String -> String tfaint :: T instance GHC.Classes.Eq Niv.Logger.Colors module Data.Text.Extended tshow :: Show a => a -> Text abort :: MonadIO io => Text -> io a module Niv.GitHub.API data GithubRepo GithubRepo :: Maybe Text -> Maybe Text -> Maybe Text -> GithubRepo [repoDescription] :: GithubRepo -> Maybe Text [repoHomepage] :: GithubRepo -> Maybe Text [repoDefaultBranch] :: GithubRepo -> Maybe Text githubRepo :: Text -> Text -> IO GithubRepo -- | TODO: Error instead of T.Text? abortCouldNotFetchGitHubRepo :: Text -> (Text, Text) -> IO a defaultRequest :: [Text] -> IO Request -- | Get the latest revision for owner, repo and branch. TODO: explain no -- error handling githubLatestRev :: Text -> Text -> Text -> IO Text abortCouldNotGetRev :: Text -> Text -> Text -> Response ByteString -> IO a -- | Like lookupEnv "foo" but also looks up NIV_foo lookupEnv' :: String -> IO (Maybe String) githubHost :: Text githubApiPort :: Int githubApiHost :: Text githubSecure :: Bool githubPath :: Text module Niv.Update type Attrs = HashMap Text (Freedom, Value) data Update b c [Id] :: Update a a [Compose] :: Compose b c -> Update b c [Arr] :: (b -> c) -> Update b c [First] :: Update b c -> Update (b, d) (c, d) [Zero] :: Update b c [Plus] :: Update b c -> Update b c -> Update b c [Check] :: (a -> Bool) -> Update (Box a) () [Load] :: Text -> Update () (Box Value) [UseOrSet] :: Text -> Update (Box Value) (Box Value) [Update] :: Text -> Update (Box Value) (Box Value) [Run] :: (a -> IO b) -> Update (Box a) (Box b) [Template] :: Update (Box Text) (Box Text) data Compose a c Compose' :: Update b c -> Update a b -> Compose a c -- | Run an Update and return the new attributes and result. runUpdate :: Attrs -> Update () a -> IO (Attrs, a) execUpdate :: Attrs -> Update () a -> IO a evalUpdate :: Attrs -> Update () a -> IO Attrs tryEvalUpdate :: Attrs -> Update () a -> IO (Either SomeException Attrs) type JSON a = (ToJSON a, FromJSON a) data UpdateFailed FailNoSuchKey :: Text -> UpdateFailed FailZero :: UpdateFailed FailCheck :: UpdateFailed FailTemplate :: Text -> [Text] -> UpdateFailed data UpdateRes a b UpdateReady :: UpdateReady b -> UpdateRes a b UpdateNeedMore :: (a -> IO (UpdateReady b)) -> UpdateRes a b data UpdateReady b UpdateSuccess :: BoxedAttrs -> b -> UpdateReady b UpdateFailed :: UpdateFailed -> UpdateReady b runBox :: Box a -> IO a data Box a Box :: Bool -> IO a -> Box a -- | Whether the value is new or was retrieved (or derived) from old -- attributes [boxNew] :: Box a -> Bool [boxOp] :: Box a -> IO a mkBox :: Box a -> IO (Box a) singleton :: MVar (Maybe a) -> IO a -> IO a type BoxedAttrs = HashMap Text (Freedom, Box Value) unboxAttrs :: BoxedAttrs -> IO Attrs boxAttrs :: Attrs -> IO BoxedAttrs data Freedom Locked :: Freedom Free :: Freedom -- | Runs an update, trying to evaluate the Boxes as little as -- possible. This is a hairy piece of code, apologies ¯_(ツ)_/¯ In most -- cases I just picked the first implementation that compiled runUpdate' :: BoxedAttrs -> Update a b -> IO (UpdateRes a b) decodeBox :: FromJSON a => Text -> Box Value -> Box a decodeValue :: FromJSON a => Text -> Value -> IO a -- | Renders the template. Returns Nothing if some of the attributes -- are missing. renderTemplate ("foo" -> "bar") "foo" -> -- pure (Just "bar") renderTemplate ("foo" -> "bar") "baz" -- -> pure Nothing renderTemplate :: (Text -> Maybe (Box Text)) -> Text -> Maybe (Box Text) template :: Update (Box Text) (Box Text) check :: (a -> Bool) -> Update (Box a) () load :: FromJSON a => Text -> Update () (Box a) useOrSet :: JSON a => Text -> Update (Box a) (Box a) update :: JSON a => Text -> Update (Box a) (Box a) run :: (a -> IO b) -> Update (Box a) (Box b) -- | Like run but forces evaluation run' :: (a -> IO b) -> Update (Box a) (Box b) dirty :: Update (Box a) (Box a) instance GHC.Show.Show Niv.Update.UpdateFailed instance GHC.Base.Functor Niv.Update.Box instance GHC.Show.Show Niv.Update.Freedom instance GHC.Classes.Eq Niv.Update.Freedom instance GHC.Base.Functor Niv.Update.UpdateReady instance GHC.Base.Functor (Niv.Update.UpdateRes a) instance Control.Arrow.ArrowZero Niv.Update.Update instance Control.Arrow.ArrowPlus Niv.Update.Update instance Control.Arrow.Arrow Niv.Update.Update instance Control.Category.Category Niv.Update.Update instance GHC.Show.Show (Niv.Update.Update b c) instance GHC.Base.Applicative Niv.Update.Box instance GHC.Base.Semigroup a => GHC.Base.Semigroup (Niv.Update.Box a) instance Data.String.IsString (Niv.Update.Box Data.Text.Internal.Text) module Niv.Sources -- | Where to find the sources.json data FindSourcesJson -- | use the default (nix/sources.json) Auto :: FindSourcesJson -- | use the specified file path AtPath :: FilePath -> FindSourcesJson data SourcesError SourcesDoesntExist :: SourcesError SourceIsntJSON :: SourcesError SpecIsntAMap :: SourcesError newtype Sources Sources :: HashMap PackageName PackageSpec -> Sources [unSources] :: Sources -> HashMap PackageName PackageSpec getSourcesEither :: FindSourcesJson -> IO (Either SourcesError Sources) getSources :: FindSourcesJson -> IO Sources setSources :: FindSourcesJson -> Sources -> IO () newtype PackageName PackageName :: Text -> PackageName [unPackageName] :: PackageName -> Text newtype PackageSpec PackageSpec :: Object -> PackageSpec [unPackageSpec] :: PackageSpec -> Object -- | Simply discards the Freedom attrsToSpec :: Attrs -> PackageSpec -- | nix/sources.json or pointed at by FindSourcesJson pathNixSourcesJson :: FindSourcesJson -> FilePath abortSourcesDoesntExist :: FindSourcesJson -> IO a abortSourcesIsntJSON :: FindSourcesJson -> IO a abortSpecIsntAMap :: FindSourcesJson -> IO a -- | All the released versions of nix/sources.nix data SourcesNixVersion V1 :: SourcesNixVersion V2 :: SourcesNixVersion V3 :: SourcesNixVersion V4 :: SourcesNixVersion V5 :: SourcesNixVersion V6 :: SourcesNixVersion V7 :: SourcesNixVersion V8 :: SourcesNixVersion V9 :: SourcesNixVersion V10 :: SourcesNixVersion V11 :: SourcesNixVersion V12 :: SourcesNixVersion V13 :: SourcesNixVersion V14 :: SourcesNixVersion V15 :: SourcesNixVersion V16 :: SourcesNixVersion V17 :: SourcesNixVersion V18 :: SourcesNixVersion V19 :: SourcesNixVersion V20 :: SourcesNixVersion V21 :: SourcesNixVersion V22 :: SourcesNixVersion V23 :: SourcesNixVersion V24 :: SourcesNixVersion V25 :: SourcesNixVersion V26 :: SourcesNixVersion V27 :: SourcesNixVersion -- | A user friendly version sourcesVersionToText :: SourcesNixVersion -> Text latestVersionMD5 :: Text -- | Find a version based on the md5 of the nix/sources.nix md5ToSourcesVersion :: Text -> Maybe SourcesNixVersion -- | The MD5 sum of a particular version sourcesVersionToMD5 :: SourcesNixVersion -> Text -- | The MD5 sum of .nixsources.nix sourcesNixMD5 :: IO Text -- |
-- nix/sources.nix --pathNixSourcesNix :: FilePath warnIfOutdated :: IO () -- | Glue code between nix and sources.json initNixSourcesNixContent :: ByteString -- | Empty JSON map initNixSourcesJsonContent :: ByteString instance GHC.Show.Show Niv.Sources.PackageName instance Data.Aeson.Types.ToJSON.ToJSONKey Niv.Sources.PackageName instance Data.Aeson.Types.FromJSON.FromJSONKey Niv.Sources.PackageName instance Data.Hashable.Class.Hashable Niv.Sources.PackageName instance GHC.Classes.Eq Niv.Sources.PackageName instance GHC.Base.Monoid Niv.Sources.PackageSpec instance GHC.Base.Semigroup Niv.Sources.PackageSpec instance GHC.Show.Show Niv.Sources.PackageSpec instance Data.Aeson.Types.ToJSON.ToJSON Niv.Sources.PackageSpec instance Data.Aeson.Types.FromJSON.FromJSON Niv.Sources.PackageSpec instance Data.Aeson.Types.ToJSON.ToJSON Niv.Sources.Sources instance Data.Aeson.Types.FromJSON.FromJSON Niv.Sources.Sources instance GHC.Classes.Eq Niv.Sources.SourcesNixVersion instance GHC.Enum.Enum Niv.Sources.SourcesNixVersion instance GHC.Enum.Bounded Niv.Sources.SourcesNixVersion module Niv.Sources.Test -- | Ensure that the sources.nix we ship is tracked as the latest version test_shippedSourcesNixIsLatest :: IO () module Niv.GitHub -- | The GitHub update function TODO: fetchers for: * npm * hackage * -- docker * ... ? githubUpdate :: (Bool -> Text -> IO Text) -> (Text -> Text -> Text -> IO Text) -> (Text -> Text -> IO GithubRepo) -> Update () () githubURLTemplate :: Text module Niv.GitHub.Test test_githubInitsProperly :: IO () test_githubUpdates :: IO () test_githubDoesntOverrideRev :: IO () test_githubURLFallback :: IO () test_githubUpdatesOnce :: IO () module Niv.Cmd data Cmd Cmd :: (forall a. InfoMod a) -> (Text -> Maybe (PackageName, Object)) -> Parser PackageSpec -> Update () () -> Text -> (Attrs -> [Text]) -> Cmd [description] :: Cmd -> forall a. InfoMod a [parseCmdShortcut] :: Cmd -> Text -> Maybe (PackageName, Object) [parsePackageSpec] :: Cmd -> Parser PackageSpec [updateCmd] :: Cmd -> Update () () [name] :: Cmd -> Text -- | Some notes to print [extraLogs] :: Cmd -> Attrs -> [Text] module Niv.Local.Cmd localCmd :: Cmd parseLocalShortcut :: Text -> Maybe (PackageName, Object) parseLocalPackageSpec :: Parser PackageSpec describeLocal :: InfoMod a module Niv.GitHub.Cmd githubCmd :: Cmd module Niv.Git.Cmd gitCmd :: Cmd gitExtraLogs :: Attrs -> [Text] parseGitShortcut :: Text -> Maybe (PackageName, Object) parseGitPackageSpec :: Parser PackageSpec describeGit :: InfoMod a gitUpdate :: (Text -> Text -> IO Text) -> (Text -> IO (Text, Text)) -> Update () () -- | The "real" (IO) update gitUpdate' :: Update () () latestRev :: Text -> Text -> IO Text defaultBranchAndRev :: Text -> IO (Text, Text) abortNoRev :: [Text] -> Text -> IO a abortNoRef :: [Text] -> Text -> IO a -- | Run the "git" executable runGit :: [Text] -> IO [Text] isRev :: Text -> Bool abortGitFailure :: [Text] -> Text -> IO a abortGitBug :: [Text] -> Text -> IO a module Niv.Git.Test tests :: [TestTree] module Niv.Update.Test simplyRuns :: IO () picksFirst :: IO () loads :: IO () survivesChecks :: IO () isNotTooEager :: IO () dirtyForcesUpdate :: IO () shouldNotRunWhenNoChanges :: IO () templatesExpand :: IO () constBox :: a -> Update () (Box a) module Niv.Test tests :: TestTree test :: IO () module Niv.Cli newtype NIO a NIO :: ReaderT FindSourcesJson IO a -> NIO a [runNIO] :: NIO a -> ReaderT FindSourcesJson IO a getFindSourcesJson :: NIO FindSourcesJson li :: MonadIO io => IO a -> io a cli :: IO () parseCommand :: Parser (NIO ()) parsePackageName :: Parser PackageName parsePackage :: Parser (PackageName, PackageSpec) -- | Whether or not to fetch nixpkgs data FetchNixpkgs NoNixpkgs :: FetchNixpkgs NixpkgsFast :: FetchNixpkgs NixpkgsCustom :: Text -> Nixpkgs -> FetchNixpkgs data Nixpkgs Nixpkgs :: Text -> Text -> Nixpkgs parseCmdInit :: ParserInfo (NIO ()) parseNixpkgs :: Parser FetchNixpkgs cmdInit :: FetchNixpkgs -> NIO () initNixpkgs :: FetchNixpkgs -> NIO () parseCmdAdd :: ParserInfo (NIO ()) -- | only used in shortcuts (niv add foo/bar ...) because PACKAGE is NOT -- optional parseShortcutArgs :: Cmd -> Parser (PackageName, Attrs) -- | only used in command (niv add cmd ...) because PACKAGE is -- optional parseCmdArgs :: Cmd -> Parser (PackageName, Attrs) cmdAdd :: Cmd -> PackageName -> Attrs -> NIO () parseCmdShow :: ParserInfo (NIO ()) cmdShow :: Maybe PackageName -> NIO () showPackage :: MonadIO io => PackageName -> PackageSpec -> io () parseCmdUpdate :: ParserInfo (NIO ()) specToFreeAttrs :: PackageSpec -> Attrs specToLockedAttrs :: PackageSpec -> Attrs cmdUpdate :: Maybe (PackageName, PackageSpec) -> NIO () -- | pretty much tryEvalUpdate but we might issue some warnings first doUpdate :: Attrs -> Cmd -> IO (Either SomeException Attrs) partitionEithersHMS :: (Eq k, Hashable k) => HashMap k (Either a b) -> (HashMap k a, HashMap k b) parseCmdModify :: ParserInfo (NIO ()) cmdModify :: PackageName -> Maybe PackageName -> PackageSpec -> NIO () parseCmdDrop :: ParserInfo (NIO ()) cmdDrop :: PackageName -> [Text] -> NIO () -- | Checks if content is different than default and if it does not -- contain a comment line with niv: no_update shouldUpdateNixSourcesNix :: ByteString -> Bool abortCannotAddPackageExists :: PackageName -> IO a abortCannotUpdateNoSuchPackage :: PackageName -> IO a abortCannotModifyNoSuchPackage :: PackageName -> IO a abortCannotDropNoSuchPackage :: PackageName -> IO a abortCannotShowNoSuchPackage :: PackageName -> IO a abortCannotAttributesDropNoSuchPackage :: PackageName -> IO a abortUpdateFailed :: [(PackageName, SomeException)] -> IO a instance Control.Monad.Reader.Class.MonadReader Niv.Sources.FindSourcesJson Niv.Cli.NIO instance Control.Monad.IO.Class.MonadIO Niv.Cli.NIO instance GHC.Base.Monad Niv.Cli.NIO instance GHC.Base.Applicative Niv.Cli.NIO instance GHC.Base.Functor Niv.Cli.NIO instance GHC.Show.Show Niv.Cli.FetchNixpkgs instance GHC.Show.Show Niv.Cli.Nixpkgs instance Control.Monad.IO.Unlift.MonadUnliftIO Niv.Cli.NIO