2024-10-11 23:27:07 +03:00
|
|
|
{
|
2024-11-04 04:37:29 +03:00
|
|
|
config,
|
|
|
|
container,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
cfg = config.container.module.pass;
|
|
|
|
in {
|
|
|
|
options.container.module.pass = {
|
|
|
|
enable = lib.mkEnableOption "the password manager.";
|
|
|
|
address = lib.mkOption {
|
|
|
|
default = "10.1.0.9";
|
|
|
|
type = lib.types.str;
|
|
|
|
};
|
|
|
|
port = lib.mkOption {
|
|
|
|
default = 8000;
|
|
|
|
type = lib.types.int;
|
|
|
|
};
|
|
|
|
domain = lib.mkOption {
|
|
|
|
default = "pass.${config.container.domain}";
|
|
|
|
type = lib.types.str;
|
|
|
|
};
|
|
|
|
storage = lib.mkOption {
|
|
|
|
default = "${config.container.storage}/pass";
|
|
|
|
type = lib.types.str;
|
|
|
|
};
|
|
|
|
};
|
2024-06-25 04:04:39 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
systemd.tmpfiles.rules = container.mkContainerDir cfg [
|
|
|
|
"data"
|
|
|
|
];
|
2024-06-25 04:04:39 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
containers.pass = container.mkContainer cfg {
|
|
|
|
bindMounts = {
|
|
|
|
"/var/lib/bitwarden_rs" = {
|
|
|
|
hostPath = "${cfg.storage}/data";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
|
2024-11-04 04:37:29 +03:00
|
|
|
config = { ... }: container.mkContainerConfig cfg {
|
|
|
|
services.vaultwarden = {
|
|
|
|
enable = true;
|
|
|
|
dbBackend = "sqlite";
|
|
|
|
environmentFile = "/var/lib/bitwarden_rs/Env";
|
|
|
|
config = {
|
|
|
|
DATA_FOLDER = "/var/lib/bitwarden_rs";
|
|
|
|
DOMAIN = "http://${cfg.domain}";
|
|
|
|
ROCKET_ADDRESS = cfg.address;
|
|
|
|
ROCKET_PORT = cfg.port;
|
|
|
|
SIGNUPS_ALLOWED = false;
|
|
|
|
WEB_VAULT_ENABLED = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-06-09 23:35:53 +03:00
|
|
|
}
|