mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 01:13:05 +00:00
897d5670a3
The current build of livebook does not work with the new [Livebook Teams](https://livebook.dev/teams/) features. The problem can be observed by running the current version of livebook, adding a new team and going to the team page. The process will crash and the team page will show a 500 error. The base of the problem is that the escript build method is not officially supported. This commit changes the livebook package to use the `mix release` workflow, which is also the one used to build the official Docker container. Unfortunately, the binary built with `mix release` does not support command line arguments like the `escript` binary does. Instead, users need to pass in most of the configuration as environment variables, as documented [here](https://hexdocs.pm/livebook/readme.html#environment-variables). As a result, this commit also changes the Livebook service to reflect this new way of configuring Livebook. Finally, the Livebook release configuration specifically excludes the ERTS (Erlang Runtime System), which means that the resulting release cannot run without Erlang installed. I have tested the results (both of the package and the service) locally.
46 lines
1.1 KiB
Nix
46 lines
1.1 KiB
Nix
import ./make-test-python.nix ({ lib, pkgs, ... }: {
|
|
name = "livebook-service";
|
|
|
|
nodes = {
|
|
machine = { config, pkgs, ... }: {
|
|
imports = [
|
|
./common/user-account.nix
|
|
];
|
|
|
|
services.livebook = {
|
|
enableUserService = true;
|
|
environment = {
|
|
LIVEBOOK_PORT = 20123;
|
|
LIVEBOOK_COOKIE = "chocolate chip";
|
|
LIVEBOOK_TOKEN_ENABLED = true;
|
|
|
|
};
|
|
environmentFile = pkgs.writeText "livebook.env" ''
|
|
LIVEBOOK_PASSWORD = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = { nodes, ... }:
|
|
let
|
|
user = nodes.machine.users.users.alice;
|
|
sudo = lib.concatStringsSep " " [
|
|
"XDG_RUNTIME_DIR=/run/user/${toString user.uid}"
|
|
"sudo"
|
|
"--preserve-env=XDG_RUNTIME_DIR"
|
|
"-u"
|
|
"alice"
|
|
];
|
|
in
|
|
''
|
|
machine.wait_for_unit("multi-user.target")
|
|
|
|
machine.succeed("loginctl enable-linger alice")
|
|
machine.wait_until_succeeds("${sudo} systemctl --user is-active livebook.service")
|
|
machine.wait_for_open_port(20123)
|
|
|
|
machine.succeed("curl -L localhost:20123 | grep 'Type password'")
|
|
'';
|
|
})
|