diff --git a/hosts/miku.nix b/hosts/miku.nix index 7fd5bd3..f0f9171 100644 --- a/hosts/miku.nix +++ b/hosts/miku.nix @@ -48,7 +48,7 @@ primaryScreen = "C27F398"; enable = true; }; - #sway.enable = true; + sway.enable = true; alacritty.enable = true; emacs.enable = true; firefox.enable = true; @@ -102,8 +102,11 @@ }; }; }; - #swaync.enable = true; - key-mapper.enable = true; + swaync.enable = true; + input-remapper = { + enable = true; + postStartCommand = "${pkgs.input-remapper}/bin/input-remapper-control --command start --preset NOOP --device \"Razer Razer Tartarus V2\"; exit 0"; + }; }; system = { i18n.enable = true; @@ -170,7 +173,7 @@ services = { ratbagd.enable = true; flatpak.enable = true; - etesync-dav.enable = true; + #etesync-dav.enable = true; connman.extraConfig = '' WriteResolvConf=false ''; diff --git a/modules/default.nix b/modules/default.nix index 0544e95..7d5b047 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -25,7 +25,7 @@ # Services ./services/kanshi - ./services/key-mapper + ./services/input-remapper ./services/gamemode ./services/i18n diff --git a/modules/programs/gaming/default.nix b/modules/programs/gaming/default.nix index 4c162ea..cdeb7e6 100644 --- a/modules/programs/gaming/default.nix +++ b/modules/programs/gaming/default.nix @@ -8,7 +8,7 @@ in { }; config = lib.mkIf cfg.enable { environment.systemPackages = with pkgs; [ - winePackages.stagingFull winetricks + winePackages.stagingFull winetricks lutris-free-wrapped ]; }; } diff --git a/modules/services/key-mapper/default.nix b/modules/services/input-remapper/default.nix similarity index 50% rename from modules/services/key-mapper/default.nix rename to modules/services/input-remapper/default.nix index 60dd97d..f5d8fb3 100644 --- a/modules/services/key-mapper/default.nix +++ b/modules/services/input-remapper/default.nix @@ -1,34 +1,39 @@ { config, lib, pkgs, ... }: let - cfg = config.ptw.services.key-mapper; + cfg = config.ptw.services.input-remapper; in { - options.ptw.services.key-mapper = { - enable = lib.mkEnableOption "Enable the key-mapper service and install it"; + options.ptw.services.input-remapper = { + enable = lib.mkEnableOption "Enable the input-remapper service and install it"; + postStartCommand = lib.mkOption { + default = ""; + description = "Command to be executed after the input-remapper service has been started"; + # type = ; + }; }; config = lib.mkIf cfg.enable { # TODO: Assert that uinput is in kernelModules services.udev = { - packages = with pkgs; [ key-mapper ]; + packages = with pkgs; [ input-remapper ]; extraRules = '' KERNEL=="uinput", GROUP="input", MODE="0660" ''; }; environment.systemPackages = [ - pkgs.key-mapper # Custom package + pkgs.input-remapper # Custom package ]; - systemd.user.services.key-mapper = { + systemd.user.services.input-remapper = { description = "A tool to change the mapping of your input device buttons"; wantedBy = [ "default.target" ]; serviceConfig = { Type = "simple"; - ExecStart = "${pkgs.key-mapper}/bin/key-mapper-service"; + ExecStart = "${pkgs.input-remapper}/bin/input-remapper-service"; Restart = "always"; # NOTE: The Tartarus may not be connected, so don't fail if we cannot set the preset - ExecPostStart = "${pkgs.key-mapper}/bin/key-mapper --command start --preset NOOP --device \"Razer Razer Tartarus V2\"; exit 0"; + ExecStartPost = cfg.postStartCommand; }; }; }; diff --git a/overlays/sandbox.nix b/overlays/sandbox.nix index 913ec88..0a4f9c2 100644 --- a/overlays/sandbox.nix +++ b/overlays/sandbox.nix @@ -64,4 +64,14 @@ in { mountInHome = [ ".config/spotify" ]; chdirTo = "/home/$USER"; }; + + lutris-free-wrapped = wrapInSandbox { + name = "lutris-free"; + package = prev.lutris-free; + binaryName = "lutris"; + additionalBlacklist = [ "/mnt" ]; + additionalMounts = [ "/mnt/Storage/Games/UPlay" ]; + mountInHome = [ ".local/share/lutris" ".config/lutris" ]; + chdirTo = "/home/$USER"; + }; } diff --git a/packages/default.nix b/packages/default.nix index 3b4b408..9001d39 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -10,7 +10,7 @@ let #extraStartupArgs = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WebRTCPipeWireCapturer"; }; in { -key-mapper = prev.callPackage ./tools/games/key-mapper {}; + input-remapper = prev.callPackage ./tools/games/input-remapper {}; vfio-isolate = prev.callPackage ./tools/virtualisation/vfio-isolate {}; mopidy-funkwhale = prev.callPackage ./applications/audio/mopidy/funkwhale.nix {}; python3Packages = prev.python3Packages // { diff --git a/packages/development/python/keyrings.gopass/default.nix b/packages/development/python/keyrings.gopass/default.nix new file mode 100644 index 0000000..6d60fa6 --- /dev/null +++ b/packages/development/python/keyrings.gopass/default.nix @@ -0,0 +1,31 @@ +{ + pkgs +, lib +, python3Packages +, fetchFromGitea +}: + +python3Packages.buildPythonPackage rec { + pname = "keyrings.gopass"; + version = "1.0.0"; + + src = fetchFromGitea { + domain = "git.polynom.me"; + owner = "PapaTutuWawa"; + repo = pname; + rev = "9c3cd59e7f5ce0a742b238ff0c4761db28344713"; + sha256 = "1dg3a6zx3cm9vwsqgkmc604n3fqb760nsmnrfwyfv7y5bmh5822x"; + }; + + nativeBuildInputs = with python3Packages; [ setuptools setuptools-scm ]; + + doCheck = false; + + meta = with lib; { + homepage = "https://git.polynom.me/PapaTutuWawa/keyrings.gopass"; + description = "A python-keyring plugin for gopass"; + license = licenses.gpl3; + maintainers = []; + platforms = platforms.linux; + }; +} diff --git a/packages/tools/games/input-remapper/add-scripts.patch b/packages/tools/games/input-remapper/add-scripts.patch new file mode 100644 index 0000000..18b5627 --- /dev/null +++ b/packages/tools/games/input-remapper/add-scripts.patch @@ -0,0 +1,17 @@ +diff --git a/setup.py b/setup.py +index 1d50118..fde6119 100644 +--- a/setup.py ++++ b/setup.py +@@ -129,6 +129,12 @@ setup( + ("/usr/bin/", ["bin/key-mapper-service"]), + ("/usr/bin/", ["bin/key-mapper-control"]), + ], ++ scripts=[ ++ "bin/input-remapper-gtk", ++ "bin/input-remapper-service", ++ "bin/input-remapper-control", ++ "bin/input-remapper-helper" ++ ], + install_requires=[ + "setuptools", + "evdev", diff --git a/packages/tools/games/key-mapper/default.nix b/packages/tools/games/input-remapper/default.nix similarity index 57% rename from packages/tools/games/key-mapper/default.nix rename to packages/tools/games/input-remapper/default.nix index 0563ce8..7752e1a 100644 --- a/packages/tools/games/key-mapper/default.nix +++ b/packages/tools/games/input-remapper/default.nix @@ -1,17 +1,17 @@ { pkgs, lib , python3Packages, python3 -, gtk3, gobject-introspection, git, gnome +, gtk3, gobject-introspection, git, gnome, gtksourceview4 , wrapGAppsHook , makeDesktopItem , fetchFromGitHub }: python3Packages.buildPythonApplication rec { - pname = "key-mapper"; - version = "1.2.1"; + pname = "input-remapper"; + version = "1.4.0"; - buildInputs = [ gobject-introspection gtk3 gnome.adwaita-icon-theme ]; + buildInputs = [ gobject-introspection gtk3 gnome.adwaita-icon-theme gtksourceview4 ]; nativeBuildInputs = [ wrapGAppsHook ]; @@ -19,9 +19,9 @@ python3Packages.buildPythonApplication rec { src = fetchFromGitHub { owner = "sezanzeb"; - repo = "key-mapper"; + repo = "input-remapper"; rev = version; - sha256 = "07dgp4vays1w4chhd22vlp9bxc49lcgzkvmjqgbr00m3781yjsf7"; + sha256 = "0h64cblpfz2zk15r2ja1kww1cw54gywmfr1zc16qx7sbjy0yi8px"; }; doCheck = false; @@ -32,9 +32,9 @@ python3Packages.buildPythonApplication rec { ./hack-data-dir.patch ]; - # Fix keymapper not finding its data files + # Fix input-remapper not finding its data files preBuild = '' - sed -e "s|@@NIXOS_OUT_PATH@@|$out/usr/share/key-mapper|" --in-place keymapper/data.py + sed -e "s|@@NIXOS_OUT_PATH@@|$out/usr/share/input-remapper|" --in-place inputremapper/data.py ''; # Required as we otherwise don't get the dbus policy installed @@ -47,25 +47,25 @@ python3Packages.buildPythonApplication rec { postInstall = '' # Install the udev rules mkdir -p $out/lib/udev/rules.d - cp data/key-mapper.rules $out/lib/udev/rules.d/key-mapper.rules - sed --in-place -e "s|/bin/key-mapper-control|$out/bin/key-mapper-control|" $out/lib/udev/rules.d/key-mapper.rules + cp data/99-input-remapper.rules $out/lib/udev/rules.d/99-input-remapper.rules + sed --in-place -e "s|/bin/input-remapper-control|$out/bin/input-remapper-control|" $out/lib/udev/rules.d/99-input-remapper.rules # Install the desktop file mkdir -p $out/share/icons/hicolor/scalable/apps/ cp -r ${desktopItem}/share/applications $out/share/ - cp $out/usr/share/key-mapper/key-mapper.svg $out/share/icons/hicolor/scalable/apps/key-mapper.svg + cp $out/usr/share/input-remapper/input-remapper.svg $out/share/icons/hicolor/scalable/apps/input-remapper.svg ''; desktopItem = makeDesktopItem { - name = "key-mapper"; - exec = "key-mapper-gtk"; - icon = "key-mapper"; - desktopName = "key-mapper"; - genericName = "key-mapper"; + name = "input-remapper"; + exec = "input-remapper-gtk"; + icon = "input-remapper"; + desktopName = "input-remapper"; + genericName = "input-remapper"; }; meta = with lib; { - homepage = "https://github.com/sezanzeb/key-mapper"; + homepage = "https://github.com/sezanzeb/input-remapper"; description = "A tool to change the mapping of your input device buttons"; license = licenses.gpl3; maintainers = [ ]; diff --git a/packages/tools/games/input-remapper/hack-data-dir.patch b/packages/tools/games/input-remapper/hack-data-dir.patch new file mode 100644 index 0000000..af28660 --- /dev/null +++ b/packages/tools/games/input-remapper/hack-data-dir.patch @@ -0,0 +1,12 @@ +diff --git a/inputremapper/data.py b/inputremapper/data.py +index d5ec3a8..9fec89f 100644 +--- a/inputremapper/data.py ++++ b/inputremapper/data.py +@@ -68,6 +68,7 @@ def get_data_path(filename=""): + "/usr/share/input-remapper", + "/usr/local/share/input-remapper", + os.path.join(site.USER_BASE, "share/input-remapper"), ++ "@@NIXOS_OUT_PATH@@", + ] + + if data is None: diff --git a/packages/tools/games/key-mapper/add-scripts.patch b/packages/tools/games/key-mapper/add-scripts.patch deleted file mode 100644 index 364dc40..0000000 --- a/packages/tools/games/key-mapper/add-scripts.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/setup.py b/setup.py -index 99d298e..74a7948 100644 ---- a/setup.py -+++ b/setup.py -@@ -107,6 +107,12 @@ setup( - ('/usr/bin/', ['bin/key-mapper-control']), - ('/usr/bin/', ['bin/key-mapper-helper']), - ], -+ scripts=[ -+ 'bin/key-mapper-gtk', -+ 'bin/key-mapper-service', -+ 'bin/key-mapper-control', -+ 'bin/key-mapper-helper' -+ ], - install_requires=[ - 'setuptools', - 'evdev', diff --git a/packages/tools/games/key-mapper/hack-data-dir.patch b/packages/tools/games/key-mapper/hack-data-dir.patch deleted file mode 100644 index 5e211cc..0000000 --- a/packages/tools/games/key-mapper/hack-data-dir.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/keymapper/data.py b/keymapper/data.py -index 6f3e428..8eded95 100644 ---- a/keymapper/data.py -+++ b/keymapper/data.py -@@ -68,6 +68,7 @@ def get_data_path(filename=""): - "/usr/share/key-mapper", - "/usr/local/share/key-mapper", - os.path.join(site.USER_BASE, "share/key-mapper"), -+ "@@NIXOS_OUT_PATH@@", - ] - - if data is None: diff --git a/packages/tools/games/sunshine/default.nix b/packages/tools/games/sunshine/default.nix new file mode 100644 index 0000000..987f6bd --- /dev/null +++ b/packages/tools/games/sunshine/default.nix @@ -0,0 +1,62 @@ +{ stdenv, lib, + pkgconfig, cmake, ffmpeg, libdrm, libpulseaudio, xorg, + libcap, wayland, libopus, boost, openssl, libevdev, mesa, + fetchgit +}: + +stdenv.mkDerivation rec { + pname = "sunehine"; + version = "0.10.1"; + + src = fetchgit { + url = "https://github.com/loki-47-6F-64/sunshine.git"; + rev = "v${version}"; + sha256 = "1aw8bis5v7rb3ixl378gqm34rx3sja7pp5g6kjd9b0yvl1bgxai6"; + deepClone = true; + }; + + nativeBuildInputs = [ + pkgconfig cmake + ]; + + buildInputs = [ + wayland # Wayland + libdrm libcap # KMS + xorg.libxcb xorg.libX11 xorg.libXtst xorg.libXrandr xorg.libXfixes libevdev # X11 + libopus libpulseaudio boost ffmpeg openssl # Common + ]; + + propagatedBuildInputs = [ mesa ]; + + cmakeFlags = [ + "-DSUNSHINE_ENABLE_X11=off" + "-DSUNSHINE_ENABLE_CUDA=off" + "-DCMAKE_BUILD_TYPE=Release" + ]; + NIX_CFLAGS_COMPILE = "-Wformat"; + + patches = [ ./fuck.patch ]; + + preConfigure = '' + # Fix hardcoded path to libevdev + sed \ + -e "s|/usr/include/libevdev-1.0|${libevdev}/include/libevdev-1.0|" \ + -e "s|@@SUNSHINE_ASSETS_DIR@@|$out/share/sunshine|" \ + --in-place CMakeLists.txt + ''; + + installPhase = '' + mkdir -p $out/bin + mkdir -p $out/share/sunshine/ + cp -r ../assets $out/share/sunshine/assets + mv sunshine $out/bin/sunshine + ''; + + meta = with lib; { + description = "Host for Moonlight Streaming Client "; + homepage = "https://github.com/loki-47-6F-64/sunshine"; + license = licenses.gpl3; + maintainers = [ ]; + platforms = platforms.linux; + }; +} diff --git a/packages/tools/games/sunshine/fuck.patch b/packages/tools/games/sunshine/fuck.patch new file mode 100644 index 0000000..01d9dfa --- /dev/null +++ b/packages/tools/games/sunshine/fuck.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 45d4bf7..bd8c638 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -241,9 +241,7 @@ else() + list(APPEND SUNSHINE_COMPILE_OPTIONS -O3) + endif() + +-if(NOT SUNSHINE_ASSETS_DIR) +- set(SUNSHINE_ASSETS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/assets") +-endif() ++set(SUNSHINE_ASSETS_DIR "@@SUNSHINE_ASSETS_DIR@@/assets") + + if(NOT SUNSHINE_CONFIG_DIR) + set(SUNSHINE_CONFIG_DIR "${SUNSHINE_ASSETS_DIR}") diff --git a/secrets/default.nix b/secrets/default.nix new file mode 100644 index 0000000..2eb3413 Binary files /dev/null and b/secrets/default.nix differ