From 2fb55a784d0450d06ff12705d002456c41508400 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 17 Jul 2016 19:29:00 +0200 Subject: syntax --- bragi.nix | 54 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'bragi.nix') diff --git a/bragi.nix b/bragi.nix index c85e0ace..0a7ca26e 100644 --- a/bragi.nix +++ b/bragi.nix @@ -275,42 +275,44 @@ in rec { home = "/var/lib/thermoprint"; }; - environment.etc."thermoprint-server/config.hs" = '' - {-# LANGUAGE OverloadedStrings #-} - {-# LANGUAGE ImpredicativeTypes #-} + environment.etc."thermoprint-server/config.hs" = { + text = '' + {-# LANGUAGE OverloadedStrings #-} + {-# LANGUAGE ImpredicativeTypes #-} - module Main (main) where + module Main (main) where - import Thermoprint.Server + import Thermoprint.Server - import Thermoprint.Server.Printer.Generic + import Thermoprint.Server.Printer.Generic - import Control.Monad.Trans.Resource - import Control.Monad.Logger - import Control.Monad.Reader + import Control.Monad.Trans.Resource + import Control.Monad.Logger + import Control.Monad.Reader - import Database.Persist.Sqlite + import Database.Persist.Sqlite - import qualified Network.Wai.Handler.Warp as Warp + import qualified Network.Wai.Handler.Warp as Warp - main :: IO () - main = thermoprintServer True (Nat runSqlite) $ (\c -> c { queueManagers = queueManagers, warpSettings = wSettings }) <$> def `withPrinters` printers - where - runSqlite :: ReaderT ConnectionPool (LoggingT IO) a -> IO a - runSqlite = runStderrLoggingT . withSqlitePool "${users.extraUsers."thermoprint".home}/thermoprint.sqlite" 1 . runReaderT + main :: IO () + main = thermoprintServer True (Nat runSqlite) $ (\c -> c { queueManagers = queueManagers, warpSettings = wSettings }) <$> def `withPrinters` printers + where + runSqlite :: ReaderT ConnectionPool (LoggingT IO) a -> IO a + runSqlite = runStderrLoggingT . withSqlitePool "${users.extraUsers."thermoprint".home}/thermoprint.sqlite" 1 . runReaderT - printers = [ (pure $ genericPrint "/dev/usb/lp0", def) - ] + printers = [ (pure $ genericPrint "/dev/usb/lp0", def) + ] - queueManagers _ = QMConfig - { manager = union [ limitHistorySize 100 - , limitHistoryAge 3600 - ] - , collapse = standardCollapse - } + queueManagers _ = QMConfig + { manager = union [ limitHistorySize 100 + , limitHistoryAge 3600 + ] + , collapse = standardCollapse + } - wSettings = setHost "*" . Warp.setPort 8080 $ Warp.defaultSettings - ''; + wSettings = setHost "*" . Warp.setPort 8080 $ Warp.defaultSettings + ''; + }; systemd.services."thermoprint" = { environment = { -- cgit v1.2.3