diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-09-07 21:28:33 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-09-07 21:28:33 +0200 |
commit | 916793cf130a8269bbda881e9081370d74595538 (patch) | |
tree | 11c9e5d14f3178c6daf5a9c0a85f8a9e469ac356 /nixos/modules/services/networking/shout.nix | |
parent | 026c31dd9d6570fc6d7475c0102745cbfb0d6972 (diff) | |
parent | 86eaeb4c0a31e623c01f0d39fd5b3e64ce5f80b5 (diff) | |
download | nixlib-916793cf130a8269bbda881e9081370d74595538.tar nixlib-916793cf130a8269bbda881e9081370d74595538.tar.gz nixlib-916793cf130a8269bbda881e9081370d74595538.tar.bz2 nixlib-916793cf130a8269bbda881e9081370d74595538.tar.lz nixlib-916793cf130a8269bbda881e9081370d74595538.tar.xz nixlib-916793cf130a8269bbda881e9081370d74595538.tar.zst nixlib-916793cf130a8269bbda881e9081370d74595538.zip |
Merge branch 'master' into systemd-219
Conflicts: nixos/modules/system/boot/systemd.nix pkgs/applications/networking/p2p/transmission/default.nix pkgs/development/libraries/libseccomp/default.nix pkgs/os-specific/linux/systemd/default.nix pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixos/modules/services/networking/shout.nix')
-rw-r--r-- | nixos/modules/services/networking/shout.nix | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/nixos/modules/services/networking/shout.nix b/nixos/modules/services/networking/shout.nix new file mode 100644 index 000000000000..f55b87a96140 --- /dev/null +++ b/nixos/modules/services/networking/shout.nix @@ -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"; + }; + }; + }; +} |