Commit c0c8a367 authored by Kira Bruneau's avatar Kira Bruneau
Browse files

replay-sorcery: remove as it is unmaintained upstream

parent b2c1f10b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -171,6 +171,8 @@

- `gitlab` has been updated from 16.x to 17.x and requires at least `postgresql` 14.9, as stated in the [documentation](https://docs.gitlab.com/17.1/ee/install/requirements.html#postgresql-requirements). Check the [upgrade guide](#module-services-postgres-upgrading) in the NixOS manual on how to upgrade your PostgreSQL installation.

- The `replay-sorcery` package and module was removed as it unmaintained upstream. Consider using `gpu-screen-recorder` or `obs-studio` instead.

- `zx` was updated to v8, which introduces several breaking changes.
  See the [v8 changelog](https://github.com/google/zx/releases/tag/8.0.0) for more information.

+0 −1
Original line number Diff line number Diff line
@@ -1345,7 +1345,6 @@
  ./services/video/frigate.nix
  ./services/video/mirakurun.nix
  ./services/video/photonvision.nix
  ./services/video/replay-sorcery.nix
  ./services/video/mediamtx.nix
  ./services/video/unifi-video.nix
  ./services/video/v4l2-relayd.nix
+1 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ in
    '')
    (mkRemovedOptionModule [ "services" "quagga" ] "the corresponding package has been removed from nixpkgs")
    (mkRemovedOptionModule [ "services" "railcar" ] "the corresponding package has been removed from nixpkgs")
    (mkRemovedOptionModule [ "services" "replay-sorcery" ] "the corresponding package has been removed from nixpkgs as it is unmaintained upstream. Consider using `gpu-screen-recorder` or `obs-studio` instead.")
    (mkRemovedOptionModule [ "services" "seeks" ] "")
    (mkRemovedOptionModule [ "services" "ssmtp" ] ''
      The ssmtp package and the corresponding module have been removed due to
+0 −72
Original line number Diff line number Diff line
{ config, lib, pkgs, ... }:

with lib;

let
  cfg = config.services.replay-sorcery;
  configFile = generators.toKeyValue {} cfg.settings;
in
{
  options = with types; {
    services.replay-sorcery = {
      enable = mkEnableOption "the ReplaySorcery service for instant-replays";

      enableSysAdminCapability = mkEnableOption ''
        the system admin capability to support hardware accelerated
        video capture. This is equivalent to running ReplaySorcery as
        root, so use with caution'';

      autoStart = mkOption {
        type = bool;
        default = false;
        description = "Automatically start ReplaySorcery when graphical-session.target starts.";
      };

      settings = mkOption {
        type = attrsOf (oneOf [ str int ]);
        default = {};
        description = "System-wide configuration for ReplaySorcery (/etc/replay-sorcery.conf).";
        example = literalExpression ''
          {
            videoInput = "hwaccel"; # requires `services.replay-sorcery.enableSysAdminCapability = true`
            videoFramerate = 60;
          }
        '';
      };
    };
  };

  config = mkIf cfg.enable {
    environment = {
      systemPackages = [ pkgs.replay-sorcery ];
      etc."replay-sorcery.conf".text = configFile;
    };

    security.wrappers = mkIf cfg.enableSysAdminCapability {
      replay-sorcery = {
        owner = "root";
        group = "root";
        capabilities = "cap_sys_admin+ep";
        source = "${pkgs.replay-sorcery}/bin/replay-sorcery";
      };
    };

    systemd = {
      packages = [ pkgs.replay-sorcery ];
      user.services.replay-sorcery = {
        wantedBy = mkIf cfg.autoStart [ "graphical-session.target" ];
        partOf = mkIf cfg.autoStart [ "graphical-session.target" ];
        serviceConfig = {
          ExecStart = mkIf cfg.enableSysAdminCapability [
            "" # Tell systemd to clear the existing ExecStart list, to prevent appending to it.
            "${config.security.wrapperDir}/replay-sorcery"
          ];
        };
      };
    };
  };

  meta = {
    maintainers = with maintainers; [ kira-bruneau ];
  };
}
+0 −63
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, substituteAll
, cmake
, pkg-config
, ffmpeg
, libX11
, drmSupport ? true, libdrm
, notifySupport ? true, libnotify
, pulseaudioSupport ? true, libpulseaudio
}:

stdenv.mkDerivation rec {
  pname = "replay-sorcery";
  version = "0.5.0";

  src = fetchFromGitHub {
    owner = "matanui159";
    repo = "ReplaySorcery";
    rev = version;
    fetchSubmodules = true;
    hash = "sha256-HPkSOwfwcg4jLUzKfqdXgLu7mgD5H4wb9d2BrqWQeHc=";
  };

  patches = [
    # Use global config generated by NixOS (/etc/replay-sorcery.conf)
    # instead of $out/etc/replay-sorcery.conf.
    ./fix-global-config.patch
  ] ++ lib.optional notifySupport (substituteAll {
    # Patch in libnotify if support is enabled. Can't use makeWrapper
    # since it would break the security wrapper in the NixOS module.
    src = ./hardcode-libnotify.patch;
    inherit libnotify;
  });

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [ ffmpeg libX11 ]
  ++ lib.optional drmSupport libdrm
  ++ lib.optional pulseaudioSupport libpulseaudio;

  cmakeFlags = [
    "-DRS_SYSTEMD_DIR=${placeholder "out"}/lib/systemd/user"

    # SETUID & SETGID permissions required for hardware accelerated
    # video capture can't be set during the build. Use the NixOS
    # module if you want hardware accelerated video capture.
    "-DRS_SETID=OFF"
  ];

  meta = with lib; {
    description = "Open-source, instant-replay solution for Linux";
    homepage = "https://github.com/matanui159/ReplaySorcery";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ kira-bruneau ];
    platforms = platforms.linux;
    mainProgram = "replay-sorcery";
  };
}
Loading