podman: added redmage image

This commit is contained in:
Tigor Hutasuhut 2024-06-18 19:18:44 +07:00
parent b467579748
commit 3c6bdf0ee3
5 changed files with 100 additions and 4 deletions

View file

@ -6,5 +6,7 @@
pihole.enable = lib.mkEnableOption "pihole podman"; pihole.enable = lib.mkEnableOption "pihole podman";
suwayomi.enable = lib.mkEnableOption "suwayomi podman"; suwayomi.enable = lib.mkEnableOption "suwayomi podman";
ytptube.enable = lib.mkEnableOption "metube podman"; ytptube.enable = lib.mkEnableOption "metube podman";
redmage.enable = lib.mkEnableOption "redmage podman";
redmage-demo.enable = lib.mkEnableOption "redmage-demo podman";
}; };
} }

View file

@ -28,6 +28,8 @@
pihole.enable = true; pihole.enable = true;
suwayomi.enable = true; suwayomi.enable = true;
ytptube.enable = true; ytptube.enable = true;
redmage.enable = true;
redmage-demo.enable = true;
}; };
docker = { docker = {

View file

@ -34,14 +34,18 @@ in
# Taken IP-Range Subnets # Taken IP-Range Subnets
# #
# 10.1.1.0-4 -> Pihole # 10.1.1.0-3 -> Pihole
# 10.1.1.4-8 -> ytptube # 10.1.1.4-7 -> ytptube
# 10.1.1.8-12 -> Suwayomi # 10.1.1.8-11 -> Suwayomi
# 10.1.1.12-16 -> Suwayomi # 10.1.1.12-15 -> Suwayomi
# 10.1.1.16-19 -> Redmage
# 10.1.1.20-23 -> Redmage Demo
imports = [ imports = [
./caddy.nix ./caddy.nix
./pihole.nix ./pihole.nix
./suwayomi.nix ./suwayomi.nix
./ytptube.nix ./ytptube.nix
./redmage.nix
./redmage-demo.nix
]; ];
} }

View file

@ -0,0 +1,44 @@
{ config, lib, ... }:
let
name = "redmage-demo";
podman = config.profile.podman;
inherit (lib) mkIf;
ip = "10.88.0.3";
image = "git.tigor.web.id/tigor/redmage:latest";
rootVolume = "/nas/redmage-demo";
domain = "${name}.tigor.web.id";
user = config.profile.user;
uid = toString user.uid;
gid = toString user.gid;
in
{
config = mkIf (podman.enable && podman.${name}.enable) {
services.caddy.virtualHosts.${domain}.extraConfig = ''
reverse_proxy ${ip}:8080
'';
system.activationScripts."podman-${name}" = ''
mkdir -p ${rootVolume}/db
mkdir -p ${rootVolume}/images
chown ${uid}:${gid} ${rootVolume} ${rootVolume}/db ${rootVolume}/images
'';
virtualisation.oci-containers.containers.${name} = {
inherit image;
autoStart = true;
user = "${uid}:${gid}";
environment = {
TZ = "Asia/Jakarta";
};
volumes = [
"${rootVolume}/db:/app/db"
"${rootVolume}/images:/app/downloads"
];
extraOptions = [
"--network=podman"
"--ip=${ip}"
];
};
};
}

44
system/podman/redmage.nix Normal file
View file

@ -0,0 +1,44 @@
{ config, lib, ... }:
let
name = "redmage";
podman = config.profile.podman;
inherit (lib) mkIf;
ip = "10.88.0.2";
image = "git.tigor.web.id/tigor/redmage:latest";
rootVolume = "/nas/redmage";
domain = "${name}.tigor.web.id";
user = config.profile.user;
uid = toString user.uid;
gid = toString user.gid;
in
{
config = mkIf (podman.enable && podman.${name}.enable) {
services.caddy.virtualHosts.${domain}.extraConfig = ''
reverse_proxy ${ip}:8080
'';
system.activationScripts."podman-${name}" = ''
mkdir -p ${rootVolume}/db
mkdir -p ${rootVolume}/images
chown ${uid}:${gid} ${rootVolume} ${rootVolume}/db ${rootVolume}/images
'';
virtualisation.oci-containers.containers.${name} = {
inherit image;
autoStart = true;
user = "${uid}:${gid}";
environment = {
TZ = "Asia/Jakarta";
};
volumes = [
"${rootVolume}/db:/app/db"
"${rootVolume}/images:/app/downloads"
];
extraOptions = [
"--network=podman"
"--ip=${ip}"
];
};
};
}