{ options, lib, config, pkgs, ... }: let cfg = config.services.que-website; static = pkgs.stdenv.mkDerivation { src = ./.; name = "que-website-static"; installPhase = '' mkdir -p $out 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 = "always"; RestartSec = "1"; }; }; }; }