summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-03-29 05:00:59 -0700
committerBen Sima <ben@bsima.me>2020-03-29 07:49:02 -0700
commit22bbc12e63c5fb4fd57ebd0f7a720dcda050d9ca (patch)
tree0da03d7914f5a3724b9c58209835ad414b2e1497
parent831620c6ae0461228e0801de92dfc6671333a079 (diff)
Bump nixpkgs pin
-rw-r--r--Com/MusicMeetsComics/Server/Config.hs6
-rw-r--r--Com/MusicMeetsComics/Server/Logger.hs67
-rw-r--r--Com/Simatime/buildOS.nix2
-rw-r--r--Com/Simatime/dev/configuration.nix11
-rw-r--r--nixpkgs.nix6
5 files changed, 48 insertions, 44 deletions
diff --git a/Com/MusicMeetsComics/Server/Config.hs b/Com/MusicMeetsComics/Server/Config.hs
index 2bbfabc..ac634a2 100644
--- a/Com/MusicMeetsComics/Server/Config.hs
+++ b/Com/MusicMeetsComics/Server/Config.hs
@@ -22,7 +22,7 @@ import Network.Wai.Handler.Warp (Port)
import Network.Wai.Middleware.RequestLogger (logStdout, logStdoutDev)
import Protolude
import Safe (readMay)
-import Servant (ServantErr)
+import Servant (ServerError)
import System.Environment (lookupEnv)
import System.Remote.Monitoring (forkServer, serverMetricStore, serverThreadId)
@@ -34,12 +34,12 @@ import System.Remote.Monitoring (forkServer, serverMetricStore, server
-- By encapsulating the effects in our newtype, we can add layers to the
-- monad stack without having to modify code that uses the current layout.
newtype AppT m a = AppT
- { runApp :: ReaderT Config (ExceptT ServantErr m) a
+ { runApp :: ReaderT Config (ExceptT ServerError m) a
} deriving ( Functor
, Applicative
, Monad
, MonadReader Config
- , MonadError ServantErr
+ , MonadError ServerError
, MonadIO
)
diff --git a/Com/MusicMeetsComics/Server/Logger.hs b/Com/MusicMeetsComics/Server/Logger.hs
index eb37ef6..5091b23 100644
--- a/Com/MusicMeetsComics/Server/Logger.hs
+++ b/Com/MusicMeetsComics/Server/Logger.hs
@@ -3,46 +3,49 @@
module Com.MusicMeetsComics.Server.Logger
( adapt
, defaultLogEnv
- , logMsg
- , runKatipT
- , KatipT(..)
- , Katip(..)
- , LogEnv
- , Severity(..)
- ) where
+ , Katip.logMsg
+ , Katip.runKatipT
+ , Katip.KatipT(..)
+ , Katip.Katip(..)
+ , Katip.LogEnv
+ , Katip.Severity(..)
+ )
+where
-import Control.Monad.Logger
-import qualified Control.Monad.Logger as Logger
-import Katip
+import qualified Control.Monad.Logger as Logger
+import qualified Katip
import Protolude
-import qualified System.IO as IO
-import qualified System.Log.FastLogger as FastLogger
+import qualified System.IO as IO
+import qualified System.Log.FastLogger as FastLogger
-defaultLogEnv :: IO LogEnv
+defaultLogEnv :: IO Katip.LogEnv
defaultLogEnv = do
- handleScribe <- mkHandleScribe ColorIfTerminal IO.stdout DebugS V2
- env <- initLogEnv "hero" "production"
- registerScribe "stdout" handleScribe defaultScribeSettings env
+ handleScribe <- Katip.mkHandleScribe Katip.ColorIfTerminal
+ IO.stdout
+ (Katip.permitItem Katip.DebugS)
+ Katip.V2
+ env <- Katip.initLogEnv "hero" "production"
+ Katip.registerScribe "stdout" handleScribe Katip.defaultScribeSettings env
-fromLevel :: LogLevel -> Severity
-fromLevel LevelDebug = DebugS
-fromLevel LevelInfo = InfoS
-fromLevel LevelWarn = WarningS
-fromLevel LevelError = ErrorS
-fromLevel (LevelOther _) = NoticeS
+fromLevel :: Logger.LogLevel -> Katip.Severity
+fromLevel Logger.LevelDebug = Katip.DebugS
+fromLevel Logger.LevelInfo = Katip.InfoS
+fromLevel Logger.LevelWarn = Katip.WarningS
+fromLevel Logger.LevelError = Katip.ErrorS
+fromLevel (Logger.LevelOther _) = Katip.NoticeS
-- | Transforms Katip logMsg into monadLoggerLog to be used inside
-- MonadLogger monad
-adapt ::
- (ToLogStr msg, Applicative m, Katip m)
- => (Namespace -> Severity -> Katip.LogStr -> m ())
- -> Loc
- -> LogSource
- -> LogLevel
+adapt
+ :: (FastLogger.ToLogStr msg, Applicative m, Katip.Katip m)
+ => (Katip.Namespace -> Katip.Severity -> Katip.LogStr -> m ())
+ -> Logger.Loc
+ -> Logger.LogSource
+ -> Logger.LogLevel
-> msg
-> m ()
adapt f _ src lvl msg = f ns (fromLevel lvl) $ logStr' msg
- where
- ns = Namespace [src]
- -- not sure how fast this is going to be
- logStr' = Katip.logStr . FastLogger.fromLogStr . Logger.toLogStr
+ where
+ ns = Katip.Namespace [src]
+ -- not sure how fast this is going to be
+ logStr' = Katip.logStr . FastLogger.fromLogStr . Logger.toLogStr
diff --git a/Com/Simatime/buildOS.nix b/Com/Simatime/buildOS.nix
index 4193ed5..c40fc22 100644
--- a/Com/Simatime/buildOS.nix
+++ b/Com/Simatime/buildOS.nix
@@ -24,6 +24,8 @@ let
nix.maxJobs = 1; # "auto";
nix.optimise.automatic = true;
nix.optimise.dates = [ "Sunday 02:30" ];
+ security.acme.email = "ben@bsima.me";
+ security.acme.acceptTerms = true;
security.sudo.wheelNeedsPassword = false;
services.clamav.daemon.enable = true; # security
services.clamav.updater.enable = true; # security
diff --git a/Com/Simatime/dev/configuration.nix b/Com/Simatime/dev/configuration.nix
index 1415930..3b69f6f 100644
--- a/Com/Simatime/dev/configuration.nix
+++ b/Com/Simatime/dev/configuration.nix
@@ -35,13 +35,12 @@ in {
boot.loader.efi.canTouchEfiVariables = true;
boot.enableContainers = true;
- boot.initrd.luks.devices = [
- {
- name = "root";
+ boot.initrd.luks.devices = {
+ root = {
device = "/dev/disk/by-uuid/a0160f25-e0e3-4af0-8236-3e298eac957a";
preLVM = true;
- }
- ];
+ };
+ };
powerManagement.enable = false;
@@ -170,7 +169,7 @@ in {
};
};
- emby = { # previously emby
+ jellyfin = { # previously emby
enable = true;
user = "emby";
group = "emby";
diff --git a/nixpkgs.nix b/nixpkgs.nix
index 7dd9ce1..fbf8257 100644
--- a/nixpkgs.nix
+++ b/nixpkgs.nix
@@ -1,5 +1,5 @@
-# generated with ~/bin/nix-pin
+# generated with ~/bin/nixos-pin
{
- url = "https://github.com/NixOS/nixpkgs/archive/51e1e3ceaf0e6958933701c231c6ab561784dc61.tar.gz";
- sha256 = "13cv8w595v3bjr92k5vha7i3zx3ljpp31dkdlm7isn3bm28q9z93";
+ url = "https://github.com/NixOS/nixpkgs/archive/b0c285807d6a9f1b7562ec417c24fa1a30ecc31a.tar.gz";
+ sha256 = "0waapr7aqz0h1fy1fqlx981ygllh91qx9sz1l2j2h59s46cdircl";
}