Status page for GenSoc
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1KB

  1. { lib, pkgs, config, ... }:
  2. with lib;
  3. let
  4. cfg = config.services.gensoc-status;
  5. statusPkg = (import "${pkgs.fetchgit {
  6. url = "https://code.gensokyo.social/Gensokyo.social/status.git";
  7. rev = "712189604768c3189d12c16c4e576205dd2eb293";
  8. sha256 = "0nz499g1hcfzxlswk1crpwsrg3b1k1vhii6jfya5x1sqnw0h1hwz";
  9. }}/default.nix");
  10. in {
  11. options.services.gensoc-status = {
  12. enable = mkEnableOption "Gensokyo.social status";
  13. port = {
  14. type = types.int;
  15. default = 8080;
  16. description = "Governs port number that server will listen on";
  17. };
  18. settings = {
  19. MASTODON_API_KEY = {
  20. type = types.str;
  21. description = "Mastodon API key";
  22. };
  23. };
  24. };
  25. config = let
  26. configFile = pkgs.writeText "config.json" (builtins.toJSON cfg.settings);
  27. in lib.mkIf cfg.enable {
  28. # systemd unit for miracle-tv-server
  29. systemd.services.gensoc-status = {
  30. wantedBy = [ "multi-user.target" ];
  31. serviceConfig.ExecStart = "CONFIG_FILE=${configFile} PORT=${builtins.toString cfg.port} ${statusPkg}/bin/gensoc-status";
  32. };
  33. };
  34. }