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```nix 13{ ... }: 14 15{ 16 services.livebook = { 17 enableUserService = true; 18 environment = { 19 LIVEBOOK_PORT = 20123; 20 LIVEBOOK_PASSWORD = "mypassword"; 21 }; 22 # See note below about security 23 environmentFile = "/var/lib/livebook.env"; 24 }; 25} 26``` 27 28::: {.note} 29 30The Livebook server has the ability to run any command as the user it 31is running under, so securing access to it with a password is highly 32recommended. 33 34Putting the password in the Nix configuration like above is an easy way to get 35started but it is not recommended in the real world because the resulting 36environment variables can be read by unprivileged users. A better approach 37would be to put the password in some secure user-readable location and set 38`environmentFile = /home/user/secure/livebook.env`. 39 40::: 41 42The [Livebook 43documentation](https://hexdocs.pm/livebook/readme.html#environment-variables) 44lists all the applicable environment variables. It is recommended to at least 45set `LIVEBOOK_PASSWORD` or `LIVEBOOK_TOKEN_ENABLED=false`. 46 47### Extra dependencies {#module-services-livebook-extra-dependencies} 48 49By default, the Livebook service is run with minimum dependencies, but 50some features require additional packages. For example, the machine 51learning Kinos require `gcc` and `gnumake`. To add these, use 52`extraPackages`: 53 54```nix 55{ 56 services.livebook.extraPackages = with pkgs; [ gcc gnumake ]; 57} 58```