summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/Chroot.hs
blob: b10e9817cb7a67324f0636419e6045f43697e02c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Propellor.Types.Chroot where

import Data.Monoid
import qualified Data.Map as M

data ChrootInfo host = ChrootInfo
	{ _chroots :: M.Map FilePath host
	, _chrootCfg :: ChrootCfg
	}
	deriving (Show)

instance Monoid (ChrootInfo host) where
	mempty = ChrootInfo mempty mempty
	mappend old new = ChrootInfo
		{ _chroots = M.union (_chroots old) (_chroots new)
		, _chrootCfg = _chrootCfg old <> _chrootCfg new
		}

data ChrootCfg
	= ChrootCfg
	| SystemdNspawnCfg [String]
	deriving (Show)

instance Monoid ChrootCfg where
	mempty = ChrootCfg
	mappend _ ChrootCfg = ChrootCfg
	mappend ChrootCfg r = r
	mappend (SystemdNspawnCfg l1) (SystemdNspawnCfg l2) =
		SystemdNspawnCfg (l1 <> l2)