mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
livebook: add systemd user service, test, and docs
Co-authored-by: Yt <happysalada@tuta.io>
This commit is contained in:
parent
0fa36ea34f
commit
fa54eeea5c
7 changed files with 181 additions and 1 deletions
|
@ -371,6 +371,7 @@ in {
|
|||
honk = runTest ./honk.nix;
|
||||
installed-tests = pkgs.recurseIntoAttrs (handleTest ./installed-tests {});
|
||||
invidious = handleTest ./invidious.nix {};
|
||||
livebook-service = handleTest ./livebook-service.nix {};
|
||||
oci-containers = handleTestOn ["aarch64-linux" "x86_64-linux"] ./oci-containers.nix {};
|
||||
odoo = handleTest ./odoo.nix {};
|
||||
odoo15 = handleTest ./odoo.nix { package = pkgs.odoo15; };
|
||||
|
|
43
nixos/tests/livebook-service.nix
Normal file
43
nixos/tests/livebook-service.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
import ./make-test-python.nix ({ lib, pkgs, ... }: {
|
||||
name = "livebook-service";
|
||||
|
||||
nodes = {
|
||||
machine = { config, pkgs, ... }: {
|
||||
imports = [
|
||||
./common/user-account.nix
|
||||
];
|
||||
|
||||
services.livebook = {
|
||||
enableUserService = true;
|
||||
port = 20123;
|
||||
environmentFile = pkgs.writeText "livebook.env" ''
|
||||
LIVEBOOK_PASSWORD = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
'';
|
||||
options = {
|
||||
cookie = "chocolate chip";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = { nodes, ... }:
|
||||
let
|
||||
user = nodes.machine.config.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'")
|
||||
'';
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue