diff --git a/nixos/modules/hardware/accessories/default.nix b/nixos/modules/hardware/accessories/default.nix new file mode 100644 index 0000000..084d0c8 --- /dev/null +++ b/nixos/modules/hardware/accessories/default.nix @@ -0,0 +1,7 @@ +{...}: { + imports = [ + ./logitech-wireless.nix + ./piper.nix + ./xbox-one-controller.nix + ]; +} diff --git a/nixos/modules/hardware/accessories/logitech-wireless.nix b/nixos/modules/hardware/accessories/logitech-wireless.nix new file mode 100644 index 0000000..7beab63 --- /dev/null +++ b/nixos/modules/hardware/accessories/logitech-wireless.nix @@ -0,0 +1,19 @@ +{ + lib, + config, + ... +}: let + cfg = config.myFlake.nixos.hardware.accessories.logitech-wireless; +in { + options = { + myFlake.nixos.hardware.accessories.logitech-wireless.enable = + lib.mkEnableOption "Whether to enable support for wireless Logitech hardwares."; + }; + + config = lib.mkIf cfg.enable { + hardware.logitech.wireless = { + enable = true; + enableGraphical = true; + }; + }; +} diff --git a/nixos/modules/hardware/accessories/piper.nix b/nixos/modules/hardware/accessories/piper.nix new file mode 100644 index 0000000..d1f6b42 --- /dev/null +++ b/nixos/modules/hardware/accessories/piper.nix @@ -0,0 +1,18 @@ +{ + lib, + config, + pkgs, + ... +}: let + cfg = config.myFlake.nixos.hardware.accessories.piper; +in { + options = { + myFlake.nixos.hardware.accessories.piper.enable = + lib.mkEnableOption "Whether to enable Piper."; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = [pkgs.piper]; + services.ratbagd.enable = true; + }; +} diff --git a/nixos/modules/hardware/accessories/xbox-one-controller.nix b/nixos/modules/hardware/accessories/xbox-one-controller.nix new file mode 100644 index 0000000..da7d848 --- /dev/null +++ b/nixos/modules/hardware/accessories/xbox-one-controller.nix @@ -0,0 +1,18 @@ +{ + lib, + config, + ... +}: let + cfg = config.myFlake.nixos.hardware.accessories.xboxOneController; +in { + options = { + myFlake.nixos.hardware.accessories.xboxOneController.enable = + lib.mkEnableOption "Whether to enable support for Xbox One controllers."; + }; + + # https://wiki.archlinux.org/title/Gamepad#Connect_Xbox_Wireless_Controller_with_Bluetooth + config = lib.mkIf cfg.enable { + hardware.xone.enable = true; # via Bluetooth + hardware.xpadneo.enable = true; # via wired or wireless dongle + }; +} diff --git a/nixos/modules/hardware/default.nix b/nixos/modules/hardware/default.nix index 08405b1..e4a5cb8 100644 --- a/nixos/modules/hardware/default.nix +++ b/nixos/modules/hardware/default.nix @@ -1,5 +1,6 @@ {...}: { imports = [ + ./accessories ./cpu ./gpu ./misc diff --git a/nixos/profiles/core/packages/anti-feature.nix b/nixos/profiles/core/packages/anti-feature.nix index a10a082..d8cc33d 100644 --- a/nixos/profiles/core/packages/anti-feature.nix +++ b/nixos/profiles/core/packages/anti-feature.nix @@ -25,7 +25,7 @@ "nvidia-x11" #"nvidia-settings" #"nvidia-persistenced" - #"xow_dongle-firmware" + "xow_dongle-firmware" #"facetimehd-firmware" "osu-lazer-bin-2023.1026.0" "spotify" diff --git a/nixos/profiles/desktop/addtional/accessories/logitech.nix b/nixos/profiles/desktop/addtional/accessories/logitech.nix deleted file mode 100755 index 5a3db68..0000000 --- a/nixos/profiles/desktop/addtional/accessories/logitech.nix +++ /dev/null @@ -1,8 +0,0 @@ -{...}: -# Logitech -{ - hardware.logitech.wireless = { - enable = true; - enableGraphical = true; - }; -} diff --git a/nixos/profiles/desktop/addtional/accessories/xbox.nix b/nixos/profiles/desktop/addtional/accessories/xbox.nix deleted file mode 100755 index 66eac76..0000000 --- a/nixos/profiles/desktop/addtional/accessories/xbox.nix +++ /dev/null @@ -1,8 +0,0 @@ -{...}: -# Xbox accessories -{ - hardware = { - xone.enable = true; - xpadneo.enable = true; - }; -} diff --git a/nixos/profiles/desktop/addtional/gaming.nix b/nixos/profiles/desktop/addtional/gaming.nix index 008837e..1e32a9c 100644 --- a/nixos/profiles/desktop/addtional/gaming.nix +++ b/nixos/profiles/desktop/addtional/gaming.nix @@ -1,4 +1,10 @@ -{pkgs, ...}: { +{ + pkgs, + lib, + ... +}: { + myFlake.nixos.hardware.accessories.xboxOneController.enable = lib.mkDefault true; + programs.gamemode = { enable = true; settings.custom = { diff --git a/users/guanranwang/nixos/profiles/desktop/default.nix b/users/guanranwang/nixos/profiles/desktop/default.nix index 3bfa77f..38d59b6 100644 --- a/users/guanranwang/nixos/profiles/desktop/default.nix +++ b/users/guanranwang/nixos/profiles/desktop/default.nix @@ -41,7 +41,6 @@ extraPortals = with pkgs; [xdg-desktop-portal-gtk]; }; services = { - ratbagd.enable = true; gvfs.enable = true; gnome = { sushi.enable = true;