nixos-config/modules/livebook/default.nix

47 lines
997 B
Nix
Raw Normal View History

{ config
, lib
, ...
2022-03-01 22:19:03 +01:00
}:
with lib; let
cfg = config.eboskma.livebook;
in
{
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 {
eboskma.podman.enable = true;
virtualisation.oci-containers.containers = {
livebook = {
autoStart = true;
image = "livebook/livebook";
environmentFiles = [
config.sops.secrets.livebook-password.path
];
ports = [
"8080:8080"
"8081:8081"
];
volumes = [
"${cfg.dataDir}:/data"
2022-06-27 10:10:04 +02:00
"/run/secrets/livebook_cookie:/app/releases/COOKIE"
];
extraOptions = [
"--pull=always"
"--user=${cfg.userMapping}"
];
};
};
};
}