about summary refs log tree commit diff
path: root/nixos/modules/services/development
diff options
context:
space:
mode:
authorAlexandru Scvortov <code@scvalex.net>2023-12-24 18:45:12 +0000
committerAlexandru Scvortov <code@scvalex.net>2023-12-25 21:47:14 +0000
commit0ae9c34391d79c14d33b7dc60ca95d34f3643e72 (patch)
tree5fa52aaea9b12becda9654347e7390f894a976cf /nixos/modules/services/development
parent067338523e91bce5a57a2630554eba8c51feb92c (diff)
downloadnixlib-0ae9c34391d79c14d33b7dc60ca95d34f3643e72.tar
nixlib-0ae9c34391d79c14d33b7dc60ca95d34f3643e72.tar.gz
nixlib-0ae9c34391d79c14d33b7dc60ca95d34f3643e72.tar.bz2
nixlib-0ae9c34391d79c14d33b7dc60ca95d34f3643e72.tar.lz
nixlib-0ae9c34391d79c14d33b7dc60ca95d34f3643e72.tar.xz
nixlib-0ae9c34391d79c14d33b7dc60ca95d34f3643e72.tar.zst
nixlib-0ae9c34391d79c14d33b7dc60ca95d34f3643e72.zip
livebook: configurable package and extraPackages
Also fix examples to not include a semicolon in the .env file.
Diffstat (limited to 'nixos/modules/services/development')
-rw-r--r--nixos/modules/services/development/livebook.md13
-rw-r--r--nixos/modules/services/development/livebook.nix15
2 files changed, 25 insertions, 3 deletions
diff --git a/nixos/modules/services/development/livebook.md b/nixos/modules/services/development/livebook.md
index 73ddc57f6179..5012e977a4f7 100644
--- a/nixos/modules/services/development/livebook.md
+++ b/nixos/modules/services/development/livebook.md
@@ -18,7 +18,7 @@ which runs the server.
     port = 20123;
     # See note below about security
     environmentFile = pkgs.writeText "livebook.env" ''
-      LIVEBOOK_PASSWORD = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+      LIVEBOOK_PASSWORD = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
     '';
   };
 }
@@ -37,3 +37,14 @@ A better approach would be to put the password in some secure
 user-readable location and set `environmentFile = /home/user/secure/livebook.env`.
 
 :::
+
+### Extra dependencies {#module-services-livebook-extra-dependencies}
+
+By default, the Livebook service is run with minimum dependencies, but
+some features require additional packages.  For example, the machine
+learning Kinos require `gcc` and `gnumake`.  To add these, use
+`extraPackages`:
+
+```
+services.livebook.extraPackages = with pkgs; [ gcc gnumake ];
+```
diff --git a/nixos/modules/services/development/livebook.nix b/nixos/modules/services/development/livebook.nix
index 3991a4125ec3..75729ff28efa 100644
--- a/nixos/modules/services/development/livebook.nix
+++ b/nixos/modules/services/development/livebook.nix
@@ -12,6 +12,8 @@ in
     # future, this can be changed to a system service.
     enableUserService = mkEnableOption "a user service for Livebook";
 
+    package = mkPackageOption pkgs "livebook" { };
+
     environmentFile = mkOption {
       type = types.path;
       description = lib.mdDoc ''
@@ -63,6 +65,15 @@ in
         }
       '';
     };
+
+    extraPackages = mkOption {
+      type = with types; listOf package;
+      default = [ ];
+      description = lib.mdDoc ''
+        Extra packages to make available to the Livebook service.
+      '';
+      example = literalExpression "with pkgs; [ gcc gnumake ]";
+    };
   };
 
   config = mkIf cfg.enableUserService {
@@ -79,9 +90,9 @@ in
               sname = cfg.erlang_node_short_name;
             } // cfg.options);
           in
-          "${pkgs.livebook}/bin/livebook server ${args}";
+            "${cfg.package}/bin/livebook server ${args}";
       };
-      path = [ pkgs.bash ];
+      path = [ pkgs.bash ] ++ cfg.extraPackages;
       wantedBy = [ "default.target" ];
     };
   };