Compare commits

...

3 Commits

7 changed files with 66 additions and 9 deletions

View File

@ -56,7 +56,7 @@
];
};
in {
inherit (pkgs) wayqt dfl-ipc dfl-applications dfl-utils qtgreet xwaylandvideobridge obs-cli;
inherit (pkgs) wayqt dfl-ipc dfl-applications dfl-utils qtgreet xwaylandvideobridge obs-cli rgb_keyboard;
};
});
}

View File

@ -166,6 +166,8 @@
kernel.sysctl = {
# League of Legends under Linux
"abi.vsyscall32" = 0;
# Fedora 39
"vm.max_map_count" = 2147483642;
};
extraModulePackages = [ kernel.vendor-reset ];

View File

@ -19,10 +19,11 @@
boot = {
initrd = {
availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "sdhci_pci"
"aesni-intel"
# NOTE: See https://github.com/NixOS/nixos-hardware/blob/master/common/pc/laptop/acpi_call.nix
#"acpi_call" ];
];
kernelModules = [ "dm-snapshot" ];
kernelModules = [ "dm-snapshot" "aesni-intel" ];
luks.devices = {
cryptroot = {
device = "/dev/disk/by-uuid/e1011c40-e1a9-4ce6-b89f-f14b046639c1";

View File

@ -20,7 +20,7 @@ in {
(pkgs.callPackage ./wrapper.nix {
inherit (pkgs) retroarch;
cores = with pkgs.libretro; [
mgba mupen64plus melonds desmume dolphin
mgba mupen64plus melonds desmume dolphin pcsx2
];
})

View File

@ -7,7 +7,15 @@ in {
enable = lib.mkEnableOption "Enable and configure gamemode";
};
config = lib.mkIf cfg.enable {
config = let
keyboardBrightnessScript = pkgs.writeShellScript "keyboard-brightness.sh" ''
${pkgs.rgb_keyboard}/bin/rgb_keyboard -l ripple -b "$1"
'';
in lib.mkIf cfg.enable {
security.sudo.extraConfig = ''
${config.ptw.system.singleUser} ALL = (ALL) NOPASSWD: ${keyboardBrightnessScript}
'';
programs.gamemode = {
enable = true;
enableRenice = true;
@ -29,14 +37,28 @@ in {
};
custom = let
switchScript = groupName: pkgs.writeShellScript "switch-input-group.sh" ''
${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.SwitchInputMethodGroup string:'${groupName}'
'';
switchScript = groupName: "${pkgs.dbus}/bin/dbus-send --print-reply --dest=org.fcitx.Fcitx5 /controller org.fcitx.Fcitx.Controller1.SwitchInputMethodGroup string:'${groupName}'";
pauseFcitx = switchScript "Group 2";
resumeFcitx = switchScript "Group 1";
# The scripts
start = pkgs.writeShellScript "gamemode-start.sh" ''
# Disable Fcitx's IME
${pauseFcitx}
# Turn on the keyboard lights
${config.security.wrapperDir}/sudo ${keyboardBrightnessScript} 1
'';
end = pkgs.writeShellScript "gamemode-end.sh" ''
# Resume Fcitx's IME
${resumeFcitx}
# Turn off the keyboard lights
${config.security.wrapperDir}/sudo ${keyboardBrightnessScript} 0
'';
in {
start = ''${pauseFcitx}'';
end = ''${resumeFcitx}'';
start = "${start}";
end = "${end}";
};
};
};

View File

@ -0,0 +1,30 @@
{
stdenv
, fetchFromGitHub
, gcc, gnumake
, libusb
}:
stdenv.mkDerivation rec {
pname = "rgb_keyboard";
version = "20230430";
src = fetchFromGitHub {
owner = "PapaTutuWawa";
repo = "rgb_keyboard";
rev = "5bbdafea77ef3c3eb47081494f3b58abcd5c4e27";
sha256 = "0m5hvlhqncy1qn5v6gpsz9qd2p4cvcjjnma08vb4b2ybq4kfv7qw";
};
buildInputs = [
libusb
];
buildPhase = ''
${gnumake}/bin/make build
'';
installPhase = ''
mkdir -p $out/bin/
cp rgb_keyboard $out/bin/
'';
}

View File

@ -123,4 +123,6 @@ in {
gajim = prev.callPackage ./applications/networking/instant-messengers/gajim/default.nix {
nbxmpp = prev.python3.pkgs.callPackage ./applications/networking/instant-messengers/gajim/nbxmpp.nix {};
};
rgb_keyboard = prev.callPackage ./applications/desktop/rgb_keyboard/default.nix {};
}