about summary refs log tree commit diff
path: root/pkgs/list-gamecontrollers/default.nix
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-01-26 01:57:30 +0100
committeraszlig <aszlig@redmoonstudios.org>2016-01-26 02:01:16 +0100
commit0353b8b3ffcbaa102d36fa7e8f2bb218a1374820 (patch)
tree56fcd560f2a77faba5cf9ed5999993833257670a /pkgs/list-gamecontrollers/default.nix
parent3b343e7984ec3f2d2e9c5f02b5205b2aecc5a2dd (diff)
pkgs: Add a small utility to dump joystick GUIDs
SDL 2 has an environment variable called SDL_GAMECONTROLLERCONFIG, which
lists button/axis mappings of various game controllers attached to the
system.

The game controllers are themselves identified using a GUID which is SDL
2 specific and this tool is there to just dump the name of a particular
game controller along with the GUID so it's easier to get the GUID.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/list-gamecontrollers/default.nix')
-rw-r--r--pkgs/list-gamecontrollers/default.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/list-gamecontrollers/default.nix b/pkgs/list-gamecontrollers/default.nix
new file mode 100644
index 00000000..c207d2eb
--- /dev/null
+++ b/pkgs/list-gamecontrollers/default.nix
@@ -0,0 +1,10 @@
+{ runCommand, pkgconfig, SDL2 }:
+
+runCommand "list-gamecontrollers" {
+  buildInputs = [ pkgconfig SDL2 ];
+} ''
+  mkdir -p "$out/bin"
+  gcc -Werror "${./list-gc.c}" \
+    $(pkg-config --libs --cflags sdl2) \
+    -o "$out/bin/list-gamecontrollers"
+''