updating gaming module
This commit is contained in:
parent
f70bb16e7b
commit
ea38b66b82
@ -38,6 +38,10 @@
|
||||
url = "github:makuto/auto-base16-theme";
|
||||
flake = false;
|
||||
};
|
||||
sunshine = {
|
||||
url = "git+ssh://git@github.com/loki-47-6F-64/sunshine.git";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
@ -55,6 +59,7 @@
|
||||
ezpcusr = import ./home-manager/modules/ezpcusr.nix inputs;
|
||||
colors = import ./home-manager/modules/colors.nix inputs;
|
||||
fonts = import ./home-manager/modules/fonts.nix;
|
||||
gaming = import ./home-manager/modules/gaming.nix inputs;
|
||||
all = import ./home-manager/modules/default.nix inputs;
|
||||
};
|
||||
|
||||
|
@ -8,7 +8,7 @@ inputs:
|
||||
|
||||
(import ./ezpcusr.nix inputs)
|
||||
(import ./colors.nix inputs)
|
||||
./gaming.nix
|
||||
(import ./gaming.nix inputs)
|
||||
./fonts.nix
|
||||
];
|
||||
}
|
||||
|
@ -1,7 +1,55 @@
|
||||
inputs:
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.gaming;
|
||||
|
||||
sunshineAssets = pkgs.runCommandNoCC "sunshine-assets" { } ''
|
||||
cp -r ${inputs.sunshine}/assets $out
|
||||
'';
|
||||
|
||||
sunshine = pkgs.stdenv.mkDerivation {
|
||||
name = "sunshine";
|
||||
src = inputs.sunshine;
|
||||
|
||||
cmakeFlags = [ "-DSUNSHINE_ASSETS_DIR=assets" "-DSUNSHINE_DEFAULT_DIR=${sunshineAssets}" ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace '/usr/include/libevdev-1.0' '${pkgs.libevdev}/include/libevdev-1.0'
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp sunshine $out/bin
|
||||
|
||||
mkdir -p $out/etc
|
||||
cp -r ../assets $out/etc
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
addOpenGLRunpath $out/bin/sunshine
|
||||
'';
|
||||
|
||||
nativeBuildInputs = with pkgs; [ cmake pkgconfig addOpenGLRunpath ];
|
||||
hardeningDisable = [ "format" ];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
openssl
|
||||
(boost.override { enableShared = false; enableStatic = true; })
|
||||
ffmpeg-full
|
||||
libevdev
|
||||
libcap
|
||||
libdrm
|
||||
libpulseaudio
|
||||
libopus
|
||||
cudatoolkit_11
|
||||
xorg.libXrandr
|
||||
xorg.libXfixes
|
||||
xorg.libXtst
|
||||
xorg.libxcb
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
options.gaming = {
|
||||
@ -26,6 +74,21 @@ in
|
||||
with pkgs; [
|
||||
oldwine
|
||||
oldwinetricks
|
||||
|
||||
(pkgs.writeShellScriptBin "steam" "${pkgs.systemd}/bin/systemctl --user start steam")
|
||||
sc-controller
|
||||
|
||||
dolphinEmuMaster
|
||||
|
||||
ark
|
||||
unzip
|
||||
unrar
|
||||
|
||||
mpv
|
||||
|
||||
tuxpaint
|
||||
|
||||
extremetuxracer
|
||||
] ++ lib.optionals cfg.newWine [
|
||||
(
|
||||
pkgs.runCommand "new-wine-stuff"
|
||||
@ -37,5 +100,99 @@ in
|
||||
''
|
||||
)
|
||||
];
|
||||
};
|
||||
|
||||
systemd.user.services.sunshine = {
|
||||
Unit = {
|
||||
Description = "Host for Moonlight Streaming Client";
|
||||
Requires = [ "dbus.service" ];
|
||||
After = [ "graphical-session-pre.target" "network.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
WorkingDirectory = "${config.xdg.configHome}/sunshine";
|
||||
Restart = "on-failure";
|
||||
RestartSec = 3;
|
||||
ExecStart = "${sunshine}/bin/sunshine";
|
||||
ExecStartPre =
|
||||
let
|
||||
script = pkgs.writeShellScript "sunshine-pre-start" ''
|
||||
${pkgs.coreutils}/bin/mkdir -p $HOME/.config/sunshine/assets
|
||||
|
||||
${pkgs.coreutils}/bin/rm -rf $HOME/.config/sunshine/assets/shaders
|
||||
${pkgs.coreutils}/bin/rm -rf $HOME/.config/sunshine/assets/web
|
||||
${pkgs.coreutils}/bin/rm -rf $HOME/.config/sunshine/assets/box.png
|
||||
|
||||
${pkgs.coreutils}/bin/cp --no-preserve=all -r ${sunshineAssets}/shaders $HOME/.config/sunshine/assets
|
||||
${pkgs.coreutils}/bin/cp --no-preserve=all -r ${sunshineAssets}/web $HOME/.config/sunshine/assets
|
||||
${pkgs.coreutils}/bin/cp --no-preserve=all ${sunshineAssets}/box.png $HOME/.config/sunshine/assets
|
||||
'';
|
||||
in
|
||||
"${script}";
|
||||
};
|
||||
};
|
||||
|
||||
programs.rofi = {
|
||||
enable = lib.mkDefault true;
|
||||
terminal = lib.mkDefault "${pkgs.kitty}/bin/kitty";
|
||||
};
|
||||
|
||||
programs.kitty.enable = lib.mkDefault true;
|
||||
|
||||
systemd.user.services.scc = {
|
||||
Unit = {
|
||||
Description = "User-mode driver and GTK3 based GUI for Steam Controller";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "simple";
|
||||
ExecStart = "${pkgs.sc-controller}/bin/scc-daemon debug";
|
||||
Restart = "always";
|
||||
RestartSec = 5;
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||
};
|
||||
|
||||
systemd.user.services.steam = {
|
||||
Unit = {
|
||||
Description = "Start Steam gaming platform";
|
||||
After = [ "graphical-session-pre.target" ];
|
||||
PartOf = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "simple";
|
||||
ExecStart = let
|
||||
steamStart = pkgs.writeShellScript "steam-start" ''
|
||||
${pkgs.systemd}/bin/systemctl --user stop scc
|
||||
# no sleep is needed here because steam is slow as fuck lol
|
||||
/run/current-system/sw/bin/steam
|
||||
'';
|
||||
in "${steamStart}";
|
||||
ExecStop = let
|
||||
steamStop = pkgs.writeShellScript "steam-stop" ''
|
||||
${pkgs.coreutils}/bin/sleep 5 # give time for controller to reset
|
||||
${pkgs.systemd}/bin/systemctl --user start scc
|
||||
'';
|
||||
in "${steamStop}";
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ "graphical-session.target" ]; };
|
||||
};
|
||||
|
||||
programs.chromium.enable = lib.mkDefault true;
|
||||
|
||||
fonts.enable = lib.mkDefault true;
|
||||
|
||||
colors = {
|
||||
enable = lib.mkDefault true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user