From 35035a543c9ed2e3383ecfdf6b9c610e20c3223c Mon Sep 17 00:00:00 2001 From: Philipp Middendorf Date: Sun, 22 Dec 2019 21:10:48 +0100 Subject: [PATCH 1/2] xow: init at 0.2 --- nixos/modules/hardware/uinput.nix | 19 +++++++++++++++ nixos/modules/module-list.nix | 2 ++ nixos/modules/services/hardware/xow.nix | 30 +++++++++++++++++++++++ pkgs/misc/drivers/xow/default.nix | 32 +++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 5 files changed, 85 insertions(+) create mode 100644 nixos/modules/hardware/uinput.nix create mode 100644 nixos/modules/services/hardware/xow.nix create mode 100644 pkgs/misc/drivers/xow/default.nix diff --git a/nixos/modules/hardware/uinput.nix b/nixos/modules/hardware/uinput.nix new file mode 100644 index 000000000000..101c12fe257e --- /dev/null +++ b/nixos/modules/hardware/uinput.nix @@ -0,0 +1,19 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.hardware.uinput; +in { + options.hardware.uinput = { + enable = lib.mkEnableOption "Whether to enable uinput support"; + }; + + config = lib.mkIf cfg.enable { + boot.kernelModules = [ "uinput" ]; + + users.groups.uinput = {}; + + services.udev.extraRules = '' + SUBSYSTEM=="misc", KERNEL=="uinput", MODE="0660", GROUP="uinput", OPTIONS+="static_node=uinput" + ''; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index c2a96c72d165..a3f68207f79f 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -65,6 +65,7 @@ ./hardware/usb-wwan.nix ./hardware/onlykey.nix ./hardware/wooting.nix + ./hardware/uinput.nix ./hardware/video/amdgpu.nix ./hardware/video/amdgpu-pro.nix ./hardware/video/ati.nix @@ -368,6 +369,7 @@ ./services/hardware/thermald.nix ./services/hardware/undervolt.nix ./services/hardware/vdr.nix + ./services/hardware/xow.nix ./services/logging/SystemdJournal2Gelf.nix ./services/logging/awstats.nix ./services/logging/fluentd.nix diff --git a/nixos/modules/services/hardware/xow.nix b/nixos/modules/services/hardware/xow.nix new file mode 100644 index 000000000000..a97dd5c870d7 --- /dev/null +++ b/nixos/modules/services/hardware/xow.nix @@ -0,0 +1,30 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.services.hardware.xow; +in { + options.services.hardware.xow = { + enable = lib.mkEnableOption "Whether to enable xow or not."; + }; + + config = lib.mkIf cfg.enable { + hardware.uinput.enable = true; + + users.users.xow = { + group = "uinput"; + isSystemUser = true; + }; + + systemd.services.xow = { + wantedBy = [ "multi-user.target" ]; + description = "Xbox One Wireless Dongle Driver"; + after = [ "systemd-udev-settle.service" ]; + serviceConfig = { + ExecStart = '' + ${pkgs.xow}/bin/xow + ''; + User = "xow"; + }; + }; + }; +} diff --git a/pkgs/misc/drivers/xow/default.nix b/pkgs/misc/drivers/xow/default.nix new file mode 100644 index 000000000000..5ca3f235fcce --- /dev/null +++ b/pkgs/misc/drivers/xow/default.nix @@ -0,0 +1,32 @@ +{ stdenv, fetchFromGitHub, libusb, gitMinimal }: + +stdenv.mkDerivation rec { + pname = "xow"; + version = "0.2"; + + src = fetchFromGitHub { + owner = "medusalix"; + repo = "xow"; + rev = "v${version}"; + sha256 = "03ajal91xi52svzy621aa4jcdf0vj4pqd52kljam0wryrlmcpbr3"; + }; + + makeFlags = [ "BUILD=RELEASE" "VERSION=${version}" ]; + enableParallelBuilding = true; + buildInputs = [ libusb ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/bin + cp xow $out/bin + runHook postInstall + ''; + + meta = with stdenv.lib; { + homepage = "https://github.com/medusalix/xow"; + description = "Linux driver for the Xbox One wireless dongle"; + license = licenses.gpl2Plus; + maintainers = [ maintainers.pmiddend ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ef0d40f91b1d..a6427ccbe989 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -26011,6 +26011,8 @@ in xboxdrv = callPackage ../misc/drivers/xboxdrv { }; + xow = callPackage ../misc/drivers/xow { }; + xbps = callPackage ../tools/package-management/xbps { }; xcftools = callPackage ../tools/graphics/xcftools { }; From 081ed8f0126178a0d2c624fd4bd946704db7fc6a Mon Sep 17 00:00:00 2001 From: Jan Solanti Date: Mon, 30 Mar 2020 04:05:52 +0300 Subject: [PATCH 2/2] xow: 0.2 -> 0.4 --- nixos/modules/hardware/uinput.nix | 2 +- nixos/modules/services/hardware/xow.nix | 19 +++---------------- pkgs/misc/drivers/xow/default.nix | 25 +++++++++++++------------ 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/nixos/modules/hardware/uinput.nix b/nixos/modules/hardware/uinput.nix index 101c12fe257e..55e86bfa6bdb 100644 --- a/nixos/modules/hardware/uinput.nix +++ b/nixos/modules/hardware/uinput.nix @@ -4,7 +4,7 @@ let cfg = config.hardware.uinput; in { options.hardware.uinput = { - enable = lib.mkEnableOption "Whether to enable uinput support"; + enable = lib.mkEnableOption "uinput support"; }; config = lib.mkIf cfg.enable { diff --git a/nixos/modules/services/hardware/xow.nix b/nixos/modules/services/hardware/xow.nix index a97dd5c870d7..a18d60ad83be 100644 --- a/nixos/modules/services/hardware/xow.nix +++ b/nixos/modules/services/hardware/xow.nix @@ -4,27 +4,14 @@ let cfg = config.services.hardware.xow; in { options.services.hardware.xow = { - enable = lib.mkEnableOption "Whether to enable xow or not."; + enable = lib.mkEnableOption "xow as a systemd service"; }; config = lib.mkIf cfg.enable { hardware.uinput.enable = true; - users.users.xow = { - group = "uinput"; - isSystemUser = true; - }; + systemd.packages = [ pkgs.xow ]; - systemd.services.xow = { - wantedBy = [ "multi-user.target" ]; - description = "Xbox One Wireless Dongle Driver"; - after = [ "systemd-udev-settle.service" ]; - serviceConfig = { - ExecStart = '' - ${pkgs.xow}/bin/xow - ''; - User = "xow"; - }; - }; + services.udev.packages = [ pkgs.xow ]; }; } diff --git a/pkgs/misc/drivers/xow/default.nix b/pkgs/misc/drivers/xow/default.nix index 5ca3f235fcce..d5afc96c3b4a 100644 --- a/pkgs/misc/drivers/xow/default.nix +++ b/pkgs/misc/drivers/xow/default.nix @@ -1,32 +1,33 @@ -{ stdenv, fetchFromGitHub, libusb, gitMinimal }: +{ stdenv, fetchFromGitHub, libusb }: stdenv.mkDerivation rec { pname = "xow"; - version = "0.2"; + version = "0.4"; src = fetchFromGitHub { owner = "medusalix"; repo = "xow"; rev = "v${version}"; - sha256 = "03ajal91xi52svzy621aa4jcdf0vj4pqd52kljam0wryrlmcpbr3"; + sha256 = "1xkwcx2gqip9v2h3zjmrn7sgcck3midl5alhsmr3zivgdipamynv"; }; - makeFlags = [ "BUILD=RELEASE" "VERSION=${version}" ]; + makeFlags = [ + "BUILD=RELEASE" + "VERSION=${version}" + "BINDIR=${placeholder ''out''}/bin" + "UDEVDIR=${placeholder ''out''}/lib/udev/rules.d" + "MODLDIR=${placeholder ''out''}/lib/modules-load.d" + "MODPDIR=${placeholder ''out''}/lib/modprobe.d" + "SYSDDIR=${placeholder ''out''}/lib/systemd/system" + ]; enableParallelBuilding = true; buildInputs = [ libusb ]; - installPhase = '' - runHook preInstall - mkdir -p $out/bin - cp xow $out/bin - runHook postInstall - ''; - meta = with stdenv.lib; { homepage = "https://github.com/medusalix/xow"; description = "Linux driver for the Xbox One wireless dongle"; license = licenses.gpl2Plus; - maintainers = [ maintainers.pmiddend ]; + maintainers = [ maintainers.jansol ]; platforms = platforms.linux; }; }