From a3187e973ad8cbe02d84185c4c58caeaec3f0b89 Mon Sep 17 00:00:00 2001 From: voidarc Date: Tue, 29 Sep 2026 10:10:59 +0100 Subject: [PATCH] added warpgate (very cool) --- modules/containers/default.nix | 1 + modules/containers/warpgate/container.nix | 63 +++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 modules/containers/warpgate/container.nix diff --git a/modules/containers/default.nix b/modules/containers/default.nix index cbc8be2..7682d00 100644 --- a/modules/containers/default.nix +++ b/modules/containers/default.nix @@ -19,6 +19,7 @@ containerNginxHomeAssistant containerSilverbullet containerPaperless + containerWarpgate ]; in { imports = modules; diff --git a/modules/containers/warpgate/container.nix b/modules/containers/warpgate/container.nix new file mode 100644 index 0000000..fa2b5a6 --- /dev/null +++ b/modules/containers/warpgate/container.nix @@ -0,0 +1,63 @@ +{moduleWithSystem, ...}: { + flake.nixosModules.containerWarpgate = moduleWithSystem ({pkgs, ...}: { + virtualisation.oci-containers.containers."warpgate-warpgate" = { + image = "ghcr.io/warp-tech/warpgate"; + volumes = [ + "/containers/warpgate/data:/data:rw" + ]; + ports = [ + "2222:2222/tcp" + "8888:8888/tcp" + "33306:33306/tcp" + ]; + log-driver = "journald"; + # cmd = ["warpgate" "--skip-securing-files"]; + extraOptions = [ + "--network-alias=warpgate" + "--network=warpgate_default" + ]; + }; + systemd.services."podman-warpgate-warpgate" = { + serviceConfig = { + Restart = pkgs.lib.mkOverride 90 "always"; + }; + after = [ + "podman-network-warpgate_default.service" + ]; + requires = [ + "podman-network-warpgate_default.service" + ]; + partOf = [ + "podman-compose-warpgate-root.target" + ]; + wantedBy = [ + "podman-compose-warpgate-root.target" + ]; + }; + + # Networks + systemd.services."podman-network-warpgate_default" = { + path = [pkgs.podman]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStop = "podman network rm -f warpgate_default"; + }; + script = '' + podman network inspect warpgate_default || podman network create warpgate_default + ''; + partOf = ["podman-compose-warpgate-root.target"]; + wantedBy = ["podman-compose-warpgate-root.target"]; + }; + + # Root service + # When started, this will automatically create all resources and start + # the containers. When stopped, this will teardown all resources. + systemd.targets."podman-compose-warpgate-root" = { + unitConfig = { + Description = "Root target generated by compose2nix."; + }; + wantedBy = ["multi-user.target"]; + }; + }); +}