-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[nix] compile my own xow with newer libusb
To avoid medusalix/xow#141
- Loading branch information
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
self: super: | ||
{ | ||
mylibusb1 = super.callPackage pkgs/mylibusb1 { }; | ||
myxow = super.callPackage pkgs/myxow { }; | ||
} |
47 changes: 47 additions & 0 deletions
47
nix/home-manager/reinis/overlays/pkgs/mylibusb1/default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ lib, stdenv | ||
, fetchFromGitHub | ||
, fetchpatch | ||
, autoreconfHook | ||
, pkg-config | ||
, enableUdev ? stdenv.isLinux && !stdenv.hostPlatform.isMusl | ||
, udev | ||
, withStatic ? false | ||
}: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "mylibusb"; | ||
version = "1.0.25"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "libusb"; | ||
repo = "libusb"; | ||
rev = "v${version}"; | ||
sha256 = "sha256-9ha22rlHFCrWYvcYKYAUlMC4aWMElDAgUPMxKePzPJA="; | ||
}; | ||
|
||
outputs = [ "out" "dev" ]; | ||
|
||
nativeBuildInputs = [ pkg-config autoreconfHook ]; | ||
propagatedBuildInputs = lib.optional enableUdev udev; | ||
|
||
dontDisableStatic = withStatic; | ||
|
||
configureFlags = lib.optional (!enableUdev) "--disable-udev"; | ||
|
||
preFixup = lib.optionalString enableUdev '' | ||
sed 's,-ludev,-L${lib.getLib udev}/lib -ludev,' -i $out/lib/libusb-1.0.la | ||
''; | ||
|
||
meta = with lib; { | ||
homepage = "https://libusb.info/"; | ||
repositories.git = "https://github.com/libusb/libusb"; | ||
description = "cross-platform user-mode USB device library"; | ||
longDescription = '' | ||
libusb is a cross-platform user-mode library that provides access to USB devices. | ||
''; | ||
platforms = platforms.all; | ||
license = licenses.lgpl21Plus; | ||
maintainers = with maintainers; [ prusnak ]; | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ lib, stdenv, cabextract, fetchurl, fetchFromGitHub, mylibusb1 }: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "myxow"; | ||
version = "0.5"; | ||
|
||
src = fetchFromGitHub { | ||
owner = "medusalix"; | ||
repo = "xow"; | ||
rev = "v${version}"; | ||
sha256 = "071r2kx44k1sc49cad3i607xg618mf34ki1ykr5lnfx9y6qyz075"; | ||
}; | ||
|
||
firmware = fetchurl { | ||
url = "http://download.windowsupdate.com/c/msdownload/update/driver/drvs/2017/07/1cd6a87c-623f-4407-a52d-c31be49e925c_e19f60808bdcbfbd3c3df6be3e71ffc52e43261e.cab"; | ||
sha256 = "013g1zngxffavqrk5jy934q3bdhsv6z05ilfixdn8dj0zy26lwv5"; | ||
}; | ||
|
||
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" | ||
]; | ||
|
||
postUnpack = '' | ||
cabextract -F FW_ACC_00U.bin ${firmware} | ||
mv FW_ACC_00U.bin source/firmware.bin | ||
''; | ||
|
||
enableParallelBuilding = true; | ||
nativeBuildInputs = [ cabextract ]; | ||
buildInputs = [ mylibusb1 ]; | ||
|
||
meta = with lib; { | ||
homepage = "https://github.com/medusalix/xow"; | ||
description = "Linux driver for the Xbox One wireless dongle"; | ||
license = licenses.gpl2Plus; | ||
maintainers = [ maintainers.jansol ]; | ||
platforms = platforms.linux; | ||
}; | ||
} | ||
|