Teamtype

Peer-to-peer, editor-agnostic collaborative editing of local text files.

Declared in: projects/Teamtype/default.nix

Try the program in a shell

  1. Install Nix
    Bash
    $ apt install --yes curl git jq nix
    Bash
    $ apt install --yes curl git jq nix
    Bash
    $ pacman --sync --refresh --noconfirm curl git jq nix
  2. Download a configuration file
    # default.nix
    {
      ngipkgs ? import (fetchTarball "https://github.com/ngi-nix/ngipkgs/tarball/main") { },
    }:
    ngipkgs.demo-shell (
      { pkgs, ... }:
    
      {
        programs.teamtype.enable = true;
    
        programs.vscode = {
          enable = true;
          # vscodium because vscode is unfree
          package = pkgs.vscodium;
          extensions = [
            pkgs.vscode-extensions.teamtype.teamtype
          ];
        };
    
        programs.neovim = {
          enable = true;
          configure = {
            packages.teamtype = {
              start = [
                pkgs.vimPlugins.teamtype
              ];
            };
          };
        };
      }
    )
    
  3. Enable binary substituters
    Bash
    $ export NIX_CONFIG='substituters = https://cache.nixos.org/ https://ngi.cachix.org/
    trusted-public-keys = cache.nixos.org-1:6nchdd59x431o0gwypbmraurkbj16zpmqfgspcdshjy= ngi.cachix.org-1:n+cal72roc3qqulxihpv+tw5t42whxmmhpragkrsrow='
  4. Build and run the shell
    Bash
    $ nix-build ./default.nix && ./result
    Bash
    $ nix-build ./default.nix && ./result
    Bash
    $ rev=$(nix-instantiate --eval --attr sources.nixpkgs.rev https://github.com/ngi-nix/ngipkgs/archive/master.tar.gz | jq --raw-output)
    $ nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/$rev.tar.gz --packages nix --run "nix-build ./default.nix && ./result"
    Bash
    $ nix-build ./default.nix && ./result
  5. Usage Instructions
    1. First, create a directory with a subdirectory named .teamtype and share it:

      $ mkdir .teamtype
      $ teamtype share --show-secret-address
      

      Wait a few seconds and a secret address will be printed that can be used to connect to this server.

    2. Next, create another directory and add the secret address from the previous step to its config file:

      $ mkdir .teamtype
      $ echo peer="<secret-address>" >.teamtype/config
      $ teamtype join
      

      Then, join the shared directory:

      $ teamtype join
      

      The two directories are now connected.

    3. You can now edit files in one directory and the changes will be synchronized in the other. If you use Neovim, the instance in this shell has also been configured with the Teamtype plugin, so you can try using :TeamtypeInfo and :TeamtypeJumpToCursor.

      For more information on using this project, please refer to the project documentation.

Examples

Enable Teamtype
{ pkgs, ... }:

{
  programs.teamtype.enable = true;

  programs.vscode = {
    enable = true;
    # vscodium because vscode is unfree
    package = pkgs.vscodium;
    extensions = [
      pkgs.vscode-extensions.teamtype.teamtype
    ];
  };

  programs.neovim = {
    enable = true;
    configure = {
      packages.teamtype = {
        start = [
          pkgs.vimPlugins.teamtype
        ];
      };
    };
  };
}

Declared in: projects/Teamtype/programs/teamtype/examples/basic.nix

This project is funded by NLnet through these subgrants:

Core
Teamtype

Related links: