From f970f53e74b612d2956b8f229476855605315dc6 Mon Sep 17 00:00:00 2001
From: Zynh Ludwig <zynh0722@gmail.com>
Date: Fri, 27 Dec 2024 01:46:11 -0800
Subject: [PATCH] nyazoom: module init

---
 configuration.nix   |  2 ++
 modules/nyazoom.nix | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 modules/nyazoom.nix

diff --git a/configuration.nix b/configuration.nix
index 949a019..0280790 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -11,6 +11,8 @@
   boot.loader.grub.enable = true;
   boot.loader.grub.device = "/dev/vda";
 
+  permafrost.nyazoom.enable = true;
+
   networking.hostName = "virtmsi"; # Define your hostname.
   # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.
 
diff --git a/modules/nyazoom.nix b/modules/nyazoom.nix
new file mode 100644
index 0000000..d842151
--- /dev/null
+++ b/modules/nyazoom.nix
@@ -0,0 +1,22 @@
+{ lib, config, inputs, pkgs, ... }:
+
+let
+  nyazoom = inputs.nyazoom.packages.${pkgs.system}.default;
+
+  cfg = config.permafrost.nyazoom;
+in
+{
+  options.permafrost.nyazoom = {
+    enable = lib.mkEnableOption "permafrost nixos module";
+  };
+
+  config = lib.mkIf cfg.enable {
+    systemd.user.services.nyazoom = {
+      script = ''
+        DATABASE_URL="sqlite:///var/lib/nyazoom/data" ${lib.getExe nyazoom}
+      '';
+      wants = [ "network.target" ];
+    };
+
+  };
+}