summaryrefslogtreecommitdiff
path: root/src/Propellor/Types/Chroot.hs
diff options
context:
space:
mode:
authorJoey Hess2014-11-21 20:57:53 -0400
committerJoey Hess2014-11-21 20:57:53 -0400
commit91d58380b4fe3dd4dca5668ef6c7b2bf1edef79c (patch)
tree5dde66ff4e0ecf12e654c30f13aceeda913f201d /src/Propellor/Types/Chroot.hs
parente60b261daea356a2fcab424a276a491fdd3f956c (diff)
parent6cdd37d9ff3ff3e3b8439445c1363b9bdc77a5da (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Types/Chroot.hs')
-rw-r--r--src/Propellor/Types/Chroot.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Propellor/Types/Chroot.hs b/src/Propellor/Types/Chroot.hs
new file mode 100644
index 00000000..b7ed7807
--- /dev/null
+++ b/src/Propellor/Types/Chroot.hs
@@ -0,0 +1,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
+ = NoChrootCfg
+ | SystemdNspawnCfg [(String, Bool)]
+ deriving (Show)
+
+instance Monoid ChrootCfg where
+ mempty = NoChrootCfg
+ mappend v NoChrootCfg = v
+ mappend NoChrootCfg v = v
+ mappend (SystemdNspawnCfg l1) (SystemdNspawnCfg l2) =
+ SystemdNspawnCfg (l1 <> l2)