-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Explain why two Nix derivations differ -- -- This package provides a nix-diff executable which explains -- why two Nix derivations (i.e. *.drv files) differ @package nix-diff @version 1.0.20 module Nix.Diff.Types data Changed a Changed :: a -> a -> Changed a [before] :: Changed a -> a [now] :: Changed a -> a newtype TextDiff TextDiff :: [Item Text] -> TextDiff [unTextDiff] :: TextDiff -> [Item Text] type OutputHash = Text type Platform = Text type Builder = Text type Argument = Text data DerivationDiff DerivationsAreTheSame :: DerivationDiff AlreadyCompared :: DerivationDiff OnlyAlreadyComparedBelow :: Changed OutputStructure -> DerivationDiff [outputStructure] :: DerivationDiff -> Changed OutputStructure NamesDontMatch :: Changed OutputStructure -> DerivationDiff [outputStructure] :: DerivationDiff -> Changed OutputStructure OutputsDontMatch :: Changed OutputStructure -> DerivationDiff [outputStructure] :: DerivationDiff -> Changed OutputStructure DerivationDiff :: Changed OutputStructure -> OutputsDiff -> Maybe (Changed Platform) -> Maybe (Changed Builder) -> Maybe ArgumentsDiff -> SourcesDiff -> InputsDiff -> Maybe EnvironmentDiff -> DerivationDiff [outputStructure] :: DerivationDiff -> Changed OutputStructure [outputsDiff] :: DerivationDiff -> OutputsDiff -- | Will be Nothing, if Platform does not change [platformDiff] :: DerivationDiff -> Maybe (Changed Platform) -- | Will be Nothing, if Builder does not change [builderDiff] :: DerivationDiff -> Maybe (Changed Builder) -- | Will be Nothing, if arguments are equal [argumentsDiff] :: DerivationDiff -> Maybe ArgumentsDiff [sourcesDiff] :: DerivationDiff -> SourcesDiff [inputsDiff] :: DerivationDiff -> InputsDiff -- | Will be Nothing, if environment comparison is skipped [envDiff] :: DerivationDiff -> Maybe EnvironmentDiff data OutputStructure OutputStructure :: FilePath -> Set Text -> OutputStructure [derivationPath] :: OutputStructure -> FilePath [derivationOutputs] :: OutputStructure -> Set Text data OutputsDiff OutputsDiff :: Maybe (Changed (Map Text (DerivationOutput FilePath Text))) -> [OutputDiff] -> OutputsDiff -- | Map from derivation name to its outputs. Will be Nothing, if -- difference gives empty Maps for both new and old outputs [extraOutputs] :: OutputsDiff -> Maybe (Changed (Map Text (DerivationOutput FilePath Text))) -- | Difference of outputs with the same name. Will be empty, if all -- outputs are equal. [outputHashDiff] :: OutputsDiff -> [OutputDiff] data OutputDiff OutputDiff :: Text -> Changed OutputHash -> OutputDiff [outputName] :: OutputDiff -> Text [hashDifference] :: OutputDiff -> Changed OutputHash newtype ArgumentsDiff ArgumentsDiff :: NonEmpty (Item Argument) -> ArgumentsDiff [unArgumetsDiff] :: ArgumentsDiff -> NonEmpty (Item Argument) data SourcesDiff SourcesDiff :: Maybe (Changed (Set Text)) -> [SourceFileDiff] -> SourcesDiff -- | Will be Nothing, if there is no extra source names [extraSrcNames] :: SourcesDiff -> Maybe (Changed (Set Text)) [srcFilesDiff] :: SourcesDiff -> [SourceFileDiff] data SourceFileDiff OneSourceFileDiff :: Text -> Maybe TextDiff -> SourceFileDiff [srcName] :: SourceFileDiff -> Text -- | Will be Nothing, if any of source files not exists [srcContentDiff] :: SourceFileDiff -> Maybe TextDiff SomeSourceFileDiff :: Text -> Changed [FilePath] -> SourceFileDiff [srcName] :: SourceFileDiff -> Text [srcFileDiff] :: SourceFileDiff -> Changed [FilePath] data InputsDiff InputsDiff :: Maybe (Changed (Set Text)) -> [InputDerivationsDiff] -> InputsDiff -- | Will be Nothing, if there is no extra input names [inputExtraNames] :: InputsDiff -> Maybe (Changed (Set Text)) [inputDerivationDiffs] :: InputsDiff -> [InputDerivationsDiff] data InputDerivationsDiff OneDerivationDiff :: Text -> DerivationDiff -> InputDerivationsDiff [drvName] :: InputDerivationsDiff -> Text [drvDiff] :: InputDerivationsDiff -> DerivationDiff SomeDerivationsDiff :: Text -> Changed (Map FilePath (Set Text)) -> InputDerivationsDiff [drvName] :: InputDerivationsDiff -> Text [extraPartsDiff] :: InputDerivationsDiff -> Changed (Map FilePath (Set Text)) data EnvironmentDiff EnvironmentsAreEqual :: EnvironmentDiff EnvironmentDiff :: Changed (Map Text Text) -> [EnvVarDiff] -> EnvironmentDiff [extraEnvDiff] :: EnvironmentDiff -> Changed (Map Text Text) [envContentDiff] :: EnvironmentDiff -> [EnvVarDiff] data EnvVarDiff EnvVarDiff :: Text -> TextDiff -> EnvVarDiff [envKey] :: EnvVarDiff -> Text [envValueDiff] :: EnvVarDiff -> TextDiff changedToJSON :: (a -> Value) -> Changed a -> Value changedFromJSON :: (Value -> Parser a) -> Value -> Parser (Changed a) itemToJSON :: ToJSON v => Item v -> Value itemFromJSON :: FromJSON v => Value -> Parser (Item v) arbitraryItem :: Arbitrary a => Gen (Item a) arbitraryDerivationOutput :: (Arbitrary fp, Arbitrary txt) => Gen (DerivationOutput fp txt) instance Data.Data.Data a => Data.Data.Data (Nix.Diff.Types.Changed a) instance GHC.Generics.Generic (Nix.Diff.Types.Changed a) instance Data.Traversable.Traversable Nix.Diff.Types.Changed instance Data.Foldable.Foldable Nix.Diff.Types.Changed instance GHC.Base.Functor Nix.Diff.Types.Changed instance GHC.Show.Show a => GHC.Show.Show (Nix.Diff.Types.Changed a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Nix.Diff.Types.Changed a) instance Data.Data.Data Nix.Diff.Types.TextDiff instance GHC.Show.Show Nix.Diff.Types.TextDiff instance GHC.Classes.Eq Nix.Diff.Types.TextDiff instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.OutputStructure instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.OutputStructure instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.OutputStructure instance Data.Data.Data Nix.Diff.Types.OutputStructure instance GHC.Generics.Generic Nix.Diff.Types.OutputStructure instance GHC.Show.Show Nix.Diff.Types.OutputStructure instance GHC.Classes.Eq Nix.Diff.Types.OutputStructure instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.OutputDiff instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.OutputDiff instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.OutputDiff instance Data.Data.Data Nix.Diff.Types.OutputDiff instance GHC.Generics.Generic Nix.Diff.Types.OutputDiff instance GHC.Show.Show Nix.Diff.Types.OutputDiff instance GHC.Classes.Eq Nix.Diff.Types.OutputDiff instance Data.Data.Data Nix.Diff.Types.OutputsDiff instance GHC.Show.Show Nix.Diff.Types.OutputsDiff instance GHC.Classes.Eq Nix.Diff.Types.OutputsDiff instance Data.Data.Data Nix.Diff.Types.ArgumentsDiff instance GHC.Show.Show Nix.Diff.Types.ArgumentsDiff instance GHC.Classes.Eq Nix.Diff.Types.ArgumentsDiff instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.SourceFileDiff instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.SourceFileDiff instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.SourceFileDiff instance Data.Data.Data Nix.Diff.Types.SourceFileDiff instance GHC.Generics.Generic Nix.Diff.Types.SourceFileDiff instance GHC.Show.Show Nix.Diff.Types.SourceFileDiff instance GHC.Classes.Eq Nix.Diff.Types.SourceFileDiff instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.SourcesDiff instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.SourcesDiff instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.SourcesDiff instance Data.Data.Data Nix.Diff.Types.SourcesDiff instance GHC.Generics.Generic Nix.Diff.Types.SourcesDiff instance GHC.Show.Show Nix.Diff.Types.SourcesDiff instance GHC.Classes.Eq Nix.Diff.Types.SourcesDiff instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.EnvVarDiff instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.EnvVarDiff instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.EnvVarDiff instance Data.Data.Data Nix.Diff.Types.EnvVarDiff instance GHC.Generics.Generic Nix.Diff.Types.EnvVarDiff instance GHC.Show.Show Nix.Diff.Types.EnvVarDiff instance GHC.Classes.Eq Nix.Diff.Types.EnvVarDiff instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.EnvironmentDiff instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.EnvironmentDiff instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.EnvironmentDiff instance Data.Data.Data Nix.Diff.Types.EnvironmentDiff instance GHC.Generics.Generic Nix.Diff.Types.EnvironmentDiff instance GHC.Show.Show Nix.Diff.Types.EnvironmentDiff instance GHC.Classes.Eq Nix.Diff.Types.EnvironmentDiff instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.InputDerivationsDiff instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.InputDerivationsDiff instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.InputDerivationsDiff instance Data.Data.Data Nix.Diff.Types.InputDerivationsDiff instance GHC.Generics.Generic Nix.Diff.Types.InputDerivationsDiff instance GHC.Show.Show Nix.Diff.Types.InputDerivationsDiff instance GHC.Classes.Eq Nix.Diff.Types.InputDerivationsDiff instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.InputsDiff instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.InputsDiff instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.InputsDiff instance Data.Data.Data Nix.Diff.Types.InputsDiff instance GHC.Generics.Generic Nix.Diff.Types.InputsDiff instance GHC.Show.Show Nix.Diff.Types.InputsDiff instance GHC.Classes.Eq Nix.Diff.Types.InputsDiff instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.DerivationDiff instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.DerivationDiff instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.DerivationDiff instance Data.Data.Data Nix.Diff.Types.DerivationDiff instance GHC.Generics.Generic Nix.Diff.Types.DerivationDiff instance GHC.Show.Show Nix.Diff.Types.DerivationDiff instance GHC.Classes.Eq Nix.Diff.Types.DerivationDiff instance Data.Data.Data (Nix.Derivation.Types.DerivationOutput GHC.IO.FilePath Data.Text.Internal.Text) instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.ArgumentsDiff instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.ArgumentsDiff instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.ArgumentsDiff instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.OutputsDiff instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.OutputsDiff instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.OutputsDiff instance Test.QuickCheck.Arbitrary.Arbitrary Nix.Diff.Types.TextDiff instance Data.Aeson.Types.ToJSON.ToJSON Nix.Diff.Types.TextDiff instance Data.Aeson.Types.FromJSON.FromJSON Nix.Diff.Types.TextDiff instance Test.QuickCheck.Arbitrary.Arbitrary a => Test.QuickCheck.Arbitrary.Arbitrary (Nix.Diff.Types.Changed a) instance Data.Aeson.Types.ToJSON.ToJSON a => Data.Aeson.Types.ToJSON.ToJSON (Nix.Diff.Types.Changed a) instance Data.Aeson.Types.FromJSON.FromJSON a => Data.Aeson.Types.FromJSON.FromJSON (Nix.Diff.Types.Changed a) module Nix.Diff.Transformations -- | In large diffs there may be a lot of derivations that doesn't change -- at all, but changed some of its nested inputs, that was already -- compared. This case will produce "stairs" of useless reports: ``` • -- The input derivation named a differs - -- nixstore/j1jmbxd74kzianaywml2nw1ja31a00r5-a.drv:{out} + -- nixstore/ww51c2dha7m5l5qjzh2rblicsamkrh62-a.drv:{out} • The -- input derivation named b differs - -- nixstore/j1jmbxd74kzianaywml2nw1ja31a00r5-b.drv:{out} + -- nixstore/ww51c2dha7m5l5qjzh2rblicsamkrh62-b.drv:{out} • The -- input derivation named c differs • These two derivations have -- already been compared ``` This transformation will fold all these -- subtrees of diff into one OnlyAlreadComparedBelow. foldAlreadyComparedSubTrees :: DerivationDiff -> DerivationDiff -- | This transformation is most useful for --json output, because it will -- sqash a lot of `{"content":" -- ","type":Both},{"content":When,"type":Both},{"content":" -- ","type":Both},{"content":"in","type":Both},{"content":" -- ","type":Both}` into one `{"content":" When in -- ","type":Both}` block. -- -- To understand this problem clearer, see -- `golden-testsexpected-outputsjson` and -- `golden-testsexpected-outputsjson-squashed`. -- -- _Warning_: this transformation can break some parts of printing in -- human readable mode. squashSourcesAndEnvsDiff :: DerivationDiff -> DerivationDiff transformNestedDerivationDiffs :: (DerivationDiff -> DerivationDiff) -> InputsDiff -> InputsDiff envSkippedOrUnchanged :: Maybe EnvironmentDiff -> Bool alreadyComparedBelow :: InputDerivationsDiff -> Bool transformIf :: Bool -> (DerivationDiff -> DerivationDiff) -> DerivationDiff -> DerivationDiff module Nix.Diff newtype Status Status :: Set Diffed -> Status [visited] :: Status -> Set Diffed data Diffed Diffed :: FilePath -> Set Text -> FilePath -> Set Text -> Diffed [leftDerivation] :: Diffed -> FilePath [leftOutput] :: Diffed -> Set Text [rightDerivation] :: Diffed -> FilePath [rightOutput] :: Diffed -> Set Text newtype Diff a Diff :: ReaderT DiffContext (StateT Status IO) a -> Diff a [unDiff] :: Diff a -> ReaderT DiffContext (StateT Status IO) a data DiffContext DiffContext :: Orientation -> Bool -> DiffContext [orientation] :: DiffContext -> Orientation [environment] :: DiffContext -> Bool data Orientation Character :: Orientation Word :: Orientation Line :: Orientation -- | Extract the name of a derivation (i.e. the part after the hash) -- -- This is used to guess which derivations are related to one another, -- even though their hash might differ -- -- Note that this assumes that the path name is: -- --
-- /nix/store/${32_CHARACTER_HASH}-${NAME}.drv
--
--
-- Nix technically does not require that the Nix store is actually stored
-- underneath `nixstore`, but this is the overwhelmingly common
-- use case
derivationName :: FilePath -> Text
-- | Group paths by their name
groupByName :: Map FilePath a -> Map Text (Map FilePath a)
-- | Extract the name of a build product
--
-- Similar to derivationName, this assumes that the path name is:
--
--
-- /nix/store/${32_CHARACTER_HASH}-${NAME}.drv
--
buildProductName :: FilePath -> Text
-- | Like groupByName, but for Sets
groupSetsByName :: Set FilePath -> Map Text (Set FilePath)
-- | Read a file as utf-8 encoded string, replacing non-utf-8 characters
-- with the unicode replacement character. This is necessary since
-- derivations (and nix source code!) can in principle contain arbitrary
-- bytes, but `nix-derivation` can only parse from Text.
readFileUtf8Lenient :: FilePath -> IO Text
-- | Read and parse a derivation from a file
readDerivation :: FilePath -> Diff (Derivation FilePath Text)
-- | Read and parse a derivation from a store path that can be a derivation
-- (.drv) or a realized path, in which case the corresponding derivation
-- is queried.
readInput :: FilePath -> Diff (Derivation FilePath Text)
-- | Join two Maps on shared keys, discarding keys which are not
-- present in both Maps
innerJoin :: Ord k => Map k a -> Map k b -> Map k (a, b)
getGroupedDiff :: Ord a => [a] -> [a] -> [Item [a]]
-- | Diff two outputs
diffOutput :: Text -> DerivationOutput FilePath Text -> DerivationOutput FilePath Text -> Maybe OutputDiff
-- | Diff two sets of outputs
diffOutputs :: Map Text (DerivationOutput FilePath Text) -> Map Text (DerivationOutput FilePath Text) -> OutputsDiff
-- | Split Text into spans of Text that alternatively fail
-- and satisfy the given predicate
--
-- The first span (if present) does not satisfy the predicate (even if
-- the span is empty)
--
-- -- >>> decomposeOn (== 'b') "aabbaa" -- ["aa","bb","aa"] -- -- >>> decomposeOn (== 'b') "bbaa" -- ["","bb","aa"] -- -- >>> decomposeOn (== 'b') "" -- [] --decomposeOn :: (Char -> Bool) -> Text -> [Text] lineBoundary :: Char -> Bool wordBoundary :: Char -> Bool -- | Diff two Text values diffText :: Text -> Text -> Diff TextDiff -- | Diff two environments diffEnv :: Set Text -> Set Text -> Map Text Text -> Map Text Text -> Diff EnvironmentDiff -- | Diff input sources diffSrcs :: Set FilePath -> Set FilePath -> Diff SourcesDiff diffPlatform :: Text -> Text -> Maybe (Changed Platform) diffBuilder :: Text -> Text -> Maybe (Changed Builder) diffArgs :: Vector Text -> Vector Text -> Maybe ArgumentsDiff diff :: Bool -> FilePath -> Set Text -> FilePath -> Set Text -> Diff DerivationDiff instance GHC.Classes.Ord Nix.Diff.Diffed instance GHC.Classes.Eq Nix.Diff.Diffed instance Control.Monad.Fail.MonadFail Nix.Diff.Diff instance Control.Monad.IO.Class.MonadIO Nix.Diff.Diff instance Control.Monad.State.Class.MonadState Nix.Diff.Status Nix.Diff.Diff instance Control.Monad.Reader.Class.MonadReader Nix.Diff.DiffContext Nix.Diff.Diff instance GHC.Base.Monad Nix.Diff.Diff instance GHC.Base.Applicative Nix.Diff.Diff instance GHC.Base.Functor Nix.Diff.Diff module Nix.Diff.Render.HumanReadable data RenderContext RenderContext :: Orientation -> TTY -> Natural -> Maybe Natural -> RenderContext [$sel:orientation:RenderContext] :: RenderContext -> Orientation [$sel:tty:RenderContext] :: RenderContext -> TTY [$sel:indent:RenderContext] :: RenderContext -> Natural [$sel:context:RenderContext] :: RenderContext -> Maybe Natural newtype Render a Render :: ReaderT RenderContext (Writer Text) a -> Render a [$sel:unRender:Render] :: Render a -> ReaderT RenderContext (Writer Text) a runRender :: Render a -> RenderContext -> (a, Text) runRender' :: Render () -> RenderContext -> Text echo :: Text -> Render () indented :: Natural -> Render a -> Render a data TTY IsTTY :: TTY NotTTY :: TTY -- | Color text red red :: TTY -> Text -> Text -- | Color text background red redBackground :: Orientation -> TTY -> Text -> Text -- | Color text green green :: TTY -> Text -> Text -- | Color text background green greenBackground :: Orientation -> TTY -> Text -> Text -- | Color text grey grey :: Orientation -> TTY -> Text -> Text -- | Format the left half of a diff minus :: TTY -> Text -> Text -- | Format the right half of a diff plus :: TTY -> Text -> Text -- | Format text explaining a diff explain :: Text -> Text -- | Utility to automate a common pattern of printing the two halves of a -- diff. This passes the correct formatting function to each half renderWith :: Changed a -> ((Text -> Text, a) -> Render ()) -> Render () -- | Format the derivation outputs renderOutputs :: Set Text -> Text renderDiffHumanReadable :: DerivationDiff -> Render () zippers :: [a] -> [([a], a, [a])] instance Control.Monad.Writer.Class.MonadWriter Data.Text.Internal.Text Nix.Diff.Render.HumanReadable.Render instance Control.Monad.Reader.Class.MonadReader Nix.Diff.Render.HumanReadable.RenderContext Nix.Diff.Render.HumanReadable.Render instance GHC.Base.Monad Nix.Diff.Render.HumanReadable.Render instance GHC.Base.Applicative Nix.Diff.Render.HumanReadable.Render instance GHC.Base.Functor Nix.Diff.Render.HumanReadable.Render