···
package = mkPackageOption pkgs "livebook" { };
17
-
environmentFile = mkOption {
17
+
environment = mkOption {
18
+
type = with types; attrsOf (nullOr (oneOf [ bool int str ]));
description = lib.mdDoc ''
20
-
Environment file as defined in {manpage}`systemd.exec(5)` passed to the service.
21
+
Environment variables to set.
22
-
This must contain at least `LIVEBOOK_PASSWORD` or
23
-
`LIVEBOOK_TOKEN_ENABLED=false`. See `livebook server --help`
24
-
for other options.'';
27
-
erlang_node_short_name = mkOption {
28
-
type = with types; nullOr str;
30
-
example = "livebook";
31
-
description = "A short name for the distributed node.";
34
-
erlang_node_name = mkOption {
35
-
type = with types; nullOr str;
37
-
example = "livebook@127.0.0.1";
38
-
description = "The name for the app distributed node.";
23
+
Livebook is configured through the use of environment variables. The
24
+
available configuration options can be found in the [Livebook
25
+
documentation](https://hexdocs.pm/livebook/readme.html#environment-variables).
44
-
description = "The port to start the web application on.";
27
+
Note that all environment variables set through this configuration
28
+
parameter will be readable by anyone with access to the host
29
+
machine. Therefore, sensitive information like {env}`LIVEBOOK_PASSWORD`
30
+
or {env}`LIVEBOOK_COOKIE` should never be set using this configuration
31
+
option, but should instead use
32
+
[](#opt-services.livebook.environmentFile). See the documentation for
33
+
that option for more information.
47
-
address = mkOption {
49
-
default = "127.0.0.1";
50
-
description = lib.mdDoc ''
51
-
The address to start the web application on. Must be a valid IPv4 or
35
+
Any environment variables specified in the
36
+
[](#opt-services.livebook.environmentFile) will supersede environment
37
+
variables specified in this option.
56
-
options = mkOption {
57
-
type = with types; attrsOf str;
59
-
description = lib.mdDoc ''
60
-
Additional options to pass as command-line arguments to the server.
example = literalExpression ''
64
-
cookie = "a value shared by all nodes in this cluster";
42
+
LIVEBOOK_PORT = 8080;
47
+
environmentFile = mkOption {
48
+
type = with types; nullOr types.path;
50
+
description = lib.mdDoc ''
51
+
Additional dnvironment file as defined in {manpage}`systemd.exec(5)`.
53
+
Secrets like {env}`LIVEBOOK_PASSWORD` (which is used to specify the
54
+
password needed to access the livebook site) or {env}`LIVEBOOK_COOKIE`
55
+
(which is used to specify the
56
+
[cookie](https://www.erlang.org/doc/reference_manual/distributed.html#security)
57
+
used to connect to the running Elixir system) may be passed to the
58
+
service without making them readable to everyone with access to
59
+
systemctl by using this configuration parameter.
61
+
Note that this file needs to be available on the host on which
62
+
`livebook` is running.
64
+
For security purposes, this file should contain at least
65
+
{env}`LIVEBOOK_PASSWORD` or {env}`LIVEBOOK_TOKEN_ENABLED=false`.
68
+
documentation](https://hexdocs.pm/livebook/readme.html#environment-variables)
69
+
and the [](#opt-services.livebook.environment) configuration parameter
70
+
for further options.
72
+
example = "/var/lib/livebook.env";
extraPackages = mkOption {
type = with types; listOf package;
···
EnvironmentFile = cfg.environmentFile;
86
-
args = lib.cli.toGNUCommandLineShell { } ({
89
-
name = cfg.erlang_node_name;
90
-
sname = cfg.erlang_node_short_name;
93
-
"${cfg.package}/bin/livebook server ${args}";
90
+
ExecStart = "${cfg.package}/bin/livebook start";
92
+
environment = mapAttrs (name: value:
93
+
if isBool value then boolToString value else toString value)
path = [ pkgs.bash ] ++ cfg.extraPackages;
wantedBy = [ "default.target" ];