1# Livebook {#module-services-livebook}
2
3[Livebook](https://livebook.dev/) is a web application for writing
4interactive and collaborative code notebooks.
5
6## Basic Usage {#module-services-livebook-basic-usage}
7
8Enabling the `livebook` service creates a user
9[`systemd`](https://www.freedesktop.org/wiki/Software/systemd/) unit
10which runs the server.
11
12```
13{ ... }:
14
15{
16 services.livebook = {
17 enableUserService = true;
18 port = 20123;
19 # See note below about security
20 environmentFile = pkgs.writeText "livebook.env" ''
21 LIVEBOOK_PASSWORD = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
22 '';
23 };
24}
25```
26
27::: {.note}
28
29The Livebook server has the ability to run any command as the user it
30is running under, so securing access to it with a password is highly
31recommended.
32
33Putting the password in the Nix configuration like above is an easy
34way to get started but it is not recommended in the real world because
35the `livebook.env` file will be added to the world-readable Nix store.
36A better approach would be to put the password in some secure
37user-readable location and set `environmentFile = /home/user/secure/livebook.env`.
38
39:::