Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 9a8d764486a5
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ca37c23f91f0
Choose a head ref
  • 3 commits
  • 6 files changed
  • 2 contributors

Commits on Apr 23, 2019

  1. tedicross: init at 0.8.7

    pacien committed Apr 23, 2019

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    df04850 View commit details
  2. nixos/tedicross: add module

    pacien committed Apr 23, 2019

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    d3423dd View commit details
  3. Merge pull request #58096 from pacien/tedicross-init

    tedicross: init at 0.8.7
    infinisil authored Apr 23, 2019

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    ca37c23 View commit details
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
@@ -673,6 +673,7 @@
./services/networking/syncthing-relay.nix
./services/networking/tcpcrypt.nix
./services/networking/teamspeak3.nix
./services/networking/tedicross.nix
./services/networking/tinc.nix
./services/networking/tinydns.nix
./services/networking/tftpd.nix
100 changes: 100 additions & 0 deletions nixos/modules/services/networking/tedicross.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{ config, pkgs, lib, ... }:

with lib;

let
dataDir = "/var/lib/tedicross";
cfg = config.services.tedicross;
configJSON = pkgs.writeText "tedicross-settings.json" (builtins.toJSON cfg.config);
configYAML = pkgs.runCommand "tedicross-settings.yaml" { preferLocalBuild = true; } ''
${pkgs.remarshal}/bin/json2yaml -i ${configJSON} -o $out
'';

in {
options = {
services.tedicross = {
enable = mkEnableOption "the TediCross Telegram-Discord bridge service";

config = mkOption {
type = types.attrs;
# from https://github.com/TediCross/TediCross/blob/master/example.settings.yaml
example = literalExample ''
{
telegram = {
useFirstNameInsteadOfUsername = false;
colonAfterSenderName = false;
skipOldMessages = true;
sendEmojiWithStickers = true;
};
discord = {
useNickname = false;
skipOldMessages = true;
displayTelegramReplies = "embed";
replyLength = 100;
};
bridges = [
{
name = "Default bridge";
direction = "both";
telegram = {
chatId = -123456789;
relayJoinMessages = true;
relayLeaveMessages = true;
sendUsernames = true;
ignoreCommands = true;
};
discord = {
serverId = "DISCORD_SERVER_ID";
channelId = "DISCORD_CHANNEL_ID";
relayJoinMessages = true;
relayLeaveMessages = true;
sendUsernames = true;
crossDeleteOnTelegram = true;
};
}
];
debug = false;
}
'';
description = ''
<filename>settings.yaml</filename> configuration as a Nix attribute set.
Secret tokens should be specified using <option>environmentFile</option>
instead of this world-readable file.
'';
};

environmentFile = mkOption {
type = types.nullOr types.path;
default = null;
description = ''
File containing environment variables to be passed to the TediCross service,
in which secret tokens can be specified securely using the
<literal>TELEGRAM_BOT_TOKEN</literal> and <literal>DISCORD_BOT_TOKEN</literal>
keys.
'';
};
};
};

config = mkIf cfg.enable {
# from https://github.com/TediCross/TediCross/blob/master/guides/autostart/Linux.md
systemd.services.tedicross = {
description = "TediCross Telegram-Discord bridge service";
wantedBy = [ "multi-user.target" ];
wants = [ "network-online.target" ];
after = [ "network-online.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.nodePackages.tedicross}/bin/tedicross --config='${configYAML}' --data-dir='${dataDir}'";
Restart = "always";
DynamicUser = true;
StateDirectory = baseNameOf dataDir;
EnvironmentFile = cfg.environmentFile;
};
};
};

meta.maintainers = with maintainers; [ pacien ];
}

8 changes: 8 additions & 0 deletions pkgs/development/node-packages/default-v10.nix
Original file line number Diff line number Diff line change
@@ -91,6 +91,14 @@ nodePackages // {
buildInputs = [ pkgs.automake pkgs.autoconf nodePackages.node-gyp-build ];
};

tedicross = nodePackages."tedicross-git+https://github.com/TediCross/TediCross.git#v0.8.7".override {
nativeBuildInputs = [ pkgs.makeWrapper ];
postInstall = ''
makeWrapper '${nodejs}/bin/node' "$out/bin/tedicross" \
--add-flags "$out/lib/node_modules/tedicross/main.js"
'';
};

webtorrent-cli = nodePackages.webtorrent-cli.override {
buildInputs = [ nodePackages.node-gyp-build ];
};
1 change: 1 addition & 0 deletions pkgs/development/node-packages/node-packages-v10.json
Original file line number Diff line number Diff line change
@@ -108,6 +108,7 @@
, "stackdriver-statsd-backend"
, "svgo"
, "swagger"
, { "tedicross": "git+https://github.com/TediCross/TediCross.git#v0.8.7" }
, "tern"
, "textlint"
, "three"
Loading