nixedo: add beaverhabits
This commit is contained in:
parent
6154af49b7
commit
9ea5655669
|
@ -6,6 +6,7 @@
|
|||
|
||||
homelab = {
|
||||
audiobookshelf.enable = true;
|
||||
beaverhabits.enable = true;
|
||||
forgejo.enable = true;
|
||||
freshrss.enable = true;
|
||||
gitea.enable = true;
|
||||
|
|
102
nix/modules/nixos/features/homelab/beaverhabits.nix
Normal file
102
nix/modules/nixos/features/homelab/beaverhabits.nix
Normal file
|
@ -0,0 +1,102 @@
|
|||
# Auto-generated using compose2nix v0.3.2-pre.
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.features.homelab.beaverhabits;
|
||||
|
||||
port = 8084;
|
||||
in
|
||||
{
|
||||
options.features.homelab.beaverhabits.enable = mkEnableOption "Enable beaverhabits";
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
virtualisation = {
|
||||
docker = {
|
||||
enable = true;
|
||||
autoPrune.enable = true;
|
||||
};
|
||||
|
||||
oci-containers = {
|
||||
backend = "docker";
|
||||
|
||||
containers."beaverhabits" = {
|
||||
image = "daya0576/beaverhabits:latest";
|
||||
|
||||
environment = {
|
||||
"HABITS_STORAGE" = "DATABASE";
|
||||
};
|
||||
|
||||
volumes = [
|
||||
"/mnt/media/beaverhabits:/app/.user:rw"
|
||||
];
|
||||
|
||||
ports = [
|
||||
"${toString port}:8080/tcp"
|
||||
];
|
||||
|
||||
user = "1000:1000";
|
||||
|
||||
log-driver = "journald";
|
||||
|
||||
extraOptions = [
|
||||
"--network-alias=beaverhabits"
|
||||
"--network=beaverhabits_default"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd = {
|
||||
services = {
|
||||
"docker-beaverhabits" = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
RestartMaxDelaySec = lib.mkOverride 90 "1m";
|
||||
RestartSec = lib.mkOverride 90 "100ms";
|
||||
RestartSteps = lib.mkOverride 90 9;
|
||||
};
|
||||
|
||||
after = [ "docker-network-beaverhabits_default.service" ];
|
||||
requires = [ "docker-network-beaverhabits_default.service" ];
|
||||
partOf = [ "docker-compose-beaverhabits-root.target" ];
|
||||
wantedBy = [ "docker-compose-beaverhabits-root.target" ];
|
||||
};
|
||||
|
||||
"docker-network-beaverhabits_default" = {
|
||||
path = [ pkgs.docker ];
|
||||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
ExecStop = "docker network rm -f beaverhabits_default";
|
||||
};
|
||||
|
||||
script = ''
|
||||
docker network inspect beaverhabits_default || docker network create beaverhabits_default
|
||||
'';
|
||||
|
||||
partOf = [ "docker-compose-beaverhabits-root.target" ];
|
||||
wantedBy = [ "docker-compose-beaverhabits-root.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
targets."docker-compose-beaverhabits-root" = {
|
||||
unitConfig.Description = "Root target generated by compose2nix.";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
services.caddy.virtualHosts."beaverhabits.opdavies.uk" = {
|
||||
useACMEHost = "opdavies.uk";
|
||||
|
||||
extraConfig = "reverse_proxy localhost:${toString port}";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
imports = [
|
||||
./audiobookshelf.nix
|
||||
./beaverhabits.nix
|
||||
./forgejo.nix
|
||||
./freshrss.nix
|
||||
./gitea.nix
|
||||
|
|
Loading…
Reference in a new issue