wip vault
This commit is contained in:
parent
4bab9c4f86
commit
2bec46813c
1 changed files with 50 additions and 8 deletions
|
@ -1,19 +1,52 @@
|
||||||
{
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
name = "vaultwarden";
|
||||||
|
hostDataDir = "/var/lib/${name}";
|
||||||
|
localAddress = "192.168.100.111";
|
||||||
|
|
||||||
|
binds = [
|
||||||
|
{
|
||||||
|
host = "${hostDataDir}/data";
|
||||||
|
container = "/data?";
|
||||||
|
user = config.users.users.vaultwarden.name;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
in
|
||||||
{
|
{
|
||||||
containers.vaultwarden = {
|
users = lib.foldl (
|
||||||
|
acc: bind:
|
||||||
|
{
|
||||||
|
users.${bind.user} = {
|
||||||
|
isSystemUser = true;
|
||||||
|
home = bind.host;
|
||||||
|
createHome = true;
|
||||||
|
group = bind.user;
|
||||||
|
};
|
||||||
|
groups.${bind.user} = { };
|
||||||
|
}
|
||||||
|
// acc
|
||||||
|
) { } binds;
|
||||||
|
|
||||||
|
containers.${name} = {
|
||||||
ephemeral = true;
|
ephemeral = true;
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
privateNetwork = true;
|
privateNetwork = true;
|
||||||
hostAddress = "192.168.100.2";
|
hostAddress = "192.168.100.2";
|
||||||
localAddress = "192.168.100.12";
|
localAddress = localAddress;
|
||||||
bindMounts = {
|
bindMounts = lib.foldl (
|
||||||
"/incontainer" = {
|
acc: bind:
|
||||||
hostPath = "/asd";
|
{
|
||||||
isReadOnly = false;
|
"${bind.container}" = {
|
||||||
};
|
hostPath = bind.host;
|
||||||
};
|
isReadOnly = false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// acc
|
||||||
|
) { } binds;
|
||||||
config =
|
config =
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
|
@ -28,4 +61,13 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.nginx.virtualHosts."vault.joshuabell.xyz" = {
|
||||||
|
enableACME = true;
|
||||||
|
forceSSL = true;
|
||||||
|
locations = {
|
||||||
|
"/" = {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue