mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-20 04:19:00 +02:00
shout service: New module.
This commit is contained in:
parent
f4502e650b
commit
ad4c957163
|
@ -227,6 +227,7 @@
|
|||
riemanntools = 203;
|
||||
subsonic = 204;
|
||||
riak = 205;
|
||||
shout = 206;
|
||||
|
||||
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
|
||||
|
||||
|
@ -432,6 +433,7 @@
|
|||
riemanntools = 203;
|
||||
subsonic = 204;
|
||||
riak = 205;
|
||||
#shout = 206; #unused
|
||||
|
||||
# When adding a gid, make sure it doesn't match an existing
|
||||
# uid. Users and groups with the same name should have equal
|
||||
|
|
|
@ -328,6 +328,7 @@
|
|||
./services/networking/searx.nix
|
||||
./services/networking/seeks.nix
|
||||
./services/networking/skydns.nix
|
||||
./services/networking/shout.nix
|
||||
./services/networking/spiped.nix
|
||||
./services/networking/sslh.nix
|
||||
./services/networking/ssh/lshd.nix
|
||||
|
|
80
nixos/modules/services/networking/shout.nix
Normal file
80
nixos/modules/services/networking/shout.nix
Normal file
|
@ -0,0 +1,80 @@
|
|||
{ pkgs, lib, config, options, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.shout;
|
||||
shoutHome = "/var/lib/shout";
|
||||
|
||||
in {
|
||||
options.services.shout = {
|
||||
enable = mkEnableOption "Shout web IRC client";
|
||||
|
||||
private = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Make your shout instance private. You will need to configure user
|
||||
accounts by adding entries in <filename>${shoutHome}/users</filename>.
|
||||
'';
|
||||
};
|
||||
|
||||
host = mkOption {
|
||||
type = types.string;
|
||||
default = "0.0.0.0";
|
||||
description = "IP interface to listen on for http connections.";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 9000;
|
||||
description = "TCP port to listen on for http connections.";
|
||||
};
|
||||
|
||||
configFile = mkOption {
|
||||
type = types.nullOr types.lines;
|
||||
default = null;
|
||||
description = ''
|
||||
Contents of Shout's <filename>config.js</filename> file. If left empty,
|
||||
Shout will generate from its defaults at first startup.
|
||||
|
||||
Documentation: http://shout-irc.com/docs/server/configuration.html
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users.extraUsers = singleton {
|
||||
name = "shout";
|
||||
uid = config.ids.uids.shout;
|
||||
description = "Shout daemon user";
|
||||
home = shoutHome;
|
||||
createHome = true;
|
||||
};
|
||||
|
||||
systemd.services.shout = {
|
||||
description = "Shout web IRC client";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
preStart = if isNull cfg.configFile then null
|
||||
else ''
|
||||
ln -sf ${pkgs.writeText "config.js" cfg.configFile} \
|
||||
${shoutHome}/config.js
|
||||
'';
|
||||
script = concatStringsSep " " [
|
||||
"${pkgs.shout}/bin/shout"
|
||||
(if cfg.private then "--private" else "--public")
|
||||
"--port" (toString cfg.port)
|
||||
"--host" (toString cfg.host)
|
||||
"--home" shoutHome
|
||||
];
|
||||
serviceConfig = {
|
||||
User = "shout";
|
||||
ProtectHome = "true";
|
||||
ProtectSystem = "full";
|
||||
PrivateTmp = "true";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue