summary refs log tree commit diff
path: root/nix/tazserve.nix
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@gmail.com>2018-01-01T22·20+0100
committerVincent Ambo <tazjin@gmail.com>2018-01-01T22·20+0100
commita646f94d4702ddb27f07c1a23ae683278d205997 (patch)
tree27c1ec73656505374e76c4266b015db12682db16 /nix/tazserve.nix
parent93681178132e8f6e6cb112f601bf4b220355bb86 (diff)
feat(nix): Add initial Tazblog Nix deployment configuration
Diffstat (limited to 'nix/tazserve.nix')
-rw-r--r--nix/tazserve.nix34
1 files changed, 34 insertions, 0 deletions
diff --git a/nix/tazserve.nix b/nix/tazserve.nix
new file mode 100644
index 000000000000..202614fb704b
--- /dev/null
+++ b/nix/tazserve.nix
@@ -0,0 +1,34 @@
+{ pkgs, config, ... }:
+
+with pkgs; let
+  blogSource = fetchgit {
+    url = "https://git.tazj.in/tazjin/tazblog.git";
+    sha256 = "0m745vb8k6slzdsld63rbfg583k70q3g6i5lz576sccalkg0r2l2";
+    rev = "aeeb11f1b76729115c4db98f419cbcda1a0f7660";
+  };
+  tazblog = import ./tazblog { inherit blogSource; };
+  blog = tazblog.tazblog;
+in {
+  # Ensure that blog software is installed
+  environment.systemPackages = [
+    blog
+    blogSource
+  ];
+
+  # Set up database unit
+  systemd.services.tazblog-db =  {
+    description           = "Database engine for Tazblog";
+    script                = "${blog}/bin/tazblog-db";
+    serviceConfig.restart = "always";
+    wantedBy              = [ "multi-user.target" ];
+  };
+
+  # Set up blog unit
+  systemd.services.tazblog = {
+    description           = "Tazjin's blog engine";
+    script                = "${blog}/bin/tazblog --resourceDir ${blogSource}/static";
+    serviceConfig.restart = "always";
+    requires              = [ "tazblog-db.service" ];
+    wantedBy              = [ "multi-user.target" ];
+  };
+}