@ -8,7 +8,18 @@ let
configJsData = " m o d u l e . e x p o r t s = " + builtins . toJSON (
{ private = cfg . private ; port = cfg . port ; } // cfg . extraConfig
) ;
in {
pluginManifest = {
dependencies = builtins . listToAttrs ( builtins . map ( pkg : { name = getName pkg ; value = getVersion pkg ; } ) cfg . plugins ) ;
} ;
plugins = pkgs . runCommandLocal " t h e l o u n g e - p l u g i n s " { } ''
mkdir - p $ out/node_modules
echo $ { escapeShellArg ( builtins . toJSON pluginManifest ) } > > $ out/package.json
$ { concatMapStringsSep " \n " ( pkg : ''
ln - s $ { pkg } /lib/node_modules / $ { getName pkg } $ out/node_modules / $ { getName pkg }
'' ) c f g . p l u g i n s }
'' ;
in
{
options . services . thelounge = {
enable = mkEnableOption " T h e L o u n g e w e b I R C c l i e n t " ;
@ -30,7 +41,7 @@ in {
} ;
extraConfig = mkOption {
default = { } ;
default = { } ;
type = types . attrs ;
example = literalExpression '' {
reverseProxy = true ;
@ -50,19 +61,30 @@ in {
Documentation : < link xlink:href= " h t t p s : / / t h e l o u n g e . c h a t / d o c s / s e r v e r / c o n f i g u r a t i o n " / >
'' ;
} ;
plugins = mkOption {
default = [ ] ;
type = types . listOf types . package ;
example = literalExpression " [ p k g s . t h e L o u n g e P l u g i n s . t h e m e s . s o l a r i z e d ] " ;
description = ''
The Lounge plugins to install . Plugins can be found in
<literal> pkgs . theLoungePlugins . plugins < /literal > and <literal> pkgs . theLoungePlugins . themes < /literal > .
'' ;
} ;
} ;
config = mkIf cfg . enable {
users . users . thelounge = {
description = " t h e l o u n g e s e r v i c e u s e r " ;
description = " T h e L o u n g e s e r v i c e u s e r " ;
group = " t h e l o u n g e " ;
isSystemUser = true ;
} ;
users . groups . thelounge = { } ;
users . groups . thelounge = { } ;
systemd . services . thelounge = {
description = " T h e L o u n g e w e b I R C c l i e n t " ;
wantedBy = [ " m u l t i - u s e r . t a r g e t " ] ;
preStart = " l n - s f ${ pkgs . writeText " c o n f i g . j s " configJsData } ${ dataDir } / c o n f i g . j s " ;
environment . THELOUNGE_PACKAGES = mkIf ( cfg . plugins != [ ] ) " ${ plugins } " ;
serviceConfig = {
User = " t h e l o u n g e " ;
StateDirectory = baseNameOf dataDir ;