summaryrefslogtreecommitdiff
path: root/Run/Que/Website.nix
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2020-04-11 11:44:33 -0700
committerBen Sima <ben@bsima.me>2020-04-11 11:44:33 -0700
commit7de74be87eeaf28a1339b99cde78afe070d3e3e4 (patch)
tree6c1d68b410f753786205b8db66b9ac4ed39d8133 /Run/Que/Website.nix
parent0dd8fa4436f713a9b41c20e056d3d0d1bce69c39 (diff)
Deploy que-website to Run.Que.Prod
Diffstat (limited to 'Run/Que/Website.nix')
-rw-r--r--Run/Que/Website.nix59
1 files changed, 59 insertions, 0 deletions
diff --git a/Run/Que/Website.nix b/Run/Que/Website.nix
new file mode 100644
index 0000000..6a24d9d
--- /dev/null
+++ b/Run/Que/Website.nix
@@ -0,0 +1,59 @@
+{ options
+, lib
+, config
+, pkgs
+, modulesPath
+}:
+
+let
+ cfg = config.services.que-website;
+ static = pkgs.stdenv.mkDerivation {
+ src = ./.;
+ name = "que-website-static";
+ installPhase = ''
+ mkdir -p $out
+ cp ${./apidocs.md} $out/apidocs.md
+ cp ${./index.md} $out/index.md
+ cp ${./quescripts.md} $out/quescripts.md
+ cp ${./style.css} $out/style.css
+ cp ${./tutorial.md} $out/tutorial.md
+ cp ${./client.py} $out/client.py
+ '';
+ };
+in
+{
+ options.services.que-website = {
+ enable = lib.mkEnableOption "Enable the que-website service";
+ namespace = lib.mkOption {
+ type = lib.types.str;
+ default = "_";
+ description = ''
+ The que namespace on which que-website will broadcast.
+ '';
+ };
+ package = lib.mkOption {
+ type = lib.types.package;
+ description = "que-website package to use";
+ };
+ };
+ config = lib.mkIf cfg.enable {
+ systemd.services.que-website = {
+ path = [ cfg.package pkgs.pandoc ];
+ wantedBy = [ "multi-user.target" ];
+ script = ''
+ ${cfg.package}/bin/que-website ${static} ${cfg.namespace}
+ '';
+ description = ''
+ Que website server
+ '';
+ serviceConfig = {
+ User = "root";
+ Environment = "HOME=/root";
+ KillSignal = "INT";
+ Type = "simple";
+ Restart = "on-abort";
+ RestartSec = "1";
+ };
+ };
+ };
+}