From cafa6e4097de7090b192a13e0beddfd65a51f8ce Mon Sep 17 00:00:00 2001 From: Toast Date: Fri, 10 Nov 2023 10:56:48 +0100 Subject: [PATCH] School: add xampp --- roles/school/services/default.nix | 1 + roles/school/services/xampp.nix | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 roles/school/services/xampp.nix diff --git a/roles/school/services/default.nix b/roles/school/services/default.nix index 1e5b9bb..703919f 100644 --- a/roles/school/services/default.nix +++ b/roles/school/services/default.nix @@ -4,5 +4,6 @@ imports = [ ./syncthing.nix ./mysql.nix + ./xampp.nix ]; } diff --git a/roles/school/services/xampp.nix b/roles/school/services/xampp.nix new file mode 100644 index 0000000..1ec12a2 --- /dev/null +++ b/roles/school/services/xampp.nix @@ -0,0 +1,29 @@ +{ config, ... }: + +{ + # I tried setting up httpd + php in class but I just gave up + virtualisation.oci-containers = { + containers."xampp" = { + autoStart = false; + image = "tomsik68/xampp"; + #user = "${toString users.users.atfc.uid}:${toString users.groups.minecraft.gid}"; + volumes = [ + "xampp-mysql:/opt/lampp/var/mysql" + ]; + ports = [ "41061:22" "41062:80" ]; + }; + }; + + security.polkit.extraConfig = '' + polkit.addRule(function(action, subject) { + if ( + action.id == "org.freedesktop.systemd1.manage-units" && + action.lookup("unit") == "podman-xampp.service" && + subject.user == "toast" + ) + { + return polkit.Result.YES; + } + }) + ''; +} \ No newline at end of file