nixos/thelounge: add plugins option
This commit is contained in:
parent
d53d2147ef
commit
fe20f479e9
|
@ -334,6 +334,15 @@
|
||||||
<literal>true</literal>.
|
<literal>true</literal>.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
The option <literal>services.thelounge.plugins</literal> has
|
||||||
|
been added to allow installing plugins for The Lounge. Plugins
|
||||||
|
can be found in
|
||||||
|
<literal>pkgs.theLoungePlugins.plugins</literal> and
|
||||||
|
<literal>pkgs.theLoungePlugins.themes</literal>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</section>
|
</section>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -124,3 +124,5 @@ In addition to numerous new and upgraded packages, this release has the followin
|
||||||
- `fetchFromSourcehut` now allows fetching repositories recursively
|
- `fetchFromSourcehut` now allows fetching repositories recursively
|
||||||
using `fetchgit` or `fetchhg` if the argument `fetchSubmodules`
|
using `fetchgit` or `fetchhg` if the argument `fetchSubmodules`
|
||||||
is set to `true`.
|
is set to `true`.
|
||||||
|
|
||||||
|
- The option `services.thelounge.plugins` has been added to allow installing plugins for The Lounge. Plugins can be found in `pkgs.theLoungePlugins.plugins` and `pkgs.theLoungePlugins.themes`.
|
||||||
|
|
|
@ -8,7 +8,18 @@ let
|
||||||
configJsData = "module.exports = " + builtins.toJSON (
|
configJsData = "module.exports = " + builtins.toJSON (
|
||||||
{ private = cfg.private; port = cfg.port; } // cfg.extraConfig
|
{ 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 "thelounge-plugins" { } ''
|
||||||
|
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}
|
||||||
|
'') cfg.plugins}
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
options.services.thelounge = {
|
options.services.thelounge = {
|
||||||
enable = mkEnableOption "The Lounge web IRC client";
|
enable = mkEnableOption "The Lounge web IRC client";
|
||||||
|
|
||||||
|
@ -50,11 +61,21 @@ in {
|
||||||
Documentation: <link xlink:href="https://thelounge.chat/docs/server/configuration" />
|
Documentation: <link xlink:href="https://thelounge.chat/docs/server/configuration" />
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugins = mkOption {
|
||||||
|
default = [ ];
|
||||||
|
type = types.listOf types.package;
|
||||||
|
example = literalExpression "[ pkgs.theLoungePlugins.themes.solarized ]";
|
||||||
|
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 {
|
config = mkIf cfg.enable {
|
||||||
users.users.thelounge = {
|
users.users.thelounge = {
|
||||||
description = "thelounge service user";
|
description = "The Lounge service user";
|
||||||
group = "thelounge";
|
group = "thelounge";
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
};
|
};
|
||||||
|
@ -63,6 +84,7 @@ in {
|
||||||
description = "The Lounge web IRC client";
|
description = "The Lounge web IRC client";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
preStart = "ln -sf ${pkgs.writeText "config.js" configJsData} ${dataDir}/config.js";
|
preStart = "ln -sf ${pkgs.writeText "config.js" configJsData} ${dataDir}/config.js";
|
||||||
|
environment.THELOUNGE_PACKAGES = mkIf (cfg.plugins != [ ]) "${plugins}";
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = "thelounge";
|
User = "thelounge";
|
||||||
StateDirectory = baseNameOf dataDir;
|
StateDirectory = baseNameOf dataDir;
|
||||||
|
|
|
@ -440,6 +440,7 @@ let
|
||||||
buildInputs = [ self.node-pre-gyp ];
|
buildInputs = [ self.node-pre-gyp ];
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
echo /var/lib/thelounge > $out/lib/node_modules/thelounge/.thelounge_home
|
echo /var/lib/thelounge > $out/lib/node_modules/thelounge/.thelounge_home
|
||||||
|
patch -d $out/lib/node_modules/thelounge -p1 < ${./thelounge-packages-path.patch}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
15
pkgs/development/node-packages/thelounge-packages-path.patch
Normal file
15
pkgs/development/node-packages/thelounge-packages-path.patch
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
diff --git a/src/helper.js b/src/helper.js
|
||||||
|
index 27352b53..7078e4c5 100644
|
||||||
|
--- a/src/helper.js
|
||||||
|
+++ b/src/helper.js
|
||||||
|
@@ -110,6 +110,10 @@ function setHome(newPath) {
|
||||||
|
userLogsPath = path.join(homePath, "logs");
|
||||||
|
clientCertificatesPath = path.join(homePath, "certificates");
|
||||||
|
|
||||||
|
+ if (process.env.THELOUNGE_PACKAGES !== undefined) {
|
||||||
|
+ packagesPath = process.env.THELOUNGE_PACKAGES;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
// Reload config from new home location
|
||||||
|
if (fs.existsSync(configPath)) {
|
||||||
|
const userConfig = require(configPath);
|
|
@ -10178,6 +10178,16 @@ with pkgs;
|
||||||
|
|
||||||
inherit (nodePackages) thelounge;
|
inherit (nodePackages) thelounge;
|
||||||
|
|
||||||
|
theLoungePlugins = with lib; let
|
||||||
|
pkgs = filterAttrs (name: _: hasPrefix "thelounge-" name) nodePackages;
|
||||||
|
getPackagesWithPrefix = prefix: mapAttrs' (name: pkg: nameValuePair (removePrefix ("thelounge-" + prefix + "-") name) pkg)
|
||||||
|
(filterAttrs (name: _: hasPrefix ("thelounge-" + prefix + "-") name) pkgs);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
plugins = getPackagesWithPrefix "plugin";
|
||||||
|
themes = getPackagesWithPrefix "theme";
|
||||||
|
};
|
||||||
|
|
||||||
thefuck = python3Packages.callPackage ../tools/misc/thefuck { };
|
thefuck = python3Packages.callPackage ../tools/misc/thefuck { };
|
||||||
|
|
||||||
thicket = callPackage ../applications/version-management/git-and-tools/thicket { };
|
thicket = callPackage ../applications/version-management/git-and-tools/thicket { };
|
||||||
|
|
Loading…
Reference in a new issue