Free and Open-source video streaming suite. https://miracle-tv.live
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.
 
 
 
 

61 lines
1.6 KiB

  1. { lib, pkgs, config, ... }:
  2. with lib;
  3. let
  4. cfg = config.services.miracle-tv;
  5. miracleSrc = pkgs.fetchgit {
  6. url = "https://code.gensokyo.social/Gensokyo.social/miracle-tv.git";
  7. rev = "48f9d5aa30f0b1b29e44350307e63b009fc81996";
  8. sha256 = "0yskcp63r3fcsv4my1f6z2262zk0cqb72k1qn04rwwz9s6ilzbr1";
  9. };
  10. miracle-tv = (import "${miracleSrc}/default.nix");
  11. in {
  12. options.services.miracle-tv = {
  13. enable = mkEnableOption "Miracle TV server";
  14. settings = {
  15. database = {
  16. client = mkOption {
  17. type = types.str;
  18. default = "pg";
  19. };
  20. connection = {
  21. hostname = mkOption {
  22. type = types.str;
  23. default = "localhost";
  24. };
  25. database = mkOption {
  26. type = types.str;
  27. default = "";
  28. };
  29. user = mkOption {
  30. type = types.str;
  31. default = "";
  32. };
  33. password = mkOption {
  34. type = types.str;
  35. default = "";
  36. };
  37. };
  38. };
  39. server = {
  40. port = mkOption {
  41. type = types.int;
  42. default = 8080;
  43. };
  44. };
  45. };
  46. };
  47. # config = let
  48. # configFile = pkgs.writeJSON "config.json" cfg.settings;
  49. # in lib.mkIf cfg.enable {
  50. config = let
  51. configFile = pkgs.writeText "config.json" (builtins.toJSON cfg.settings);
  52. in lib.mkIf cfg.enable {
  53. systemd.services.miracle-tv = {
  54. wantedBy = [ "multi-user.target" "postgresql.service" ];
  55. serviceConfig.ExecStart = "${miracle-tv}/bin/miracle-tv-server --configPath=${configFile}";
  56. };
  57. };
  58. }