2023-10-24 18:53:12 +02:00
|
|
|
import ./make-test-python.nix ({ lib, pkgs, ... }: {
|
|
|
|
name = "livebook-service";
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
machine = { config, pkgs, ... }: {
|
|
|
|
imports = [
|
|
|
|
./common/user-account.nix
|
|
|
|
];
|
|
|
|
|
|
|
|
services.livebook = {
|
|
|
|
enableUserService = true;
|
2024-01-23 22:36:52 +01:00
|
|
|
environment = {
|
|
|
|
LIVEBOOK_PORT = 20123;
|
|
|
|
LIVEBOOK_COOKIE = "chocolate chip";
|
|
|
|
LIVEBOOK_TOKEN_ENABLED = true;
|
|
|
|
|
|
|
|
};
|
2023-10-24 18:53:12 +02:00
|
|
|
environmentFile = pkgs.writeText "livebook.env" ''
|
2023-12-24 19:45:12 +01:00
|
|
|
LIVEBOOK_PASSWORD = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
2023-10-24 18:53:12 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = { nodes, ... }:
|
|
|
|
let
|
2023-12-24 21:54:24 +01:00
|
|
|
user = nodes.machine.users.users.alice;
|
2023-10-24 18:53:12 +02:00
|
|
|
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'")
|
|
|
|
'';
|
|
|
|
})
|