From 7549a7381117d65238ba72c3c74395bff1650a98 Mon Sep 17 00:00:00 2001 From: Ingo Ruhnke Date: Tue, 1 Mar 2022 17:09:02 +0100 Subject: [PATCH] Add Nix flake build files --- .gitignore | 1 + flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index 31d6826..219ba2b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ /tools/wiimote /virtualkeyboard /xboxdrv +/result cache/ config.log custom.py diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ceb2711 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1646011258, + "narHash": "sha256-+aen4zu5uVp52arEcgL2maCS0zQDuG1t+Azwd/O1gN4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a25df4c2b79c4343bcc72ad671200e5a3e286c41", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-21.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..3009eca --- /dev/null +++ b/flake.nix @@ -0,0 +1,38 @@ +{ + description = "Xbox360 USB Gamepad Userspace Driver"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in rec { + packages = flake-utils.lib.flattenTree { + xboxdrv = pkgs.stdenv.mkDerivation { + pname = "xboxdrv"; + version = "0.8.8"; + src = nixpkgs.lib.cleanSource ./.; + enableParallelBuilding = true; + nativeBuildInputs = [ + pkgs.scons + pkgs.pkg-config + ]; + installPhase = '' + make install PREFIX=$out + ''; + buildInputs = [ + pkgs.xorg.libX11 + pkgs.libusb1 + pkgs.boost + pkgs.glib + pkgs.dbus-glib + ]; + }; + }; + defaultPackage = packages.xboxdrv; + }); +}