vuls: init at 0.27.0
[NixPkgs.git] / nixos / tests / livebook-service.nix
blob2d699efb1e3ee74d6401a0d22881b2fd5fef5c9b
1 import ./make-test-python.nix ({ lib, pkgs, ... }: {
2   name = "livebook-service";
4   nodes = {
5     machine = { config, pkgs, ... }: {
6       imports = [
7         ./common/user-account.nix
8       ];
10       services.livebook = {
11         enableUserService = true;
12         environment = {
13           LIVEBOOK_PORT = 20123;
14         };
15         environmentFile = pkgs.writeText "livebook.env" ''
16           LIVEBOOK_PASSWORD = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
17         '';
18       };
19     };
20   };
22   testScript = { nodes, ... }:
23     let
24       user = nodes.machine.users.users.alice;
25       sudo = lib.concatStringsSep " " [
26         "XDG_RUNTIME_DIR=/run/user/${toString user.uid}"
27         "sudo"
28         "--preserve-env=XDG_RUNTIME_DIR"
29         "-u"
30         "alice"
31       ];
32     in
33     ''
34       machine.wait_for_unit("multi-user.target")
36       machine.succeed("loginctl enable-linger alice")
37       machine.wait_until_succeeds("${sudo} systemctl --user is-active livebook.service")
38       machine.wait_for_open_port(20123, timeout=10)
40       machine.succeed("curl -L localhost:20123 | grep 'Type password'")
41     '';