-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | A tool and library for building virtual machine images.
--   
--   Build virtual machine images for vm-deployments; resize, un-partition,
--   create from scratch or convert disk image files in a variety of
--   formats; assemble and generate all associated files from templates and
--   regular files. VM images can further be modifed through scripts, which
--   are executed in LXC containers into which the vm-images as well as
--   arbitrary directories from the host are mounted. All assembled files
--   can also be accessed by vm build scripts through a special directory
--   mounted in the build container, and/or can be written to directories,
--   ISO- or VFAT-images. The ISO/VFAT images that B9 creates are
--   compatible to 'cloud-init's <a>NoCloud</a> data source; B9 is also
--   very well suited for compiling in a containerized environment. For
--   these applications, the images can be marked as <a>Transient</a> to
--   indicate no further interest in the VM-image itself, and B9 will
--   discard them after the build. B9 will never over-write source files,
--   not even large vm-image files - there is no intended way to modify a
--   source vm-image file 'in-place'. B9 operates in random build
--   directories, which are discarded when the build exists.
@package b9
@version 0.5.49


-- | Utility module to extract a primary partition from an MBR partition on
--   a raw image file.
module B9.MBR
getPartition :: Int -> FilePath -> IO (Word64, Word64)
data PrimaryPartition
PrimaryPartition :: !Word8 -> !CHS -> !Word8 -> !CHS -> !Word32 -> !Word32 -> PrimaryPartition
[primPartStatus] :: PrimaryPartition -> !Word8
[primPartChsStart] :: PrimaryPartition -> !CHS
[primPartPartType] :: PrimaryPartition -> !Word8
[primPartChsEnd] :: PrimaryPartition -> !CHS
[primPartLbaStart] :: PrimaryPartition -> !Word32
[primPartSectors] :: PrimaryPartition -> !Word32
data MBR
MBR :: !PrimaryPartition -> !PrimaryPartition -> !PrimaryPartition -> !PrimaryPartition -> MBR
[mbrPart1] :: MBR -> !PrimaryPartition
[mbrPart2] :: MBR -> !PrimaryPartition
[mbrPart3] :: MBR -> !PrimaryPartition
[mbrPart4] :: MBR -> !PrimaryPartition
data CHS
CHS :: !Word8 -> !Word8 -> !Word8 -> CHS
[chsH] :: CHS -> !Word8
[chs_CUpper2_S] :: CHS -> !Word8
[chs_CLower8] :: CHS -> !Word8
instance GHC.Show.Show B9.MBR.MBR
instance GHC.Show.Show B9.MBR.PrimaryPartition
instance GHC.Show.Show B9.MBR.CHS


-- | Function to find the file offsets of primary partitions in raw disk
--   images. Currently only MBR partitions are supported. See <a>MBR</a>
module B9.PartitionTable
getPartition :: Int -> FilePath -> IO (Word64, Word64, Word64)


-- | Some QuickCheck utility functions.
module B9.QCUtil
arbitraryEnv :: Arbitrary a => Gen [(String, a)]
halfSize :: Gen a -> Gen a
smaller :: Gen a -> Gen a
arbitraryFilePath :: Gen FilePath
arbitraryLetter :: Gen Char
arbitraryLetterUpper :: Gen Char
arbitraryLetterLower :: Gen Char
arbitraryDigit :: Gen Char


-- | Data types that describe all B9 relevant elements of virtual machine
--   disk images.
module B9.DiskImages

-- | Build target for disk images; the destination, format and size of the
--   image to generate, as well as how to create or obtain the image before
--   a <a>VmScript</a> is executed with the image mounted at a
--   <a>MountPoint</a>.
data ImageTarget
ImageTarget :: ImageDestination -> ImageSource -> MountPoint -> ImageTarget

-- | A mount point or <a>NotMounted</a>
data MountPoint
MountPoint :: FilePath -> MountPoint
NotMounted :: MountPoint

-- | The destination of an image.
data ImageDestination

-- | Create the image and some meta data so that other builds can use them
--   as <a>ImageSource</a>s via <a>From</a>.
Share :: String -> ImageType -> ImageResize -> ImageDestination

-- | <b>DEPRECATED</b> Export a raw image that can directly be booted.
LiveInstallerImage :: String -> FilePath -> ImageResize -> ImageDestination

-- | Write an image file to the path in the first argument., possible
--   resizing it,
LocalFile :: Image -> ImageResize -> ImageDestination

-- | Do not export the image. Usefule if the main objective of the b9 build
--   is not an image file, but rather some artifact produced by executing
--   by a containerize build.
Transient :: ImageDestination

-- | Specification of how the image to build is obtained.
data ImageSource

-- | Create an empty image file having a file system label (first
--   parameter), a file system type (e.g. <a>Ext4</a>) and an
--   <a>ImageSize</a>
EmptyImage :: String -> FileSystem -> ImageType -> ImageSize -> ImageSource

-- | <b>DEPRECATED</b>
CopyOnWrite :: Image -> ImageSource

-- | Clone an existing image file; if the image file contains partitions,
--   select the partition to use, b9 will extract that partition by reading
--   the offset of the partition from the partition table and extract it
--   using <tt>dd</tt>.
SourceImage :: Image -> Partition -> ImageResize -> ImageSource

-- | Use an image previously shared by via <a>Share</a>.
From :: String -> ImageResize -> ImageSource

-- | The partition to extract.
data Partition

-- | There is no partition table on the image
NoPT :: Partition

-- | Extract partition <tt>n</tt> <tt>n</tt> must be in <tt>0..3</tt>
Partition :: Int -> Partition

-- | A vm disk image file consisting of a path to the image file, and the
--   type and file system.
data Image
Image :: FilePath -> ImageType -> FileSystem -> Image

-- | An image type defines the actual <i>file format</i> of a file
--   containing file systems. These are like <i>virtual harddrives</i>
data ImageType
Raw :: ImageType
QCow2 :: ImageType
Vmdk :: ImageType

-- | The file systems that b9 can use and convert.
data FileSystem
NoFileSystem :: FileSystem
Ext4 :: FileSystem
Ext4_64 :: FileSystem
ISO9660 :: FileSystem
VFAT :: FileSystem

-- | A data type for image file or file system size; instead of passing
--   <a>Int</a>s around this also captures a size unit so that the
--   <a>Int</a> can be kept small
data ImageSize
ImageSize :: Int -> SizeUnit -> ImageSize

-- | Enumeration of size multipliers. The exact semantics may vary
--   depending on what external tools look at these. E.g. the size unit is
--   convert to a size parameter of the <tt>qemu-img</tt> command line
--   tool.
data SizeUnit
B :: SizeUnit
KB :: SizeUnit
MB :: SizeUnit
GB :: SizeUnit

-- | How to resize an image file.
data ImageResize

-- | Resize the image <b>but not the file system</b>. Note that a file
--   system contained in the image file might be corrupted by this
--   operation. To not only resize the image file but also the fil system
--   contained in it, use <a>Resize</a>.
ResizeImage :: ImageSize -> ImageResize

-- | Resize an image and the contained file system.
Resize :: ImageSize -> ImageResize

-- | Resize an image and the contained file system to the smallest size to
--   fit the contents of the file system.
ShrinkToMinimum :: ImageResize

-- | Do not change the image size.
KeepSize :: ImageResize

-- | A type alias that indicates that something of type <tt>a</tt> is mount
--   at a <a>MountPoint</a>
type Mounted a = (a, MountPoint)

-- | <a>SharedImage</a> holds all data necessary to describe an
--   <b>instance</b> of a shared image identified by a
--   <a>SharedImageName</a>. Shared images are stored in
--   <a>Repository</a>s.
data SharedImage
SharedImage :: SharedImageName -> SharedImageDate -> SharedImageBuildId -> ImageType -> FileSystem -> SharedImage

-- | The name of the image is the de-facto identifier for push, pull,
--   <a>From</a> and <a>Share</a>. B9 always selects the newest version the
--   shared image identified by that name when using a shared image as an
--   <a>ImageSource</a>. This is a wrapper around a string that identifies
--   a <a>SharedImage</a>
newtype SharedImageName
SharedImageName :: String -> SharedImageName

-- | Get the String representation of a <a>SharedImageName</a>.
fromSharedImageName :: SharedImageName -> String

-- | The exact time that build job <b>started</b>. This is a wrapper around
--   a string contains the build date of a <a>SharedImage</a>; this is
--   purely additional convenience and typesafety
newtype SharedImageDate
SharedImageDate :: String -> SharedImageDate

-- | Every B9 build running in a <tt>B9Monad</tt> contains a random unique
--   id that is generated once per build (no matter how many artifacts are
--   created in that build) This field contains the build id of the build
--   that created the shared image instance. This is A wrapper around a
--   string contains the build id of a <a>SharedImage</a>; this is purely
--   additional convenience and typesafety
newtype SharedImageBuildId
SharedImageBuildId :: String -> SharedImageBuildId

-- | Get the String representation of a <a>SharedImageBuildId</a>.
fromSharedImageBuildId :: SharedImageBuildId -> String

-- | Shared images are orderd by name, build date and build id

-- | Return the name of the file corresponding to an <a>Image</a>
imageFileName :: Image -> FilePath

-- | Return the <a>ImageType</a> of an <a>Image</a>
imageImageType :: Image -> ImageType

-- | Return the files generated for a <a>LocalFile</a> or a
--   <a>LiveInstallerImage</a>; <a>SharedImage</a> and <a>Transient</a> are
--   treated like they have no ouput files because the output files are
--   manged by B9.
getImageDestinationOutputFiles :: ImageTarget -> [FilePath]

-- | Return the name of a shared image, if the <a>ImageDestination</a> is a
--   <a>Share</a> destination
imageDestinationSharedImageName :: ImageDestination -> Maybe SharedImageName

-- | Return the name of a shared source image, if the <a>ImageSource</a> is
--   a <a>From</a> source
imageSourceSharedImageName :: ImageSource -> Maybe SharedImageName

-- | Get the <a>ImageDestination</a> of an <a>ImageTarget</a>
itImageDestination :: ImageTarget -> ImageDestination

-- | Get the <a>ImageSource</a> of an <a>ImageTarget</a>
itImageSource :: ImageTarget -> ImageSource

-- | Get the <a>MountPoint</a> of an <a>ImageTarget</a>
itImageMountPoint :: ImageTarget -> MountPoint

-- | Return true if a <a>Partition</a> parameter is actually refering to a
--   partition, false if it is <a>NoPT</a>
isPartitioned :: Partition -> Bool

-- | Return the <a>Partition</a> index or throw a runtime error if aplied
--   to <a>NoPT</a>
getPartition :: Partition -> Int

-- | Return the file name extension of an image file with a specific image
--   format.
imageFileExtension :: ImageType -> String

-- | Change the image file format and also rename the image file name to
--   have the appropriate file name extension. See
--   <a>imageFileExtension</a> and <a>replaceExtension</a>
changeImageFormat :: ImageType -> Image -> Image
changeImageDirectory :: FilePath -> Image -> Image
getImageSourceImageType :: ImageSource -> Maybe ImageType

-- | Return the name of a shared image.
sharedImageName :: SharedImage -> SharedImageName

-- | Return the build date of a shared image.
sharedImageDate :: SharedImage -> SharedImageDate

-- | Return the build id of a shared image.
sharedImageBuildId :: SharedImage -> SharedImageBuildId

-- | Print the contents of the shared image in one line
prettyPrintSharedImages :: [SharedImage] -> String

-- | Return the disk image of an sharedImage
sharedImageImage :: SharedImage -> Image

-- | Calculate the path to the text file holding the serialized
--   <a>SharedImage</a> relative to the directory of shared images in a
--   repository.
sharedImageFileName :: SharedImage -> FilePath
sharedImagesRootDirectory :: FilePath
sharedImageFileExtension :: String

-- | The internal image type to use as best guess when dealing with a
--   <a>From</a> value.
sharedImageDefaultImageType :: ImageType

-- | Use a <a>QCow2</a> image with an <a>Ext4</a> file system
transientCOWImage :: FilePath -> FilePath -> ImageTarget

-- | Use a shared image
transientSharedImage :: SharedImageName -> FilePath -> ImageTarget

-- | Use a shared image
transientLocalImage :: FilePath -> FilePath -> ImageTarget

-- | Share a <a>QCow2</a> image with <a>Ext4</a> fs
shareCOWImage :: FilePath -> SharedImageName -> FilePath -> ImageTarget

-- | Share an image based on a shared image
shareSharedImage :: SharedImageName -> SharedImageName -> FilePath -> ImageTarget

-- | Share a <a>QCow2</a> image with <a>Ext4</a> fs
shareLocalImage :: FilePath -> SharedImageName -> FilePath -> ImageTarget

-- | Export a <a>QCow2</a> image with <a>Ext4</a> fs
cowToliveInstallerImage :: String -> FilePath -> FilePath -> FilePath -> ImageTarget

-- | Export a <a>QCow2</a> image file with <a>Ext4</a> fs as a local file
cowToLocalImage :: FilePath -> FilePath -> FilePath -> ImageTarget

-- | Export a <a>QCow2</a> image file with <a>Ext4</a> fs as a local file
localToLocalImage :: FilePath -> FilePath -> FilePath -> ImageTarget

-- | Create a local image file from the contents of the first partition of
--   a local <a>QCow2</a> image.
partition1ToLocalImage :: FilePath -> FilePath -> FilePath -> ImageTarget

-- | Split any image target into two image targets, one for creating an
--   intermediate shared image and one from the intermediate shared image
--   to the output image.
splitToIntermediateSharedImage :: ImageTarget -> SharedImageName -> (ImageTarget, ImageTarget)
arbitrarySharedImageName :: Gen String
instance GHC.Generics.Generic B9.DiskImages.SharedImage
instance Data.Data.Data B9.DiskImages.SharedImage
instance GHC.Show.Show B9.DiskImages.SharedImage
instance GHC.Read.Read B9.DiskImages.SharedImage
instance GHC.Classes.Eq B9.DiskImages.SharedImage
instance Control.DeepSeq.NFData B9.DiskImages.SharedImageBuildId
instance Data.Binary.Class.Binary B9.DiskImages.SharedImageBuildId
instance Data.Hashable.Class.Hashable B9.DiskImages.SharedImageBuildId
instance Data.Data.Data B9.DiskImages.SharedImageBuildId
instance GHC.Show.Show B9.DiskImages.SharedImageBuildId
instance GHC.Read.Read B9.DiskImages.SharedImageBuildId
instance GHC.Classes.Ord B9.DiskImages.SharedImageBuildId
instance GHC.Classes.Eq B9.DiskImages.SharedImageBuildId
instance Control.DeepSeq.NFData B9.DiskImages.SharedImageDate
instance Data.Binary.Class.Binary B9.DiskImages.SharedImageDate
instance Data.Hashable.Class.Hashable B9.DiskImages.SharedImageDate
instance Data.Data.Data B9.DiskImages.SharedImageDate
instance GHC.Show.Show B9.DiskImages.SharedImageDate
instance GHC.Read.Read B9.DiskImages.SharedImageDate
instance GHC.Classes.Ord B9.DiskImages.SharedImageDate
instance GHC.Classes.Eq B9.DiskImages.SharedImageDate
instance Control.DeepSeq.NFData B9.DiskImages.SharedImageName
instance Data.Binary.Class.Binary B9.DiskImages.SharedImageName
instance Data.Hashable.Class.Hashable B9.DiskImages.SharedImageName
instance Data.Data.Data B9.DiskImages.SharedImageName
instance GHC.Show.Show B9.DiskImages.SharedImageName
instance GHC.Read.Read B9.DiskImages.SharedImageName
instance GHC.Classes.Ord B9.DiskImages.SharedImageName
instance GHC.Classes.Eq B9.DiskImages.SharedImageName
instance GHC.Generics.Generic B9.DiskImages.ImageTarget
instance GHC.Classes.Eq B9.DiskImages.ImageTarget
instance Data.Data.Data B9.DiskImages.ImageTarget
instance GHC.Show.Show B9.DiskImages.ImageTarget
instance GHC.Read.Read B9.DiskImages.ImageTarget
instance GHC.Generics.Generic B9.DiskImages.ImageDestination
instance GHC.Classes.Eq B9.DiskImages.ImageDestination
instance Data.Data.Data B9.DiskImages.ImageDestination
instance GHC.Show.Show B9.DiskImages.ImageDestination
instance GHC.Read.Read B9.DiskImages.ImageDestination
instance GHC.Generics.Generic B9.DiskImages.ImageSource
instance GHC.Classes.Eq B9.DiskImages.ImageSource
instance Data.Data.Data B9.DiskImages.ImageSource
instance GHC.Read.Read B9.DiskImages.ImageSource
instance GHC.Show.Show B9.DiskImages.ImageSource
instance GHC.Generics.Generic B9.DiskImages.ImageResize
instance Data.Data.Data B9.DiskImages.ImageResize
instance GHC.Read.Read B9.DiskImages.ImageResize
instance GHC.Show.Show B9.DiskImages.ImageResize
instance GHC.Classes.Eq B9.DiskImages.ImageResize
instance GHC.Generics.Generic B9.DiskImages.ImageSize
instance Data.Data.Data B9.DiskImages.ImageSize
instance GHC.Read.Read B9.DiskImages.ImageSize
instance GHC.Show.Show B9.DiskImages.ImageSize
instance GHC.Classes.Eq B9.DiskImages.ImageSize
instance GHC.Generics.Generic B9.DiskImages.SizeUnit
instance Data.Data.Data B9.DiskImages.SizeUnit
instance GHC.Classes.Ord B9.DiskImages.SizeUnit
instance GHC.Read.Read B9.DiskImages.SizeUnit
instance GHC.Show.Show B9.DiskImages.SizeUnit
instance GHC.Classes.Eq B9.DiskImages.SizeUnit
instance GHC.Generics.Generic B9.DiskImages.Image
instance Data.Data.Data B9.DiskImages.Image
instance GHC.Read.Read B9.DiskImages.Image
instance GHC.Show.Show B9.DiskImages.Image
instance GHC.Classes.Eq B9.DiskImages.Image
instance GHC.Generics.Generic B9.DiskImages.FileSystem
instance Data.Data.Data B9.DiskImages.FileSystem
instance GHC.Read.Read B9.DiskImages.FileSystem
instance GHC.Show.Show B9.DiskImages.FileSystem
instance GHC.Classes.Eq B9.DiskImages.FileSystem
instance GHC.Generics.Generic B9.DiskImages.ImageType
instance GHC.Show.Show B9.DiskImages.ImageType
instance Data.Data.Data B9.DiskImages.ImageType
instance GHC.Read.Read B9.DiskImages.ImageType
instance GHC.Classes.Eq B9.DiskImages.ImageType
instance GHC.Generics.Generic B9.DiskImages.Partition
instance Data.Data.Data B9.DiskImages.Partition
instance GHC.Read.Read B9.DiskImages.Partition
instance GHC.Show.Show B9.DiskImages.Partition
instance GHC.Classes.Eq B9.DiskImages.Partition
instance GHC.Generics.Generic B9.DiskImages.MountPoint
instance GHC.Classes.Eq B9.DiskImages.MountPoint
instance Data.Data.Data B9.DiskImages.MountPoint
instance GHC.Read.Read B9.DiskImages.MountPoint
instance GHC.Show.Show B9.DiskImages.MountPoint
instance Data.Hashable.Class.Hashable B9.DiskImages.SharedImage
instance Data.Binary.Class.Binary B9.DiskImages.SharedImage
instance Control.DeepSeq.NFData B9.DiskImages.SharedImage
instance GHC.Classes.Ord B9.DiskImages.SharedImage
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.SharedImageName
instance Data.Hashable.Class.Hashable B9.DiskImages.ImageTarget
instance Data.Binary.Class.Binary B9.DiskImages.ImageTarget
instance Control.DeepSeq.NFData B9.DiskImages.ImageTarget
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.ImageTarget
instance Data.Hashable.Class.Hashable B9.DiskImages.ImageDestination
instance Data.Binary.Class.Binary B9.DiskImages.ImageDestination
instance Control.DeepSeq.NFData B9.DiskImages.ImageDestination
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.ImageDestination
instance Data.Hashable.Class.Hashable B9.DiskImages.ImageSource
instance Data.Binary.Class.Binary B9.DiskImages.ImageSource
instance Control.DeepSeq.NFData B9.DiskImages.ImageSource
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.ImageSource
instance Data.Hashable.Class.Hashable B9.DiskImages.ImageResize
instance Data.Binary.Class.Binary B9.DiskImages.ImageResize
instance Control.DeepSeq.NFData B9.DiskImages.ImageResize
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.ImageResize
instance Data.Hashable.Class.Hashable B9.DiskImages.ImageSize
instance Data.Binary.Class.Binary B9.DiskImages.ImageSize
instance Control.DeepSeq.NFData B9.DiskImages.ImageSize
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.ImageSize
instance Data.Hashable.Class.Hashable B9.DiskImages.SizeUnit
instance Data.Binary.Class.Binary B9.DiskImages.SizeUnit
instance Control.DeepSeq.NFData B9.DiskImages.SizeUnit
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.SizeUnit
instance Data.Hashable.Class.Hashable B9.DiskImages.Image
instance Data.Binary.Class.Binary B9.DiskImages.Image
instance Control.DeepSeq.NFData B9.DiskImages.Image
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.Image
instance Data.Hashable.Class.Hashable B9.DiskImages.FileSystem
instance Data.Binary.Class.Binary B9.DiskImages.FileSystem
instance Control.DeepSeq.NFData B9.DiskImages.FileSystem
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.FileSystem
instance Data.Hashable.Class.Hashable B9.DiskImages.ImageType
instance Data.Binary.Class.Binary B9.DiskImages.ImageType
instance Control.DeepSeq.NFData B9.DiskImages.ImageType
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.ImageType
instance Data.Hashable.Class.Hashable B9.DiskImages.Partition
instance Data.Binary.Class.Binary B9.DiskImages.Partition
instance Control.DeepSeq.NFData B9.DiskImages.Partition
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.Partition
instance Data.Hashable.Class.Hashable B9.DiskImages.MountPoint
instance Data.Binary.Class.Binary B9.DiskImages.MountPoint
instance Control.DeepSeq.NFData B9.DiskImages.MountPoint
instance Test.QuickCheck.Arbitrary.Arbitrary B9.DiskImages.MountPoint


-- | Data types describing the execution environment of virtual machine
--   builds. <a>ExecEnv</a>, <a>Resources</a> and <a>SharedDirectory</a>
--   describe how <a>B9.LibVirtLXC</a> should configure and execute build
--   scripts, as defined in <a>B9.ShellScript</a> and <a>B9.Vm</a>.
module B9.ExecEnv
data ExecEnv
ExecEnv :: String -> [Mounted Image] -> [SharedDirectory] -> Resources -> ExecEnv
[envName] :: ExecEnv -> String
[envImageMounts] :: ExecEnv -> [Mounted Image]
[envSharedDirectories] :: ExecEnv -> [SharedDirectory]
[envResources] :: ExecEnv -> Resources
data Resources
Resources :: RamSize -> Int -> CPUArch -> Resources
[maxMemory] :: Resources -> RamSize
[cpuCount] :: Resources -> Int
[cpuArch] :: Resources -> CPUArch
noResources :: Resources
data SharedDirectory
SharedDirectory :: FilePath -> MountPoint -> SharedDirectory
SharedDirectoryRO :: FilePath -> MountPoint -> SharedDirectory
SharedSources :: MountPoint -> SharedDirectory
data CPUArch
X86_64 :: CPUArch
I386 :: CPUArch
data RamSize
RamSize :: Int -> SizeUnit -> RamSize
AutomaticRamSize :: RamSize
instance GHC.Generics.Generic B9.ExecEnv.ExecEnv
instance GHC.Classes.Eq B9.ExecEnv.ExecEnv
instance Data.Data.Data B9.ExecEnv.ExecEnv
instance GHC.Show.Show B9.ExecEnv.ExecEnv
instance GHC.Read.Read B9.ExecEnv.ExecEnv
instance GHC.Generics.Generic B9.ExecEnv.Resources
instance Data.Data.Data B9.ExecEnv.Resources
instance GHC.Show.Show B9.ExecEnv.Resources
instance GHC.Read.Read B9.ExecEnv.Resources
instance GHC.Classes.Eq B9.ExecEnv.Resources
instance GHC.Generics.Generic B9.ExecEnv.RamSize
instance Data.Data.Data B9.ExecEnv.RamSize
instance GHC.Classes.Ord B9.ExecEnv.RamSize
instance GHC.Show.Show B9.ExecEnv.RamSize
instance GHC.Read.Read B9.ExecEnv.RamSize
instance GHC.Classes.Eq B9.ExecEnv.RamSize
instance GHC.Generics.Generic B9.ExecEnv.CPUArch
instance GHC.Classes.Eq B9.ExecEnv.CPUArch
instance Data.Data.Data B9.ExecEnv.CPUArch
instance GHC.Show.Show B9.ExecEnv.CPUArch
instance GHC.Read.Read B9.ExecEnv.CPUArch
instance GHC.Generics.Generic B9.ExecEnv.SharedDirectory
instance GHC.Classes.Eq B9.ExecEnv.SharedDirectory
instance Data.Data.Data B9.ExecEnv.SharedDirectory
instance GHC.Show.Show B9.ExecEnv.SharedDirectory
instance GHC.Read.Read B9.ExecEnv.SharedDirectory
instance Data.Hashable.Class.Hashable B9.ExecEnv.ExecEnv
instance Data.Binary.Class.Binary B9.ExecEnv.ExecEnv
instance Control.DeepSeq.NFData B9.ExecEnv.ExecEnv
instance Data.Hashable.Class.Hashable B9.ExecEnv.Resources
instance Data.Binary.Class.Binary B9.ExecEnv.Resources
instance Control.DeepSeq.NFData B9.ExecEnv.Resources
instance Data.Semigroup.Semigroup B9.ExecEnv.Resources
instance GHC.Base.Monoid B9.ExecEnv.Resources
instance Data.Hashable.Class.Hashable B9.ExecEnv.RamSize
instance Data.Binary.Class.Binary B9.ExecEnv.RamSize
instance Control.DeepSeq.NFData B9.ExecEnv.RamSize
instance Data.Semigroup.Semigroup B9.ExecEnv.RamSize
instance GHC.Base.Monoid B9.ExecEnv.RamSize
instance Data.Hashable.Class.Hashable B9.ExecEnv.CPUArch
instance Data.Binary.Class.Binary B9.ExecEnv.CPUArch
instance Control.DeepSeq.NFData B9.ExecEnv.CPUArch
instance Data.Semigroup.Semigroup B9.ExecEnv.CPUArch
instance GHC.Base.Monoid B9.ExecEnv.CPUArch
instance Data.Hashable.Class.Hashable B9.ExecEnv.SharedDirectory
instance Data.Binary.Class.Binary B9.ExecEnv.SharedDirectory
instance Control.DeepSeq.NFData B9.ExecEnv.SharedDirectory


-- | Erlang term parser and pretty printer.
module B9.Content.ErlTerms

-- | Parse a subset of valid Erlang terms. It parses no maps and binaries
--   are restricted to either empty binaries or binaries with a string. The
--   input encoding must be restricted to ascii compatible 8-bit characters
--   (e.g. latin-1 or UTF8).
parseErlTerm :: String -> ByteString -> Either String SimpleErlangTerm

-- | Convert an abstract Erlang term to a pretty byte string preserving the
--   encoding.
renderErlTerm :: SimpleErlangTerm -> ByteString

-- | Simplified Erlang term representation.
data SimpleErlangTerm
ErlString :: String -> SimpleErlangTerm
ErlFloat :: Double -> SimpleErlangTerm
ErlNatural :: Integer -> SimpleErlangTerm
ErlAtom :: String -> SimpleErlangTerm
ErlChar :: Char -> SimpleErlangTerm
ErlBinary :: String -> SimpleErlangTerm
ErlList :: [SimpleErlangTerm] -> SimpleErlangTerm
ErlTuple :: [SimpleErlangTerm] -> SimpleErlangTerm
arbitraryErlSimpleAtom :: Gen SimpleErlangTerm
arbitraryErlString :: Gen SimpleErlangTerm
arbitraryErlNumber :: Gen SimpleErlangTerm
arbitraryErlNatural :: Gen SimpleErlangTerm
arbitraryErlFloat :: Gen SimpleErlangTerm
arbitraryErlNameChar :: Gen Char
instance GHC.Generics.Generic B9.Content.ErlTerms.SimpleErlangTerm
instance Data.Data.Data B9.Content.ErlTerms.SimpleErlangTerm
instance GHC.Show.Show B9.Content.ErlTerms.SimpleErlangTerm
instance GHC.Read.Read B9.Content.ErlTerms.SimpleErlangTerm
instance GHC.Classes.Ord B9.Content.ErlTerms.SimpleErlangTerm
instance GHC.Classes.Eq B9.Content.ErlTerms.SimpleErlangTerm
instance Data.Hashable.Class.Hashable B9.Content.ErlTerms.SimpleErlangTerm
instance Data.Binary.Class.Binary B9.Content.ErlTerms.SimpleErlangTerm
instance Control.DeepSeq.NFData B9.Content.ErlTerms.SimpleErlangTerm
instance Test.QuickCheck.Arbitrary.Arbitrary B9.Content.ErlTerms.SimpleErlangTerm


-- | Definition of <a>Script</a> and functions to convert <a>Script</a>s to
--   bash scripts.
module B9.ShellScript

-- | Convert <tt>script</tt> to bash-shell-script written to <tt>file</tt>
--   and make <tt>file</tt> executable.
writeSh :: FilePath -> Script -> IO ()
renderScript :: Script -> String

-- | Check if a script has the same effect as <a>NoOP</a>
emptyScript :: Script -> Bool
data CmdVerbosity
Debug :: CmdVerbosity
Verbose :: CmdVerbosity
OnlyStdErr :: CmdVerbosity
Quiet :: CmdVerbosity
data Cwd
Cwd :: FilePath -> Cwd
NoCwd :: Cwd
data User
User :: String -> User
NoUser :: User
data Script
In :: FilePath -> [Script] -> Script
As :: String -> [Script] -> Script
IgnoreErrors :: Bool -> [Script] -> Script
Verbosity :: CmdVerbosity -> [Script] -> Script
Begin :: [Script] -> Script
Run :: FilePath -> [String] -> Script
NoOP :: Script
instance GHC.Generics.Generic B9.ShellScript.Ctx
instance GHC.Classes.Eq B9.ShellScript.Ctx
instance Data.Data.Data B9.ShellScript.Ctx
instance GHC.Read.Read B9.ShellScript.Ctx
instance GHC.Show.Show B9.ShellScript.Ctx
instance GHC.Generics.Generic B9.ShellScript.Cmd
instance GHC.Classes.Eq B9.ShellScript.Cmd
instance Data.Data.Data B9.ShellScript.Cmd
instance GHC.Read.Read B9.ShellScript.Cmd
instance GHC.Show.Show B9.ShellScript.Cmd
instance GHC.Generics.Generic B9.ShellScript.User
instance GHC.Classes.Eq B9.ShellScript.User
instance Data.Data.Data B9.ShellScript.User
instance GHC.Read.Read B9.ShellScript.User
instance GHC.Show.Show B9.ShellScript.User
instance GHC.Generics.Generic B9.ShellScript.Cwd
instance GHC.Classes.Eq B9.ShellScript.Cwd
instance Data.Data.Data B9.ShellScript.Cwd
instance GHC.Read.Read B9.ShellScript.Cwd
instance GHC.Show.Show B9.ShellScript.Cwd
instance GHC.Generics.Generic B9.ShellScript.Script
instance GHC.Classes.Eq B9.ShellScript.Script
instance Data.Data.Data B9.ShellScript.Script
instance GHC.Read.Read B9.ShellScript.Script
instance GHC.Show.Show B9.ShellScript.Script
instance GHC.Generics.Generic B9.ShellScript.CmdVerbosity
instance GHC.Classes.Eq B9.ShellScript.CmdVerbosity
instance Data.Data.Data B9.ShellScript.CmdVerbosity
instance GHC.Read.Read B9.ShellScript.CmdVerbosity
instance GHC.Show.Show B9.ShellScript.CmdVerbosity
instance Data.Hashable.Class.Hashable B9.ShellScript.Ctx
instance Data.Binary.Class.Binary B9.ShellScript.Ctx
instance Control.DeepSeq.NFData B9.ShellScript.Ctx
instance Data.Hashable.Class.Hashable B9.ShellScript.Cmd
instance Data.Binary.Class.Binary B9.ShellScript.Cmd
instance Control.DeepSeq.NFData B9.ShellScript.Cmd
instance Data.Hashable.Class.Hashable B9.ShellScript.User
instance Data.Binary.Class.Binary B9.ShellScript.User
instance Control.DeepSeq.NFData B9.ShellScript.User
instance Data.Hashable.Class.Hashable B9.ShellScript.Cwd
instance Data.Binary.Class.Binary B9.ShellScript.Cwd
instance Control.DeepSeq.NFData B9.ShellScript.Cwd
instance Data.Hashable.Class.Hashable B9.ShellScript.Script
instance Data.Binary.Class.Binary B9.ShellScript.Script
instance Control.DeepSeq.NFData B9.ShellScript.Script
instance Data.Semigroup.Semigroup B9.ShellScript.Script
instance GHC.Base.Monoid B9.ShellScript.Script
instance Data.Hashable.Class.Hashable B9.ShellScript.CmdVerbosity
instance Data.Binary.Class.Binary B9.ShellScript.CmdVerbosity
instance Control.DeepSeq.NFData B9.ShellScript.CmdVerbosity


-- | Some utilities to deal with IO in B9.
module System.IO.B9Extras

-- | A data type encapsulating different kinds of relative or absolute
--   paths.
data SystemPath

-- | A path that will just be passed through
Path :: FilePath -> SystemPath

-- | A OS specific path relative to the home directory of a user.
InHomeDir :: FilePath -> SystemPath

-- | A path relative to the <tt>b9</tt> sub of the users application
--   configuration directory <a>getAppUserDataDirectory</a>
InB9UserDir :: FilePath -> SystemPath

-- | A path relative to the systems temporary directory.
InTempDir :: FilePath -> SystemPath

-- | Convert a <a>SystemPath</a> to a <a>FilePath</a>.
resolve :: MonadIO m => SystemPath -> m FilePath

-- | Create all missing parent directories of a file path. Note that the
--   file path is assumed to be of a regular file, and <a>takeDirectory</a>
--   is applied before creating the directory.
ensureDir :: MonadIO m => FilePath -> m ()

-- | Get all files from <tt>dir</tt> that is get ONLY files not directories
getDirectoryFiles :: MonadIO m => FilePath -> m [FilePath]

-- | Write a value of a type that is an instance of <a>Show</a> to file.
--   This function uses <a>ppShow</a> instead of the given <a>Show</a>
--   instance.
prettyPrintToFile :: (MonadIO m, Show a) => FilePath -> a -> m ()

-- | Read a value of a type that is an instance of <a>Read</a> from a file.
--   This function throws a <a>ConsultException</a> when the read the file
--   failed.
consult :: (MonadIO m, Read a) => FilePath -> m a

-- | An <a>Exception</a> thrown by <a>consult</a> to indicate the file does
--   not contain a <a>read</a>able String
data ConsultException
ConsultException :: FilePath -> String -> ConsultException

-- | Generate a random <a>UUID</a>.
randomUUID :: MonadIO m => m UUID

-- | A bunch of numbers, enough to make globally unique IDs. Create one of
--   these using <a>randomUUID</a>.
data UUID
instance GHC.Classes.Ord System.IO.B9Extras.UUID
instance GHC.Classes.Eq System.IO.B9Extras.UUID
instance GHC.Show.Show System.IO.B9Extras.UUID
instance GHC.Read.Read System.IO.B9Extras.UUID
instance GHC.Show.Show System.IO.B9Extras.ConsultException
instance Data.Data.Data System.IO.B9Extras.SystemPath
instance GHC.Show.Show System.IO.B9Extras.SystemPath
instance GHC.Read.Read System.IO.B9Extras.SystemPath
instance GHC.Classes.Eq System.IO.B9Extras.SystemPath
instance Text.Printf.PrintfArg System.IO.B9Extras.UUID
instance GHC.Exception.Exception System.IO.B9Extras.ConsultException


-- | Extensions to <a>ConfigFile</a> and utility functions for dealing with
--   configuration in general and reading/writing files.
module Data.ConfigFile.B9Extras

-- | An alias for <a>add_section</a>.
addSectionCP :: MonadError CPError m => CPDocument -> CPSectionSpec -> m CPDocument

-- | An alias for <a>setshow</a>.
setShowCP :: (Show a, MonadError CPError m) => CPDocument -> CPSectionSpec -> CPOptionSpec -> a -> m CPDocument

-- | An alias for <a>set</a>.
setCP :: (MonadError CPError m) => CPDocument -> CPSectionSpec -> CPOptionSpec -> String -> m CPDocument

-- | An alias for <a>get</a>.
readCP :: (CPGet a, MonadError CPError m) => CPDocument -> CPSectionSpec -> CPOptionSpec -> m a

-- | An alias for <a>merge</a>.
mergeCP :: CPDocument -> CPDocument -> CPDocument

-- | An alias for <a>to_string</a>
toStringCP :: CPDocument -> String

-- | An alias for <a>sections</a>.
sectionsCP :: CPDocument -> [SectionSpec]

-- | The default empty <a>ConfigFile</a> object.
--   
--   The content contains only an empty mandatory <tt>DEFAULT</tt> section.
--   
--   <a>optionxform</a> is set to <tt>map toLower</tt>.
--   
--   <a>usedefault</a> is set to <tt>True</tt>.
--   
--   <a>accessfunc</a> is set to <a>simpleAccess</a>.
emptyCP :: ConfigParser

-- | An alias for <a>Get_C</a>
type CPGet a = Get_C a

-- | An alias for <a>OptionSpec</a>
type CPOptionSpec = OptionSpec

-- | An alias for <a>SectionSpec</a>.
type CPSectionSpec = SectionSpec

-- | An alias for <a>ConfigParser</a>
type CPDocument = ConfigParser

-- | Indicates an error occurred. The String is an explanation of the
--   location of the error.
type CPError = (CPErrorData, String)

-- | Read a file and try to parse the contents as a <a>CPDocument</a>, if
--   something goes wrong throw a <a>CPReadException</a>
readCPDocument :: MonadIO m => SystemPath -> m CPDocument

-- | An exception thrown by <a>readCPDocument</a>.
data CPReadException
CPReadException :: FilePath -> CPError -> CPReadException
instance GHC.Show.Show Data.ConfigFile.B9Extras.CPReadException
instance GHC.Exception.Exception Data.ConfigFile.B9Extras.CPReadException

module B9.B9Config.Repository
data RemoteRepo
RemoteRepo :: String -> FilePath -> SshPrivKey -> SshRemoteHost -> SshRemoteUser -> RemoteRepo
remoteRepoRepoId :: RemoteRepo -> String
newtype RepoCache
RepoCache :: FilePath -> RepoCache
newtype SshPrivKey
SshPrivKey :: FilePath -> SshPrivKey
newtype SshRemoteHost
SshRemoteHost :: (String, Int) -> SshRemoteHost
newtype SshRemoteUser
SshRemoteUser :: String -> SshRemoteUser

-- | Persist a repo to a configuration file.
remoteRepoToCPDocument :: RemoteRepo -> CPDocument -> Either CPError CPDocument

-- | Load a repository from a configuration file that has been written by
--   <tt>writeRepositoryToB9Config</tt>.
parseRemoteRepos :: CPDocument -> Either CPError [RemoteRepo]
instance Data.Data.Data B9.B9Config.Repository.RemoteRepo
instance GHC.Show.Show B9.B9Config.Repository.RemoteRepo
instance GHC.Read.Read B9.B9Config.Repository.RemoteRepo
instance Data.Data.Data B9.B9Config.Repository.SshRemoteUser
instance GHC.Show.Show B9.B9Config.Repository.SshRemoteUser
instance GHC.Read.Read B9.B9Config.Repository.SshRemoteUser
instance Data.Data.Data B9.B9Config.Repository.SshRemoteHost
instance GHC.Show.Show B9.B9Config.Repository.SshRemoteHost
instance GHC.Read.Read B9.B9Config.Repository.SshRemoteHost
instance Data.Data.Data B9.B9Config.Repository.SshPrivKey
instance GHC.Show.Show B9.B9Config.Repository.SshPrivKey
instance GHC.Read.Read B9.B9Config.Repository.SshPrivKey
instance Data.Data.Data B9.B9Config.Repository.RepoCache
instance GHC.Show.Show B9.B9Config.Repository.RepoCache
instance GHC.Read.Read B9.B9Config.Repository.RepoCache

module B9.B9Config.LibVirtLXC
libVirtLXCConfigToCPDocument :: LibVirtLXCConfig -> CPDocument -> Either CPError CPDocument
defaultLibVirtLXCConfig :: LibVirtLXCConfig
parseLibVirtLXCConfig :: CPDocument -> Either CPError LibVirtLXCConfig
data LibVirtLXCConfig
LibVirtLXCConfig :: Bool -> FilePath -> FilePath -> FilePath -> Maybe String -> [LXCGuestCapability] -> RamSize -> LibVirtLXCConfig
[useSudo] :: LibVirtLXCConfig -> Bool
[virshPath] :: LibVirtLXCConfig -> FilePath
[emulator] :: LibVirtLXCConfig -> FilePath
[virshURI] :: LibVirtLXCConfig -> FilePath
[networkId] :: LibVirtLXCConfig -> Maybe String
[guestCapabilities] :: LibVirtLXCConfig -> [LXCGuestCapability]
[guestRamSize] :: LibVirtLXCConfig -> RamSize

-- | Available linux capabilities for lxc containers. This maps directly to
--   the capabilities defined in 'man 7 capabilities'.
data LXCGuestCapability
CAP_MKNOD :: LXCGuestCapability
CAP_AUDIT_CONTROL :: LXCGuestCapability
CAP_AUDIT_READ :: LXCGuestCapability
CAP_AUDIT_WRITE :: LXCGuestCapability
CAP_BLOCK_SUSPEND :: LXCGuestCapability
CAP_CHOWN :: LXCGuestCapability
CAP_DAC_OVERRIDE :: LXCGuestCapability
CAP_DAC_READ_SEARCH :: LXCGuestCapability
CAP_FOWNER :: LXCGuestCapability
CAP_FSETID :: LXCGuestCapability
CAP_IPC_LOCK :: LXCGuestCapability
CAP_IPC_OWNER :: LXCGuestCapability
CAP_KILL :: LXCGuestCapability
CAP_LEASE :: LXCGuestCapability
CAP_LINUX_IMMUTABLE :: LXCGuestCapability
CAP_MAC_ADMIN :: LXCGuestCapability
CAP_MAC_OVERRIDE :: LXCGuestCapability
CAP_NET_ADMIN :: LXCGuestCapability
CAP_NET_BIND_SERVICE :: LXCGuestCapability
CAP_NET_BROADCAST :: LXCGuestCapability
CAP_NET_RAW :: LXCGuestCapability
CAP_SETGID :: LXCGuestCapability
CAP_SETFCAP :: LXCGuestCapability
CAP_SETPCAP :: LXCGuestCapability
CAP_SETUID :: LXCGuestCapability
CAP_SYS_ADMIN :: LXCGuestCapability
CAP_SYS_BOOT :: LXCGuestCapability
CAP_SYS_CHROOT :: LXCGuestCapability
CAP_SYS_MODULE :: LXCGuestCapability
CAP_SYS_NICE :: LXCGuestCapability
CAP_SYS_PACCT :: LXCGuestCapability
CAP_SYS_PTRACE :: LXCGuestCapability
CAP_SYS_RAWIO :: LXCGuestCapability
CAP_SYS_RESOURCE :: LXCGuestCapability
CAP_SYS_TIME :: LXCGuestCapability
CAP_SYS_TTY_CONFIG :: LXCGuestCapability
CAP_SYSLOG :: LXCGuestCapability
CAP_WAKE_ALARM :: LXCGuestCapability
instance GHC.Show.Show B9.B9Config.LibVirtLXC.LibVirtLXCConfig
instance GHC.Read.Read B9.B9Config.LibVirtLXC.LibVirtLXCConfig
instance GHC.Show.Show B9.B9Config.LibVirtLXC.LXCGuestCapability
instance GHC.Read.Read B9.B9Config.LibVirtLXC.LXCGuestCapability


-- | B9 has a concept of <a>SharedImaged</a>. Shared images can be pulled
--   and pushed to/from remote locations via rsync+ssh. B9 also maintains a
--   local cache; the whole thing is supposed to be build-server-safe, that
--   means no two builds shall interfere with each other. This is
--   accomplished by refraining from automatic cache updates from/to remote
--   repositories.
module B9.Repository

-- | Initialize the local repository cache directory.
initRepoCache :: MonadIO m => SystemPath -> m RepoCache

-- | Initialize the repository; load the corresponding settings from the
--   config file, check that the priv key exists and create the
--   correspondig cache directory.
initRemoteRepo :: MonadIO m => RepoCache -> RemoteRepo -> m RemoteRepo

-- | Empty the repository; load the corresponding settings from the config
--   file, check that the priv key exists and create the correspondig cache
--   directory.
cleanRemoteRepo :: MonadIO m => RepoCache -> RemoteRepo -> m ()

-- | Check for existance of priv-key and make it an absolute path.
remoteRepoCheckSshPrivKey :: MonadIO m => RemoteRepo -> m RemoteRepo

-- | Return the cache directory for a remote repository relative to the
--   root cache dir.
remoteRepoCacheDir :: RepoCache -> String -> FilePath

-- | Return the local repository directory.
localRepoDir :: RepoCache -> FilePath

-- | Select the first <a>RemoteRepo</a> with a given <tt>repoId</tt>.
lookupRemoteRepo :: [RemoteRepo] -> String -> Maybe RemoteRepo


-- | Utility functions based on <a>Template</a> to offer <tt> $var </tt>
--   variable expansion in string throughout a B9 artifact.
module B9.Content.StringTemplate
subst :: [(String, String)] -> String -> String
substE :: [(String, String)] -> String -> Either String String
substEB :: [(String, String)] -> ByteString -> Either String ByteString
substFile :: MonadIO m => [(String, String)] -> FilePath -> FilePath -> m ()
substPath :: [(String, String)] -> SystemPath -> SystemPath
readTemplateFile :: (MonadIO m, MonadReader Environment m) => SourceFile -> m ByteString

-- | A wrapper around a file path and a flag indicating if template
--   variable expansion should be performed when reading the file contents.
data SourceFile
Source :: SourceFileConversion -> FilePath -> SourceFile
data SourceFileConversion
NoConversion :: SourceFileConversion
ExpandVariables :: SourceFileConversion
newtype Environment
Environment :: [(String, String)] -> Environment
withEnvironment :: [(String, String)] -> ReaderT Environment m a -> m a
instance Data.Binary.Class.Binary B9.Content.StringTemplate.Environment
instance Data.Hashable.Class.Hashable B9.Content.StringTemplate.Environment
instance Control.DeepSeq.NFData B9.Content.StringTemplate.Environment
instance GHC.Classes.Eq B9.Content.StringTemplate.Environment
instance Data.Data.Data B9.Content.StringTemplate.Environment
instance GHC.Show.Show B9.Content.StringTemplate.Environment
instance GHC.Read.Read B9.Content.StringTemplate.Environment
instance GHC.Generics.Generic B9.Content.StringTemplate.SourceFile
instance GHC.Classes.Eq B9.Content.StringTemplate.SourceFile
instance Data.Data.Data B9.Content.StringTemplate.SourceFile
instance GHC.Show.Show B9.Content.StringTemplate.SourceFile
instance GHC.Read.Read B9.Content.StringTemplate.SourceFile
instance GHC.Generics.Generic B9.Content.StringTemplate.SourceFileConversion
instance GHC.Classes.Eq B9.Content.StringTemplate.SourceFileConversion
instance Data.Data.Data B9.Content.StringTemplate.SourceFileConversion
instance GHC.Show.Show B9.Content.StringTemplate.SourceFileConversion
instance GHC.Read.Read B9.Content.StringTemplate.SourceFileConversion
instance Data.Hashable.Class.Hashable B9.Content.StringTemplate.SourceFile
instance Data.Binary.Class.Binary B9.Content.StringTemplate.SourceFile
instance Control.DeepSeq.NFData B9.Content.StringTemplate.SourceFile
instance Test.QuickCheck.Arbitrary.Arbitrary B9.Content.StringTemplate.SourceFile
instance Data.Hashable.Class.Hashable B9.Content.StringTemplate.SourceFileConversion
instance Data.Binary.Class.Binary B9.Content.StringTemplate.SourceFileConversion
instance Control.DeepSeq.NFData B9.Content.StringTemplate.SourceFileConversion


-- | Definition of <a>VmScript</a> an artifact encapsulating several
--   virtual machines disk images that can be mounted in an execution
--   environment like <a>B9.LibVirtLXC</a>. A <a>VmScript</a> is embedded
--   by in an <a>ArtifactGenerator</a>.
module B9.Vm

-- | Describe a virtual machine, i.e. a set up disk images to create and a
--   shell script to put things together.
data VmScript
VmScript :: CPUArch -> [SharedDirectory] -> Script -> VmScript
NoVmScript :: VmScript
substVmScript :: [(String, String)] -> VmScript -> VmScript
instance GHC.Generics.Generic B9.Vm.VmScript
instance GHC.Classes.Eq B9.Vm.VmScript
instance Data.Data.Data B9.Vm.VmScript
instance GHC.Show.Show B9.Vm.VmScript
instance GHC.Read.Read B9.Vm.VmScript
instance Data.Hashable.Class.Hashable B9.Vm.VmScript
instance Data.Binary.Class.Binary B9.Vm.VmScript
instance Control.DeepSeq.NFData B9.Vm.VmScript


-- | Static B9 configuration. Read, write and merge configurable
--   properties. The properties are independent of specific build targets.
module B9.B9Config
data B9Config
B9Config :: Maybe LogLevel -> Maybe FilePath -> Maybe FilePath -> Bool -> ExecEnvType -> Maybe FilePath -> BuildVariables -> Bool -> Maybe SystemPath -> Maybe String -> Bool -> Maybe Int -> Maybe LibVirtLXCConfig -> [RemoteRepo] -> B9Config
[_verbosity] :: B9Config -> Maybe LogLevel
[_logFile] :: B9Config -> Maybe FilePath
[_buildDirRoot] :: B9Config -> Maybe FilePath
[_keepTempDirs] :: B9Config -> Bool
[_execEnvType] :: B9Config -> ExecEnvType
[_profileFile] :: B9Config -> Maybe FilePath
[_envVars] :: B9Config -> BuildVariables
[_uniqueBuildDirs] :: B9Config -> Bool
[_repositoryCache] :: B9Config -> Maybe SystemPath
[_repository] :: B9Config -> Maybe String
[_interactive] :: B9Config -> Bool
[_maxLocalSharedImageRevisions] :: B9Config -> Maybe Int
[_libVirtLXCConfigs] :: B9Config -> Maybe LibVirtLXCConfig
[_remoteRepos] :: B9Config -> [RemoteRepo]
verbosity :: Lens' B9Config (Maybe LogLevel)
logFile :: Lens' B9Config (Maybe FilePath)
buildDirRoot :: Lens' B9Config (Maybe FilePath)
keepTempDirs :: Lens' B9Config Bool
execEnvType :: Lens' B9Config ExecEnvType
profileFile :: Lens' B9Config (Maybe FilePath)
envVars :: Lens' B9Config BuildVariables
uniqueBuildDirs :: Lens' B9Config Bool
repositoryCache :: Lens' B9Config (Maybe SystemPath)
repository :: Lens' B9Config (Maybe String)
interactive :: Lens' B9Config Bool
libVirtLXCConfigs :: Lens' B9Config (Maybe LibVirtLXCConfig)
remoteRepos :: Lens' B9Config [RemoteRepo]
maxLocalSharedImageRevisions :: Lens' B9Config (Maybe Int)

-- | Override b9 configuration items and/or the path of the b9
--   configuration file. This is useful, i.e. when dealing with command
--   line parameters.
data B9ConfigOverride
B9ConfigOverride :: Maybe SystemPath -> B9Config -> B9ConfigOverride
[_customB9ConfigPath] :: B9ConfigOverride -> Maybe SystemPath
[_customB9Config] :: B9ConfigOverride -> B9Config

-- | An empty default <a>B9ConfigOverride</a> value, that will neither
--   apply any additional <a>B9Config</a> nor change the path of the
--   configuration file.
noB9ConfigOverride :: B9ConfigOverride

-- | A monad that gives access to the (transient) <a>B9Config</a> to be
--   used to _runtime_ with <a>askRuntimeConfig</a> or
--   <a>localRuntimeConfig</a>, and that allows to write permanent
--   <a>B9Config</a> changes back to the configuration file using
--   <a>modifyPermanentConfig</a>. Execute a <a>B9ConfigAction</a> by
--   invoking either <a>invokeB9</a> (which is simple) or
--   <a>execB9ConfigAction</a>.
data B9ConfigAction m a

-- | Execute a <a>B9ConfigAction</a>. It will take a
--   <a>B9ConfigOverride</a> as input. The <a>B9Config</a> in that value is
--   treated as the _runtime_ configuration, and the
--   <tt>_customConfigPath</tt> is used as the alternative location of the
--   configuration file. The configuration file is read from either the
--   path in <a>_customB9ConfigPath</a> or from <a>defaultB9ConfigFile</a>.
--   Every modification done via <a>modifyPermanentConfig</a> is applied to
--   the **contents** of the configuration file and written back to that
--   file, note that these changes are ONLY reflected in the configuration
--   file and **not** in the _runtime configuration_.
--   
--   See also <a>invokeB9</a>, which does not need the
--   <a>B9ConfigOverride</a> parameter.
execB9ConfigAction :: MonadIO m => B9ConfigAction m a -> B9ConfigOverride -> m a

-- | Run a <a>B9ConfigAction</a> using <a>noB9ConfigOverride</a>. See
--   <a>execB9ConfigAction</a> for more details.
invokeB9 :: MonadIO m => B9ConfigAction m a -> m a

-- | Return the runtime configuration, that should be the configuration
--   merged from all configuration sources. This is the configuration to be
--   used during a VM image build.
askRuntimeConfig :: Monad m => B9ConfigAction m B9Config

-- | Run an action with an updated runtime configuration.
localRuntimeConfig :: Monad m => (B9Config -> B9Config) -> B9ConfigAction m a -> B9ConfigAction m a

-- | Add a modification to the permanent configuration file.
modifyPermanentConfig :: Monad m => Endo B9Config -> B9ConfigAction m ()
customB9Config :: Lens' B9ConfigOverride B9Config
customB9ConfigPath :: Lens' B9ConfigOverride (Maybe SystemPath)

-- | Convenience utility to override the B9 configuration file path.
overrideB9ConfigPath :: SystemPath -> B9ConfigOverride -> B9ConfigOverride

-- | Modify the runtime configuration.
overrideB9Config :: (B9Config -> B9Config) -> B9ConfigOverride -> B9ConfigOverride

-- | Define the current working directory to be used when building.
overrideWorkingDirectory :: FilePath -> B9ConfigOverride -> B9ConfigOverride

-- | Overwrite the <a>verbosity</a> settings in the configuration with
--   those given.
overrideVerbosity :: LogLevel -> B9ConfigOverride -> B9ConfigOverride

-- | Overwrite the <a>keepTempDirs</a> flag in the configuration with those
--   given.
overrideKeepBuildDirs :: Bool -> B9ConfigOverride -> B9ConfigOverride
defaultB9ConfigFile :: SystemPath
defaultRepositoryCache :: SystemPath
defaultB9Config :: B9Config

-- | Open the configuration file that contains the <a>B9Config</a>. If the
--   configuration does not exist, write a default configuration file, and
--   create a all missing directories.
openOrCreateB9Config :: MonadIO m => Maybe SystemPath -> m CPDocument

-- | Write the configuration in the <a>CPDocument</a> to either the user
--   supplied configuration file path or to <a>defaultB9ConfigFile</a>.
--   Create all missing (parent) directories.
writeB9CPDocument :: MonadIO m => Maybe SystemPath -> CPDocument -> m ()
readB9Config :: MonadIO m => Maybe SystemPath -> m CPDocument
parseB9Config :: CPDocument -> Either CPError B9Config

-- | If environment variables <tt>arg_1 .. arg_n</tt> are bound and a list
--   of <tt>k</tt> additional values are passed to this function, store
--   them with keys <tt>arg_(n+1) .. arg_(n+k)</tt>.
appendPositionalArguments :: [String] -> B9Config -> B9Config

-- | Parse a <a>B9Config</a>, modify it, and merge it back to the given
--   <a>CPDocument</a>.
modifyCPDocument :: CPDocument -> Endo B9Config -> Either CPError CPDocument

-- | Append a config file section for the <a>B9Config</a> to an empty
--   <a>CPDocument</a>.
b9ConfigToCPDocument :: B9Config -> Either CPError CPDocument
data LogLevel
LogTrace :: LogLevel
LogDebug :: LogLevel
LogInfo :: LogLevel
LogError :: LogLevel
LogNothing :: LogLevel
data ExecEnvType
LibVirtLXC :: ExecEnvType
type BuildVariables = [(String, String)]
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (B9.B9Config.B9ConfigAction m)
instance GHC.Base.Monad m => GHC.Base.Monad (B9.B9Config.B9ConfigAction m)
instance GHC.Base.Applicative m => GHC.Base.Applicative (B9.B9Config.B9ConfigAction m)
instance GHC.Base.Functor m => GHC.Base.Functor (B9.B9Config.B9ConfigAction m)
instance GHC.Show.Show B9.B9Config.B9ConfigOverride
instance GHC.Show.Show B9.B9Config.B9Config
instance GHC.Read.Read B9.B9Config.LogLevel
instance GHC.Classes.Ord B9.B9Config.LogLevel
instance GHC.Show.Show B9.B9Config.LogLevel
instance GHC.Classes.Eq B9.B9Config.LogLevel
instance GHC.Read.Read B9.B9Config.ExecEnvType
instance GHC.Classes.Ord B9.B9Config.ExecEnvType
instance GHC.Show.Show B9.B9Config.ExecEnvType
instance GHC.Classes.Eq B9.B9Config.ExecEnvType
instance Data.Semigroup.Semigroup B9.B9Config.B9Config
instance GHC.Base.Monoid B9.B9Config.B9Config


-- | Definition of the B9 monad. It encapsulates logging, very basic
--   command execution profiling, a reader for the <a>B9.B9Config</a> and
--   access to the current build id, the current build directory and the
--   artifact to build.
--   
--   This module is used by the _effectful_ functions in this library.
module B9.B9Monad
data B9 a
run :: MonadIO m => B9 a -> B9ConfigAction m a
traceL :: String -> B9 ()
dbgL :: String -> B9 ()
infoL :: String -> B9 ()
errorL :: String -> B9 ()
errorExitL :: String -> B9 a
getConfig :: B9 B9Config
getBuildId :: B9 String
getBuildDate :: B9 String
getBuildDir :: B9 FilePath
getExecEnvType :: B9 ExecEnvType
getSelectedRemoteRepo :: B9 (Maybe RemoteRepo)
getRemoteRepos :: B9 [RemoteRepo]
getRepoCache :: B9 RepoCache
cmd :: String -> B9 ()
instance Control.Monad.State.Class.MonadState B9.B9Monad.BuildState B9.B9Monad.B9
instance GHC.Base.Monad B9.B9Monad.B9
instance GHC.Base.Applicative B9.B9Monad.B9
instance GHC.Base.Functor B9.B9Monad.B9
instance GHC.Show.Show B9.B9Monad.ProfilingEntry
instance GHC.Classes.Eq B9.B9Monad.ProfilingEntry
instance Control.Monad.IO.Class.MonadIO B9.B9Monad.B9


-- | Effectful functions executing shared image respository operations. See
--   <a>B9.Repository</a>
module B9.RepositoryIO

-- | Find files which are in <tt>subDir</tt> and match <tt>glob</tt> in the
--   repository cache. NOTE: This operates on the repository cache, but
--   does not enforce a repository cache update.
repoSearch :: FilePath -> FilePathGlob -> B9 [(Repository, [FilePath])]

-- | Push a file from the cache to a remote repository
pushToRepo :: RemoteRepo -> FilePath -> FilePath -> B9 ()

-- | Pull a file from a remote repository to cache
pullFromRepo :: RemoteRepo -> FilePath -> FilePath -> B9 ()

-- | Push a file from the cache to a remote repository
pullGlob :: FilePath -> FilePathGlob -> RemoteRepo -> B9 ()
data Repository
Cache :: Repository
Remote :: String -> Repository

-- | Convert a <a>RemoteRepo</a> down to a mere <a>Repository</a>
toRemoteRepository :: RemoteRepo -> Repository

-- | Express a pattern for file paths, used when searching repositories.
data FilePathGlob
FileExtension :: String -> FilePathGlob
instance GHC.Show.Show B9.RepositoryIO.Repository
instance GHC.Read.Read B9.RepositoryIO.Repository
instance GHC.Classes.Ord B9.RepositoryIO.Repository
instance GHC.Classes.Eq B9.RepositoryIO.Repository


-- | Implementation of an execution environment that uses "libvirt-lxc".
module B9.LibVirtLXC
runInEnvironment :: ExecEnv -> Script -> B9 Bool
supportedImageTypes :: [ImageType]
logLibVirtLXCConfig :: LibVirtLXCConfig -> B9 ()


-- | Effectful functions that create and convert disk image files.
module B9.DiskImageBuilder

-- | Create an image from an image source. The destination image must have
--   a compatible image type and filesystem. The directory of the image
--   MUST be present and the image file itself MUST NOT alredy exist.
materializeImageSource :: ImageSource -> Image -> B9 ()

-- | Replace $... variables inside an <a>ImageTarget</a>
substImageTarget :: [(String, String)] -> ImageTarget -> ImageTarget

-- | Return all valid image types sorted by preference.
preferredDestImageTypes :: ImageSource -> B9 [ImageType]

-- | Return all supported source <a>ImageType</a>s compatible to a
--   <tt>ImageDestinaion</tt> in the preferred order.
preferredSourceImageTypes :: ImageDestination -> [ImageType]

-- | Resolve an ImageSource to an <a>Image</a>. The ImageSource might not
--   exist, as is the case for <a>EmptyImage</a>.
resolveImageSource :: ImageSource -> B9 Image

-- | Convert some <a>Image</a>, e.g. a temporary image used during the
--   build phase to the final destination.
createDestinationImage :: Image -> ImageDestination -> B9 ()

-- | Resize an image, including the file system inside the image.
resizeImage :: ImageResize -> Image -> B9 ()

-- | Import a disk image from some external source into the build directory
--   if necessary convert the image.
importImage :: Image -> Image -> B9 ()

-- | Export a disk image from the build directory; if necessary convert the
--   image.
exportImage :: Image -> Image -> B9 ()

-- | Export a disk image from the build directory; if necessary convert the
--   image.
exportAndRemoveImage :: Image -> Image -> B9 ()

-- | Convert an image in the build directory to another format and return
--   the new image.
convertImage :: Image -> Image -> B9 ()

-- | Publish an sharedImage made from an image and image meta data to the
--   configured repository
shareImage :: Image -> SharedImageName -> B9 SharedImage

-- | Create the parent directories for the file that contains the
--   <a>Image</a>. If the path to the image file is relative, prepend
--   <a>_buildDirRoot</a> from the <a>B9Config</a>.
ensureAbsoluteImageDirExists :: Image -> B9 Image

-- | Publish the latest version of a shared image identified by name to the
--   selected repository from the cache.
pushSharedImageLatestVersion :: SharedImageName -> B9 ()

-- | Find shared images and the associated repos from two predicates. The
--   result is the concatenated result of the sorted shared images
--   satisfying <tt>imgPred</tt>.
lookupSharedImages :: (Repository -> Bool) -> (SharedImage -> Bool) -> B9 [(Repository, SharedImage)]

-- | Return a list of all existing sharedImages from cached repositories.
getSharedImages :: B9 [(Repository, [SharedImage])]

-- | Return the path to the sub directory in the cache that contains files
--   of shared images.
getSharedImagesCacheDir :: B9 FilePath

-- | Return either all remote repos or just the single selected repo.
getSelectedRepos :: B9 [RemoteRepo]

-- | Pull metadata files from all remote repositories.
pullRemoteRepos :: B9 ()

-- | Pull the latest version of an image, either from the selected remote
--   repo or from the repo that has the latest version.
pullLatestImage :: SharedImageName -> B9 (Maybe SharedImageBuildId)


-- | B9 produces not only VM-Images but also text documents such as
--   configuration files required by virtual machines. This module is about
--   creating and merging files containing parsable syntactic structures,
--   such as most configuration files do.
--   
--   Imagine you would want to create a cloud-init 'user-data' file from a
--   set of 'user-data' snippets which each are valid 'user-data' files in
--   yaml syntax and e.g. a <tt>write_files</tt> section. Now the goal is,
--   for b9 to be able to merge these snippets into one, such that all
--   writefiles sections are combined into a single writefile section.
--   Another example is OTP/Erlang sys.config files. This type class is the
--   greatest commonon denominator of types describing a syntax that can be
--   parsed, concatenated e.g. like in the above example and rendered. The
--   actual concatenation operation is the append from Monoid, i.e. like
--   monoid but without the need for an empty element.
module B9.Content.AST

-- | Types of values that can be parsed<i>rendered from</i>to
--   <tt>ByteString</tt>s. This class is used as basis for the
--   <a>ASTish</a> class.
class (Semigroup a) => ConcatableSyntax a
decodeSyntax :: ConcatableSyntax a => FilePath -> ByteString -> Either String a
encodeSyntax :: ConcatableSyntax a => a -> ByteString

-- | Types of values that describe content, that can be created from an
--   <a>AST</a>.
class (ConcatableSyntax a) => ASTish a
fromAST :: (ASTish a, (CanRender c)) => AST c a -> ReaderT Environment B9 a

-- | Describe how to create structured content that has a tree-like
--   syntactic structure, e.g. yaml, JSON and erlang-proplists. The first
--   parameter defines a <i>context</i> into which the <a>AST</a> is
--   embeded, e.g. B9.Content.Generator.Content'. The second parameter
--   defines a specifix syntax, e.g <a>ErlangPropList</a> that the
--   <a>AST</a> value generates.
data AST c a

-- | Create an object similar to a Json object.
ASTObj :: [(String, AST c a)] -> AST c a

-- | An array.
ASTArr :: [AST c a] -> AST c a

-- | Merge the nested elements, this is a very powerful tool that allows to
--   combine
ASTMerge :: [AST c a] -> AST c a
ASTEmbed :: c -> AST c a
ASTString :: String -> AST c a
ASTParse :: SourceFile -> AST c a
AST :: a -> AST c a

-- | Types of values that can be <i>rendered</i> into a <tt>ByteString</tt>
class CanRender c
render :: CanRender c => c -> ReaderT Environment B9 ByteString
instance GHC.Generics.Generic (B9.Content.AST.AST c a)
instance (GHC.Classes.Eq a, GHC.Classes.Eq c) => GHC.Classes.Eq (B9.Content.AST.AST c a)
instance (Data.Data.Data a, Data.Data.Data c) => Data.Data.Data (B9.Content.AST.AST c a)
instance (GHC.Show.Show a, GHC.Show.Show c) => GHC.Show.Show (B9.Content.AST.AST c a)
instance (GHC.Read.Read a, GHC.Read.Read c) => GHC.Read.Read (B9.Content.AST.AST c a)
instance (Data.Hashable.Class.Hashable c, Data.Hashable.Class.Hashable a) => Data.Hashable.Class.Hashable (B9.Content.AST.AST c a)
instance (Data.Binary.Class.Binary c, Data.Binary.Class.Binary a) => Data.Binary.Class.Binary (B9.Content.AST.AST c a)
instance (Control.DeepSeq.NFData c, Control.DeepSeq.NFData a) => Control.DeepSeq.NFData (B9.Content.AST.AST c a)
instance (Test.QuickCheck.Arbitrary.Arbitrary c, Test.QuickCheck.Arbitrary.Arbitrary a) => Test.QuickCheck.Arbitrary.Arbitrary (B9.Content.AST.AST c a)
instance B9.Content.AST.ConcatableSyntax Data.ByteString.Internal.ByteString


-- | A wrapper around erlang and yaml syntax with a proplist-like behaviour
--   in the ConcatableSyntax instances
module B9.Content.YamlObject

-- | A wrapper type around yaml values with a Semigroup instance useful for
--   combining yaml documents describing system configuration like e.g.
--   user-data.
data YamlObject
YamlObject :: Value -> YamlObject
[_fromYamlObject] :: YamlObject -> Value
instance GHC.Generics.Generic B9.Content.YamlObject.YamlObject
instance Data.Data.Data B9.Content.YamlObject.YamlObject
instance GHC.Classes.Eq B9.Content.YamlObject.YamlObject
instance Data.Hashable.Class.Hashable B9.Content.YamlObject.YamlObject
instance Control.DeepSeq.NFData B9.Content.YamlObject.YamlObject
instance Data.Binary.Class.Binary B9.Content.YamlObject.YamlObject
instance GHC.Read.Read B9.Content.YamlObject.YamlObject
instance GHC.Show.Show B9.Content.YamlObject.YamlObject
instance Data.Semigroup.Semigroup B9.Content.YamlObject.YamlObject
instance B9.Content.AST.ConcatableSyntax B9.Content.YamlObject.YamlObject
instance B9.Content.AST.ASTish B9.Content.YamlObject.YamlObject
instance Test.QuickCheck.Arbitrary.Arbitrary B9.Content.YamlObject.YamlObject


-- | A wrapper around erlang and yaml syntax with a proplist-like behaviour
--   in the ConcatableSyntax instances
module B9.Content.ErlangPropList

-- | A wrapper type around erlang terms with a Semigroup instance useful
--   for combining sys.config files with OTP-application configurations in
--   a list of the form of a proplist.
data ErlangPropList
ErlangPropList :: SimpleErlangTerm -> ErlangPropList
instance GHC.Generics.Generic B9.Content.ErlangPropList.ErlangPropList
instance Data.Data.Data B9.Content.ErlangPropList.ErlangPropList
instance GHC.Show.Show B9.Content.ErlangPropList.ErlangPropList
instance GHC.Classes.Eq B9.Content.ErlangPropList.ErlangPropList
instance GHC.Read.Read B9.Content.ErlangPropList.ErlangPropList
instance Data.Hashable.Class.Hashable B9.Content.ErlangPropList.ErlangPropList
instance Data.Binary.Class.Binary B9.Content.ErlangPropList.ErlangPropList
instance Control.DeepSeq.NFData B9.Content.ErlangPropList.ErlangPropList
instance Test.QuickCheck.Arbitrary.Arbitrary B9.Content.ErlangPropList.ErlangPropList
instance Data.Semigroup.Semigroup B9.Content.ErlangPropList.ErlangPropList
instance B9.Content.AST.ConcatableSyntax B9.Content.ErlangPropList.ErlangPropList
instance B9.Content.AST.ASTish B9.Content.ErlangPropList.ErlangPropList


-- | The basic data structure that ties together syntax trees making them
--   composable and addressable in B9 artifacts.
module B9.Content.Generator
data Content
RenderErlang :: (AST Content ErlangPropList) -> Content
RenderYaml :: (AST Content YamlObject) -> Content
FromString :: String -> Content
FromTextFile :: SourceFile -> Content

-- | The data in the given file will be base64 encoded.
RenderBase64BinaryFile :: FilePath -> Content

-- | This data will be base64 encoded.
RenderBase64Binary :: ByteString -> Content
FromURL :: String -> Content
instance GHC.Generics.Generic B9.Content.Generator.Content
instance Data.Data.Data B9.Content.Generator.Content
instance GHC.Classes.Eq B9.Content.Generator.Content
instance GHC.Show.Show B9.Content.Generator.Content
instance GHC.Read.Read B9.Content.Generator.Content
instance Data.Hashable.Class.Hashable B9.Content.Generator.Content
instance Data.Binary.Class.Binary B9.Content.Generator.Content
instance Control.DeepSeq.NFData B9.Content.Generator.Content
instance Test.QuickCheck.Arbitrary.Arbitrary B9.Content.Generator.Content
instance B9.Content.AST.CanRender B9.Content.Generator.Content


-- | Top-Level data types for B9 build artifacts.
module B9.ArtifactGenerator

-- | Artifacts represent the things B9 can build. A generator specifies
--   howto generate parameterized, multiple artifacts. The general
--   structure is:
--   
--   <pre>
--   Let [ ... bindings ... ]
--       [ Sources
--           [ ... list all input files ... ]
--           [ Artifact ...
--           , Artifact ...
--           , Let [ ... ] [ ... ]
--           ]
--       ]
--   </pre>
--   
--   The reasons why <a>Sources</a> takes a list of
--   <a>ArtifactGenerator</a>s is that
--   
--   <ol>
--   <li>this makes the value easier to read/write for humans</li>
--   <li>the sources are static files used in all children (e.g. company
--   logo image)</li>
--   <li>the sources are parameterized by variables that bound to different
--   values for each artifact, e.g. a template network config file which
--   contains the host IP address.</li>
--   </ol>
--   
--   To bind such variables use <a>Let</a>, <a>Each</a>, <a>LetX</a> or
--   <a>EachT</a>.
--   
--   String subtitution of these variables is done by
--   <a>B9.Content.StringTemplate</a>. These variables can be used as value
--   in nested <a>Let</a>s, in most file names/paths and in source files
--   added with <a>SourceFile</a>
data ArtifactGenerator

-- | Add sources available to <a>ArtifactAssembly</a>s in nested artifact
--   generators.
Sources :: [ArtifactSource] -> [ArtifactGenerator] -> ArtifactGenerator

-- | Bind variables, variables are avaible in nested generators.
Let :: [(String, String)] -> [ArtifactGenerator] -> ArtifactGenerator

-- | A <a>Let</a> where each variable is assigned to each value; the nested
--   generator is executed for each permutation.
--   
--   <pre>
--   LetX [("x", ["1","2","3"]), ("y", ["a","b"])] [..]
--   </pre>
--   
--   Is equal to:
--   
--   <pre>
--   Let [] [
--     Let [("x", "1"), ("y", "a")] [..]
--     Let [("x", "1"), ("y", "b")] [..]
--     Let [("x", "2"), ("y", "a")] [..]
--     Let [("x", "2"), ("y", "b")] [..]
--     Let [("x", "3"), ("y", "a")] [..]
--     Let [("x", "3"), ("y", "b")] [..]
--   ]
--   </pre>
LetX :: [(String, [String])] -> [ArtifactGenerator] -> ArtifactGenerator

-- | Bind each variable to their first value, then each variable to the
--   second value, etc ... and execute the nested generator in every step.
--   <a>LetX</a> represents a product of all variables, whereas <a>Each</a>
--   represents a sum of variable bindings - <a>Each</a> is more like a
--   <i>zip</i> whereas <a>LetX</a> is more like a list comprehension.
Each :: [(String, [String])] -> [ArtifactGenerator] -> ArtifactGenerator

-- | The transposed verison of <a>Each</a>: Bind the variables in the first
--   list to each a set of values from the second argument; execute the
--   nested generators for each binding
EachT :: [String] -> [[String]] -> [ArtifactGenerator] -> ArtifactGenerator

-- | Generate an artifact defined by an <a>ArtifactAssembly</a>; the
--   assembly can access the files created from the <a>Sources</a> and
--   variables bound by <a>Let</a>ish elements. An artifact has an instance
--   id, that is a unique, human readable string describing the artifact to
--   assemble.
Artifact :: InstanceId -> ArtifactAssembly -> ArtifactGenerator
EmptyArtifact :: ArtifactGenerator

-- | Describe how input files for artifacts to build are obtained. The
--   general structure of each constructor is <b>FromXXX</b>
--   <i>destination</i> <i>source</i>
data ArtifactSource

-- | Copy a <a>SourceFile</a> potentially replacing variabled defined in
--   <a>Let</a>-like parent elements.
FromFile :: FilePath -> SourceFile -> ArtifactSource

-- | Create a file from some <a>Content</a>
FromContent :: FilePath -> Content -> ArtifactSource

-- | Set the unix <i>file permissions</i> to all files generated by the
--   nested list of <a>ArtifactSource</a>s.
SetPermissions :: Int -> Int -> Int -> [ArtifactSource] -> ArtifactSource

-- | Assume a local directory as starting point for all relative source
--   files in the nested <a>ArtifactSource</a>s.
FromDirectory :: FilePath -> [ArtifactSource] -> ArtifactSource

-- | Specify an output directory for all the files generated by the nested
--   <a>ArtifactSource</a>s
IntoDirectory :: FilePath -> [ArtifactSource] -> ArtifactSource

-- | <b>Deprecated</b> Concatenate the files generated by the nested
--   <a>ArtifactSource</a>s. The nested, generated files are not written
--   when they are concatenated.
Concatenation :: FilePath -> [ArtifactSource] -> ArtifactSource

-- | Identify an artifact. <b>Deprecated</b> TODO: B9 does not check if all
--   instances IDs are unique.
newtype InstanceId
IID :: String -> InstanceId
data ArtifactTarget
CloudInitTarget :: CloudInitType -> FilePath -> ArtifactTarget
VmImagesTarget :: ArtifactTarget
data CloudInitType
CI_ISO :: CloudInitType
CI_VFAT :: CloudInitType
CI_DIR :: CloudInitType

-- | Define an <b>output</b> of a build. Assemblies are nested into
--   <a>ArtifactGenerator</a>s. They contain all the files defined by the
--   <a>Sources</a> they are nested into.
data ArtifactAssembly

-- | Generate a <b>cloud-init</b> compatible directory, ISO- or VFAT image,
--   as specified by the list of <a>CloudInitType</a>s. Every item will use
--   the second argument to create an appropriate <i>file name</i>, e.g.
--   for the <a>CI_ISO</a> type the output is <tt>second_param.iso</tt>.
CloudInit :: [CloudInitType] -> FilePath -> ArtifactAssembly

-- | a set of VM-images that were created by executing a build script on
--   them.
VmImages :: [ImageTarget] -> VmScript -> ArtifactAssembly

-- | A type representing the targets assembled by <a>assemble</a> from an
--   <a>ArtifactAssembly</a>. There is a list of <a>ArtifactTarget</a>s
--   because e.g. a single <a>CloudInit</a> can produce upto three output
--   files, a directory, an ISO image and a VFAT image.
data AssembledArtifact
AssembledArtifact :: InstanceId -> [ArtifactTarget] -> AssembledArtifact

-- | The output of an <a>ArtifactAssembly</a> is either a set of generated
--   files, or it might be a directory that contains the artifacts sources.
data AssemblyOutput
AssemblyGeneratesOutputFiles :: [FilePath] -> AssemblyOutput
AssemblyCopiesSourcesToDirectory :: FilePath -> AssemblyOutput

-- | The variable containing the instance id. <b>Deprecated</b>
instanceIdKey :: String

-- | The variable containing the buildId that identifies each execution of
--   B9. For more info about variable substitution in source files see
--   <a>StringTemplate</a>
buildIdKey :: String

-- | The variable containing the date and time a build was started. For
--   more info about variable substitution in source files see
--   <a>StringTemplate</a>
buildDateKey :: String

-- | Return the files that the artifact assembly consist of.
getAssemblyOutput :: ArtifactAssembly -> [AssemblyOutput]

-- | Return all source files generated by an <a>ArtifactSource</a>.
getArtifactSourceFiles :: ArtifactSource -> [FilePath]
instance GHC.Generics.Generic B9.ArtifactGenerator.AssemblyOutput
instance GHC.Classes.Eq B9.ArtifactGenerator.AssemblyOutput
instance Data.Data.Data B9.ArtifactGenerator.AssemblyOutput
instance GHC.Show.Show B9.ArtifactGenerator.AssemblyOutput
instance GHC.Read.Read B9.ArtifactGenerator.AssemblyOutput
instance GHC.Generics.Generic B9.ArtifactGenerator.ArtifactGenerator
instance Data.Data.Data B9.ArtifactGenerator.ArtifactGenerator
instance GHC.Classes.Eq B9.ArtifactGenerator.ArtifactGenerator
instance GHC.Show.Show B9.ArtifactGenerator.ArtifactGenerator
instance GHC.Read.Read B9.ArtifactGenerator.ArtifactGenerator
instance GHC.Generics.Generic B9.ArtifactGenerator.ArtifactAssembly
instance GHC.Classes.Eq B9.ArtifactGenerator.ArtifactAssembly
instance Data.Data.Data B9.ArtifactGenerator.ArtifactAssembly
instance GHC.Show.Show B9.ArtifactGenerator.ArtifactAssembly
instance GHC.Read.Read B9.ArtifactGenerator.ArtifactAssembly
instance GHC.Generics.Generic B9.ArtifactGenerator.AssembledArtifact
instance GHC.Classes.Eq B9.ArtifactGenerator.AssembledArtifact
instance Data.Data.Data B9.ArtifactGenerator.AssembledArtifact
instance GHC.Show.Show B9.ArtifactGenerator.AssembledArtifact
instance GHC.Read.Read B9.ArtifactGenerator.AssembledArtifact
instance GHC.Generics.Generic B9.ArtifactGenerator.ArtifactTarget
instance GHC.Classes.Eq B9.ArtifactGenerator.ArtifactTarget
instance Data.Data.Data B9.ArtifactGenerator.ArtifactTarget
instance GHC.Show.Show B9.ArtifactGenerator.ArtifactTarget
instance GHC.Read.Read B9.ArtifactGenerator.ArtifactTarget
instance GHC.Generics.Generic B9.ArtifactGenerator.CloudInitType
instance GHC.Classes.Eq B9.ArtifactGenerator.CloudInitType
instance Data.Data.Data B9.ArtifactGenerator.CloudInitType
instance GHC.Show.Show B9.ArtifactGenerator.CloudInitType
instance GHC.Read.Read B9.ArtifactGenerator.CloudInitType
instance Data.Hashable.Class.Hashable B9.ArtifactGenerator.InstanceId
instance Data.Binary.Class.Binary B9.ArtifactGenerator.InstanceId
instance Control.DeepSeq.NFData B9.ArtifactGenerator.InstanceId
instance GHC.Classes.Eq B9.ArtifactGenerator.InstanceId
instance Data.Data.Data B9.ArtifactGenerator.InstanceId
instance GHC.Show.Show B9.ArtifactGenerator.InstanceId
instance GHC.Read.Read B9.ArtifactGenerator.InstanceId
instance GHC.Generics.Generic B9.ArtifactGenerator.ArtifactSource
instance Data.Data.Data B9.ArtifactGenerator.ArtifactSource
instance GHC.Classes.Eq B9.ArtifactGenerator.ArtifactSource
instance GHC.Show.Show B9.ArtifactGenerator.ArtifactSource
instance GHC.Read.Read B9.ArtifactGenerator.ArtifactSource
instance Data.Hashable.Class.Hashable B9.ArtifactGenerator.ArtifactGenerator
instance Data.Binary.Class.Binary B9.ArtifactGenerator.ArtifactGenerator
instance Control.DeepSeq.NFData B9.ArtifactGenerator.ArtifactGenerator
instance Data.Semigroup.Semigroup B9.ArtifactGenerator.ArtifactGenerator
instance GHC.Base.Monoid B9.ArtifactGenerator.ArtifactGenerator
instance Test.QuickCheck.Arbitrary.Arbitrary B9.ArtifactGenerator.ArtifactGenerator
instance Data.Hashable.Class.Hashable B9.ArtifactGenerator.ArtifactAssembly
instance Data.Binary.Class.Binary B9.ArtifactGenerator.ArtifactAssembly
instance Control.DeepSeq.NFData B9.ArtifactGenerator.ArtifactAssembly
instance Test.QuickCheck.Arbitrary.Arbitrary B9.ArtifactGenerator.ArtifactAssembly
instance Data.Hashable.Class.Hashable B9.ArtifactGenerator.AssembledArtifact
instance Data.Binary.Class.Binary B9.ArtifactGenerator.AssembledArtifact
instance Control.DeepSeq.NFData B9.ArtifactGenerator.AssembledArtifact
instance Data.Hashable.Class.Hashable B9.ArtifactGenerator.ArtifactTarget
instance Data.Binary.Class.Binary B9.ArtifactGenerator.ArtifactTarget
instance Control.DeepSeq.NFData B9.ArtifactGenerator.ArtifactTarget
instance Data.Hashable.Class.Hashable B9.ArtifactGenerator.CloudInitType
instance Data.Binary.Class.Binary B9.ArtifactGenerator.CloudInitType
instance Control.DeepSeq.NFData B9.ArtifactGenerator.CloudInitType
instance Test.QuickCheck.Arbitrary.Arbitrary B9.ArtifactGenerator.CloudInitType
instance Test.QuickCheck.Arbitrary.Arbitrary B9.ArtifactGenerator.InstanceId
instance Data.Hashable.Class.Hashable B9.ArtifactGenerator.ArtifactSource
instance Data.Binary.Class.Binary B9.ArtifactGenerator.ArtifactSource
instance Control.DeepSeq.NFData B9.ArtifactGenerator.ArtifactSource
instance Test.QuickCheck.Arbitrary.Arbitrary B9.ArtifactGenerator.ArtifactSource


-- | Effectful functions to execute and build virtual machine images using
--   an execution environment like e.g. libvirt-lxc.
module B9.VmBuilder
buildWithVm :: InstanceId -> [ImageTarget] -> FilePath -> VmScript -> B9 Bool


-- | Experimental new, hopefully typesafe. domain specific language for
--   description of VM-builds.
module B9.DSL
type B9DSL a = Free BuildStep a
doc :: String -> B9DSL ()
doc' :: Content -> B9DSL ()
(#) :: B9DSL a -> String -> B9DSL a
data Documentation
Doc :: String -> Documentation
DocIncluded :: Content -> Documentation
($=) :: String -> String -> B9DSL ()
include :: FilePath -> FilePath -> B9DSL ()
includeTemplate :: FilePath -> FilePath -> B9DSL ()
writeContent :: FilePath -> Content -> B9DSL ()
exportCloudInit :: FilePath -> B9DSL ()
imageSource :: ImageSource -> B9DSL (Imported  'VmImage)
createImage :: String -> FileSystem -> ImageType -> ImageSize -> B9DSL (Imported  'VmImage)
importImage :: FilePath -> ImageType -> FileSystem -> Partition -> ImageResize -> B9DSL (Imported  'VmImage)
from :: String -> B9DSL (Imported  'VmImage)
fromResized :: ImageResize -> String -> B9DSL (Imported  'VmImage)
imageDestination :: Imported  'VmImage -> ImageDestination -> B9DSL ()
share :: Imported  'VmImage -> String -> B9DSL ()
exportLiveInstallerImage :: Imported  'VmImage -> String -> FilePath -> ImageResize -> B9DSL ()
exportImage :: Imported  'VmImage -> FilePath -> ImageType -> FileSystem -> ImageResize -> B9DSL ()
mount :: DSLCanMount src => ExecEnv -> src -> FilePath -> B9DSL (Imported (MountArtifact src))
lxc :: String -> B9DSL ExecEnv
lxc32 :: String -> B9DSL ExecEnv
boot :: String -> ExecEnvType -> CPUArch -> B9DSL ExecEnv
exec :: Script -> ExecEnv -> B9DSL ()
sh :: String -> ExecEnv -> B9DSL ()
rootImage :: String -> String -> ExecEnv -> B9DSL ()
dataImage :: String -> ExecEnv -> B9DSL ()
mountAndShareSharedImage :: String -> String -> String -> ExecEnv -> B9DSL (Imported  'VmImage)
mountAndShareNewImage :: String -> Int -> String -> FilePath -> ExecEnv -> B9DSL (Imported  'VmImage)
runDSL :: Monad m => (forall a. BuildStep a -> m a) -> B9DSL b -> m b

-- | Print the DSL to IO
printDSL :: B9DSL a -> IO ()
printBuildStep :: BuildStep a -> IO a
dslExample :: B9DSL ()
instance GHC.Show.Show B9.DSL.ExecEnv
instance GHC.Show.Show (B9.DSL.MountOpts GHC.Base.String)
instance GHC.Show.Show (B9.DSL.MountOpts (B9.DSL.Tagged B9.DiskImages.ImageSource GHC.Base.String))
instance GHC.Base.Functor B9.DSL.BuildStep
instance B9.DSL.DSLCanMount GHC.Base.String
instance B9.DSL.DSLCanMount (B9.DSL.Tagged B9.DiskImages.ImageSource GHC.Base.String)
instance GHC.Show.Show b => GHC.Show.Show (B9.DSL.Tagged a b)


-- | Mostly effectful functions to assemble artifacts.
module B9.ArtifactGeneratorImpl

-- | Execute an <a>ArtifactGenerator</a> and return a <tt>B9Invokation</tt>
--   that returns the build id obtained by <a>getBuildId</a>.
buildArtifacts :: ArtifactGenerator -> B9 String

-- | Return a list of relative paths for the <i>local</i> files to be
--   generated by the ArtifactGenerator. This excludes <tt>Shared</tt> and
--   Transient image targets.
getArtifactOutputFiles :: ArtifactGenerator -> Either String [FilePath]

-- | Run an artifact generator to produce the artifacts.
assemble :: ArtifactGenerator -> B9 [AssembledArtifact]

-- | Evaluate an <a>ArtifactGenerator</a> into a list of low-level build
--   instructions that can be built with <a>createAssembledArtifacts</a>.
evalArtifactGenerator :: String -> String -> BuildVariables -> ArtifactGenerator -> Either String [InstanceGenerator [SourceGenerator]]

-- | Parse an artifacto generator inside a <a>CGParser</a> monad.
parseArtifactGenerator :: ArtifactGenerator -> CGParser ()

-- | Execute a <a>CGParser</a> action in an environment that contains a
--   list of <a>ArtifactSource</a>s.
withArtifactSources :: [ArtifactSource] -> CGParser () -> CGParser ()
withBindings :: [(String, String)] -> CGParser () -> CGParser ()
addBindings :: [(String, String)] -> CGEnv -> CGEnv
withXBindings :: [(String, [String])] -> CGParser () -> CGParser ()
eachBindingSetT :: ArtifactGenerator -> [String] -> [[String]] -> CGParser [[(String, String)]]
eachBindingSet :: ArtifactGenerator -> [(String, [String])] -> CGParser [[(String, String)]]
writeInstanceGenerator :: InstanceId -> ArtifactAssembly -> CGParser ()

-- | Monad for creating Instance generators.
newtype CGParser a
CGParser :: WriterT [InstanceGenerator CGEnv] (ReaderT CGEnv (Either CGError)) a -> CGParser a
[runCGParser] :: CGParser a -> WriterT [InstanceGenerator CGEnv] (ReaderT CGEnv (Either CGError)) a
data CGEnv
CGEnv :: [(String, String)] -> [ArtifactSource] -> CGEnv
[agEnv] :: CGEnv -> [(String, String)]
[agSources] :: CGEnv -> [ArtifactSource]
data InstanceGenerator e
IG :: InstanceId -> e -> ArtifactAssembly -> InstanceGenerator e
newtype CGError
CGError :: String -> CGError
cgError :: String -> CGParser a
execCGParser :: CGParser () -> CGEnv -> Either CGError [InstanceGenerator CGEnv]
execIGEnv :: InstanceGenerator CGEnv -> Either String (InstanceGenerator [SourceGenerator])
substAssembly :: [(String, String)] -> ArtifactAssembly -> ArtifactAssembly
toSourceGen :: [(String, String)] -> ArtifactSource -> Either String [SourceGenerator]
createAssembledArtifacts :: [InstanceGenerator [SourceGenerator]] -> B9 [AssembledArtifact]
generateSources :: FilePath -> InstanceGenerator [SourceGenerator] -> B9 (InstanceGenerator FilePath)
createTargets :: InstanceGenerator FilePath -> B9 AssembledArtifact
generateUniqueIID :: InstanceId -> B9 InstanceId
generateSourceTo :: FilePath -> SourceGenerator -> B9 ()
sgReadSourceFile :: [(String, String)] -> SourceFile -> B9 ByteString
sgChangePerm :: FilePath -> SGPerm -> B9 ()

-- | Internal data type simplifying the rather complex source generation by
--   bioling down <a>ArtifactSource</a>s to a flat list of uniform
--   <a>SourceGenerator</a>s.
data SourceGenerator
SG :: [(String, String)] -> SGSource -> SGPerm -> FilePath -> SourceGenerator

-- | Return the (internal-)output file of the source file that is
--   generated.
sourceGeneratorOutputFile :: SourceGenerator -> FilePath
data SGSource
SGFiles :: [SourceFile] -> SGSource
SGContent :: Content -> SGSource
data SGPerm
SGSetPerm :: (Int, Int, Int) -> SGPerm
KeepPerm :: SGPerm
sgGetFroms :: SourceGenerator -> [SourceFile]
setSGPerm :: Int -> Int -> Int -> SourceGenerator -> Either String SourceGenerator
setSGFromDirectory :: FilePath -> SourceGenerator -> SourceGenerator
setSGToDirectory :: FilePath -> SourceGenerator -> SourceGenerator

-- | Create the actual target, either just a mountpoint, or an ISO or VFAT
--   image.
createTarget :: InstanceId -> FilePath -> ArtifactAssembly -> B9 [ArtifactTarget]
instance GHC.Classes.Eq B9.ArtifactGeneratorImpl.SourceGenerator
instance GHC.Show.Show B9.ArtifactGeneratorImpl.SourceGenerator
instance GHC.Read.Read B9.ArtifactGeneratorImpl.SourceGenerator
instance GHC.Classes.Eq B9.ArtifactGeneratorImpl.SGPerm
instance Data.Data.Data B9.ArtifactGeneratorImpl.SGPerm
instance GHC.Show.Show B9.ArtifactGeneratorImpl.SGPerm
instance GHC.Read.Read B9.ArtifactGeneratorImpl.SGPerm
instance GHC.Classes.Eq B9.ArtifactGeneratorImpl.SGSource
instance GHC.Show.Show B9.ArtifactGeneratorImpl.SGSource
instance GHC.Read.Read B9.ArtifactGeneratorImpl.SGSource
instance Control.Monad.Error.Class.MonadError B9.ArtifactGeneratorImpl.CGError B9.ArtifactGeneratorImpl.CGParser
instance Control.Monad.Writer.Class.MonadWriter [B9.ArtifactGeneratorImpl.InstanceGenerator B9.ArtifactGeneratorImpl.CGEnv] B9.ArtifactGeneratorImpl.CGParser
instance Control.Monad.Reader.Class.MonadReader B9.ArtifactGeneratorImpl.CGEnv B9.ArtifactGeneratorImpl.CGParser
instance GHC.Base.Monad B9.ArtifactGeneratorImpl.CGParser
instance GHC.Base.Applicative B9.ArtifactGeneratorImpl.CGParser
instance GHC.Base.Functor B9.ArtifactGeneratorImpl.CGParser
instance GHC.Classes.Eq B9.ArtifactGeneratorImpl.CGError
instance Data.Data.Data B9.ArtifactGeneratorImpl.CGError
instance GHC.Show.Show B9.ArtifactGeneratorImpl.CGError
instance GHC.Read.Read B9.ArtifactGeneratorImpl.CGError
instance GHC.Classes.Eq e => GHC.Classes.Eq (B9.ArtifactGeneratorImpl.InstanceGenerator e)
instance Data.Data.Data e => Data.Data.Data (B9.ArtifactGeneratorImpl.InstanceGenerator e)
instance GHC.Show.Show e => GHC.Show.Show (B9.ArtifactGeneratorImpl.InstanceGenerator e)
instance GHC.Read.Read e => GHC.Read.Read (B9.ArtifactGeneratorImpl.InstanceGenerator e)
instance GHC.Classes.Eq B9.ArtifactGeneratorImpl.CGEnv
instance GHC.Show.Show B9.ArtifactGeneratorImpl.CGEnv
instance GHC.Read.Read B9.ArtifactGeneratorImpl.CGEnv


-- | B9 is a library and build tool with primitive operations to rmrun a
--   build script inside a virtual machine and to create and convert
--   virtual machine image files as well as related ISO and VFAT disk
--   images for e.g. cloud-init configuration sources.
--   
--   This module re-exports the modules needed to build a tool around the
--   library, e.g. see <tt>src/cli/Main.hs</tt> as an example.
--   
--   <a>B9.ArtifactGenerator</a> is the module containing the basic data
--   structure used to describe a B9 build.
module B9

-- | Return the cabal package version of the B9 library.
b9Version :: Version

-- | Return the cabal package version of the B9 library, formatted using
--   <a>showVersion</a>.
b9VersionString :: String

-- | Just print the <a>b9VersionString</a>
runShowVersion :: MonadIO m => m ()

-- | Execute the artifact generators defined in a list of text files. Read
--   the text files in the list and parse them as <a>ArtifactGenerator</a>s
--   then <a>mappend</a> them and apply <a>buildArtifacts</a> to them.
runBuildArtifacts :: MonadIO m => [FilePath] -> B9ConfigAction m String

-- | Read all text files and parse them as <a>ArtifactGenerator</a>s. Then
--   overwrite the files with their contents but _pretty printed_ (i.e.
--   formatted).
runFormatBuildFiles :: MonadIO m => [FilePath] -> m ()

-- | Upload a <a>SharedImageName</a> to the default remote repository.
--   Note: The remote repository is specified in the <a>B9Config</a>.
runPush :: MonadIO m => SharedImageName -> B9ConfigAction m ()

-- | Either pull a list of available <a>SharedImageName</a>s from the
--   remote repository if <a>Nothing</a> is passed as parameter, or pull
--   the latest version of the image from the remote repository. Note: The
--   remote repository is specified in the <a>B9Config</a>.
runPull :: MonadIO m => Maybe SharedImageName -> B9ConfigAction m ()

-- | Execute an interactive root shell in a running container from a
--   <a>SharedImageName</a>.
runRun :: MonadIO m => SharedImageName -> [String] -> B9ConfigAction m String

-- | Delete all obsolete versions of all <a>SharedImageName</a>s.
runGcLocalRepoCache :: MonadIO m => B9ConfigAction m ()

-- | Clear the shared image cache for a remote. Note: The remote repository
--   is specified in the <a>B9Config</a>.
runGcRemoteRepoCache :: MonadIO m => B9ConfigAction m ()

-- | Print a list of shared images cached locally or remotely, if a remote
--   repository was selected. Note: The remote repository is specified in
--   the <a>B9Config</a>.
runListSharedImages :: MonadIO m => B9ConfigAction m [SharedImage]

-- | Check the SSH settings for a remote repository and add it to the user
--   wide B9 configuration file.
runAddRepo :: MonadIO m => RemoteRepo -> B9ConfigAction m ()

-- | Find the most recent version of a <a>SharedImageName</a> in the local
--   image cache.
runLookupLocalSharedImage :: MonadIO m => SharedImageName -> B9ConfigAction m (Maybe SharedImageBuildId)


-- | A crude, unsafe and preliminary solution to building B9
--   <a>SharedImage</a>s from Shake.
module B9.Shake.SharedImageRules

-- | Specify an arbitrary action that is supposed to build the given shared
--   image identified by a <a>SharedImageName</a>. NOTE: You must call
--   <a>enableSharedImageRules</a> before this action works.
customSharedImageAction :: SharedImageName -> Action () -> Rules ()

-- | Add a dependency to the creation of a <a>SharedImage</a>. The build
--   action for the shared image must have been supplied by e.g.
--   <a>customSharedImageAction</a>. NOTE: You must call
--   <a>enableSharedImageRules</a> before this action works.
needSharedImage :: SharedImageName -> Action SharedImageBuildId

-- | In order to use <a>needSharedImage</a> and
--   <a>customSharedImageAction</a> you need to call this action before
--   using any of the afore mentioned.
enableSharedImageRules :: B9ConfigOverride -> Rules ()


-- | Convenient Shake <a>Action</a>s for <a>B9</a> rules.
module B9.Shake.Actions

-- | Convert a <tt>B9Invokation</tt> action into a Shake <a>Action</a>.
--   This is just an alias for <a>execB9ConfigAction</a> since
--   <a>Action</a> is an instance of <a>MonadIO</a> and
--   <a>execB9ConfigAction</a> work on any .
b9InvokationAction :: B9ConfigAction Action a -> B9ConfigOverride -> Action a

-- | An action that does the equivalent of <tt>b9c build -f <a>b9file</a>
--   -- (args !! 0) (args !! 1) ... (args !! (length args - 1))</tt> with
--   the current working directory changed to <tt>b9Root</tt>. The return
--   value is the buildid, see <a>getBuildId</a>
buildB9File :: FilePath -> FilePath -> [String] -> Action String


-- | A module that re-exports all B9 Shake integration. Which by the way is
--   crude and preliminary...
module B9.Shake
