From c3a3d9ae85f63dee51a7c45d474230ccd6706b48 Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Sat, 7 Aug 2021 17:26:11 +0200 Subject: [PATCH] misc: Add ReplaySorcery --- hosts/miku.nix | 34 +++++++++++++----- modules/programs/gamemode/gamemode.ini | 9 ++++- packages/default.nix | 3 ++ packages/overlay.nix | 1 + packages/replaysorcery/default.nix | 39 +++++++++++++++++++++ packages/replaysorcery/ignore-systemd.patch | 18 ++++++++++ 6 files changed, 95 insertions(+), 9 deletions(-) create mode 100644 packages/replaysorcery/default.nix create mode 100644 packages/replaysorcery/ignore-systemd.patch diff --git a/hosts/miku.nix b/hosts/miku.nix index 0044c34..351dd27 100644 --- a/hosts/miku.nix +++ b/hosts/miku.nix @@ -3,7 +3,6 @@ let unstable = (import ../modules/unstable.nix config); customPkgs = import ../packages/overlay.nix; - gamemode = pkgs.callPackage ../packages/gamemode {}; in { imports = [ ./generic.nix @@ -37,6 +36,7 @@ in { libvirt virt-manager qemu gamemode # Custom package key-mapper # Custom package + replaysorcery # Custom package scream linuxPackages_zen.vendor-reset ]; @@ -87,6 +87,7 @@ in { kernelModules = []; extraModulePackages = [ pkgs.linuxPackages_zen.vendor-reset ]; kernelPackages = pkgs.linuxPackages_zen; + #kernelPackages = pkgs.linuxPackages_lqx; }; services = { @@ -111,7 +112,7 @@ in { cgroup_device_acl = [ "/dev/null", "/dev/zero", "/dev/full", "/dev/random", "/dev/kvm", "/dev/kqemu", - "/dev/rtc", "/dev/hpet", "dev/ptmx", + "/dev/rtc", "/dev/hpet", "/dev/ptmx", "/dev/input/by-id/usb-Logitech_G700s_Rechargeable_Gaming_Mouse_93DF48160007-event-mouse", "/dev/input/by-id/usb-Razer_Razer_BlackWidow_Ultimate-event-kbd", "/dev/input/by-id/usb-Razer_Razer_BlackWidow_Ultimate-if01-event-kbd", @@ -125,22 +126,39 @@ in { services.NetworkManager-wait-online.enable = false; user.services = { scream = { - enable = false; # Started by the passthrough script description = "Audio receiver for the Scream virtual network sound card"; - wantedBy = [ "multi-user.target" ]; + #wantedBy = [ "default.target" ]; serviceConfig = { Type = "simple"; ExecStart = "${pkgs.scream}/bin/scream -i virbr0 -o pulse"; - RestartAlways = "always"; + Restart = "always"; + }; + }; + replaysorcery-kms = { + description = "An open-source, instant-replay solution for Linux; KMS service"; + #wantedBy = [ "default.target" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.replaysorcery}/bin/replay-sorcery kms-service"; + Restart = "always"; + }; + }; + replaysorcery = { + description = "An open-source, instant-replay solution for Linux"; + #wantedBy = [ "default.target" ]; + requires = [ "replaysorcery-kms.service" ]; + serviceConfig = { + Type = "simple"; + ExecStart = "${pkgs.replaysorcery}/bin/replay-sorcery"; + Restart = "always"; }; }; gamemode = { - enable = true; description = "A daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS."; - wantedBy = [ "multi-user.target" ]; + wantedBy = [ "default.target" ]; serviceConfig = { Type = "simple"; - ExecStart = "${gamemode}/bin/gamemoded"; + ExecStart = "${pkgs.gamemode}/bin/gamemoded"; Restart = "always"; }; }; diff --git a/modules/programs/gamemode/gamemode.ini b/modules/programs/gamemode/gamemode.ini index 589045a..ea1a439 100644 --- a/modules/programs/gamemode/gamemode.ini +++ b/modules/programs/gamemode/gamemode.ini @@ -26,4 +26,11 @@ inhibit_screensaver=1 [supervisor] -[custom] \ No newline at end of file +[custom] +start=systemctl --user start replaysorcery-kms + systemctl --user start replaysorcery + +end=systemctl --user stop replaysorcery-kms + systemctl --user stop replaysorcery + +script_timeout=10 \ No newline at end of file diff --git a/packages/default.nix b/packages/default.nix index de1ef6b..d9ba66a 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -11,4 +11,7 @@ gnome = { gnome-terminal = pkgs.callPackage ./gnome-terminal {}; }; + hydrapaper = pkgs.callPackage ./hydrapaper {}; + replaysorcery = pkgs.callPackage ./replaysorcery {}; + helvum = pkgs.callPackage ./helvum {}; } diff --git a/packages/overlay.nix b/packages/overlay.nix index 086b380..4166784 100644 --- a/packages/overlay.nix +++ b/packages/overlay.nix @@ -8,4 +8,5 @@ self: super: gnomeExtensionsCustom = { notification-timeout = super.callPackage ./gnomeExtensions-notification-timeout {}; }; + replaysorcery = super.callPackage ./replaysorcery {}; } diff --git a/packages/replaysorcery/default.nix b/packages/replaysorcery/default.nix new file mode 100644 index 0000000..7e8092c --- /dev/null +++ b/packages/replaysorcery/default.nix @@ -0,0 +1,39 @@ +{ stdenv, lib, + pkgconfig, cmake, ffmpeg, libdrm, libpulseaudio, xorg, libnotify, + fetchgit }: + +stdenv.mkDerivation rec { + pname = "ReplaySorcery"; + version = "0.6.0"; + + src = fetchgit { + url = "https://github.com/matanui159/${pname}.git"; + rev = "d8d5921988b5161004aed6209bd88251d721611d"; + sha256 = "14m67mlfp0zh9s0bhz1qxppivw2aignxqb51xb5cy3v8farxmcv4"; + deepClone = true; + }; + + nativeBuildInputs = [ + pkgconfig cmake + ]; + + buildInputs = [ + ffmpeg libdrm libpulseaudio xorg.libxcb xorg.libX11 + ]; + + propagatedBuildInputs = [ + libnotify + ]; + + patches = [ + ./ignore-systemd.patch + ]; + + meta = with lib; { + description = "An open-source, instant-replay solution for Linux"; + homepage = "https://github.com/matanui159/ReplaySorcery"; + license = licenses.gpl3; + maintainers = [ ]; + platforms = platforms.linux; + }; +} diff --git a/packages/replaysorcery/ignore-systemd.patch b/packages/replaysorcery/ignore-systemd.patch new file mode 100644 index 0000000..bd07487 --- /dev/null +++ b/packages/replaysorcery/ignore-systemd.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4633f85..e3fdd7c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -213,8 +213,8 @@ install(TARGETS ${binary} DESTINATION bin PERMISSIONS ${permissions}) + install(FILES sys/replay-sorcery.conf DESTINATION etc) + + # Install services +-set(RS_SYSTEMD_DIR /usr/lib/systemd CACHE STRING "Where to install the systemd services") +-configure_file(sys/replay-sorcery.service.in replay-sorcery.service) +-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/replay-sorcery.service" DESTINATION "${RS_SYSTEMD_DIR}/user") +-configure_file(sys/replay-sorcery-kms.service.in replay-sorcery-kms.service) +-install(FILES "${CMAKE_CURRENT_BINARY_DIR}/replay-sorcery-kms.service" DESTINATION "${RS_SYSTEMD_DIR}/system") ++#set(RS_SYSTEMD_DIR /usr/lib/systemd CACHE STRING "Where to install the systemd services") ++#configure_file(sys/replay-sorcery.service.in replay-sorcery.service) ++#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/replay-sorcery.service" DESTINATION "${RS_SYSTEMD_DIR}/user") ++#configure_file(sys/replay-sorcery-kms.service.in replay-sorcery-kms.service) ++#install(FILES "${CMAKE_CURRENT_BINARY_DIR}/replay-sorcery-kms.service" DESTINATION "${RS_SYSTEMD_DIR}/system")