2022-02-11 11:30:51 +01:00
|
|
|
{
|
2022-03-01 22:19:03 +01:00
|
|
|
pkgs,
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
|
|
|
cfg = config.eboskma.livebook;
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf (cfg.enable) {
|
|
|
|
eboskma.docker.enable = true;
|
|
|
|
|
|
|
|
virtualisation.oci-containers.containers = {
|
|
|
|
livebook = {
|
|
|
|
autoStart = true;
|
|
|
|
image = "livebook/livebook";
|
|
|
|
ports = [
|
|
|
|
"8080:8080"
|
|
|
|
];
|
|
|
|
volumes = [
|
|
|
|
"${cfg.dataDir}:/data"
|
|
|
|
];
|
|
|
|
extraOptions = [
|
|
|
|
"--pull=always"
|
|
|
|
"--user=${cfg.userMapping}"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|