depot/third_party/nixpkgs/nixos/modules/services/development/livebook.md
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

1.5 KiB

Livebook

Livebook is a web application for writing interactive and collaborative code notebooks.

Basic Usage

Enabling the livebook service creates a user systemd unit which runs the server.

{ ... }:

{
  services.livebook = {
    enableUserService = true;
    port = 20123;
    # See note below about security
    environmentFile = pkgs.writeText "livebook.env" ''
      LIVEBOOK_PASSWORD = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    '';
  };
}

::: {.note}

The Livebook server has the ability to run any command as the user it is running under, so securing access to it with a password is highly recommended.

Putting the password in the Nix configuration like above is an easy way to get started but it is not recommended in the real world because the livebook.env file will be added to the world-readable Nix store. A better approach would be to put the password in some secure user-readable location and set environmentFile = /home/user/secure/livebook.env.

:::

Extra dependencies

By default, the Livebook service is run with minimum dependencies, but some features require additional packages. For example, the machine learning Kinos require gcc and gnumake. To add these, use extraPackages:

services.livebook.extraPackages = with pkgs; [ gcc gnumake ];