2024-02-05 11:46:52 +01:00
|
|
|
{ config, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
2022-03-01 22:19:03 +01:00
|
|
|
cfg = config.eboskma.livebook;
|
2022-04-27 00:21:19 +02:00
|
|
|
in
|
|
|
|
{
|
2022-02-11 11:30:51 +01:00
|
|
|
options.eboskma.livebook = {
|
|
|
|
enable = mkEnableOption "Start a livebook container";
|
|
|
|
dataDir = mkOption {
|
|
|
|
description = "Livebook data directory";
|
|
|
|
type = types.path;
|
|
|
|
};
|
|
|
|
userMapping = mkOption {
|
|
|
|
description = "User to run the container as";
|
|
|
|
type = types.str;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-05-03 18:17:38 +02:00
|
|
|
config = mkIf cfg.enable {
|
2023-12-20 11:25:45 +01:00
|
|
|
eboskma.podman.enable = true;
|
2022-02-11 11:30:51 +01:00
|
|
|
|
|
|
|
virtualisation.oci-containers.containers = {
|
|
|
|
livebook = {
|
|
|
|
autoStart = true;
|
|
|
|
image = "livebook/livebook";
|
2024-02-05 11:46:52 +01:00
|
|
|
environmentFiles = [ config.sops.secrets.livebook-password.path ];
|
2022-02-11 11:30:51 +01:00
|
|
|
ports = [
|
|
|
|
"8080:8080"
|
2022-12-12 16:38:14 +01:00
|
|
|
"8081:8081"
|
2022-02-11 11:30:51 +01:00
|
|
|
];
|
|
|
|
volumes = [
|
|
|
|
"${cfg.dataDir}:/data"
|
2022-06-27 10:10:04 +02:00
|
|
|
"/run/secrets/livebook_cookie:/app/releases/COOKIE"
|
2022-02-11 11:30:51 +01:00
|
|
|
];
|
|
|
|
extraOptions = [
|
|
|
|
"--pull=always"
|
|
|
|
"--user=${cfg.userMapping}"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|