Skip to content

Instantly share code, notes, and snippets.

@adamlwgriffiths
Created March 2, 2021 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamlwgriffiths/da164eb9ffd3c6211260febce8637e76 to your computer and use it in GitHub Desktop.
Save adamlwgriffiths/da164eb9ffd3c6211260febce8637e76 to your computer and use it in GitHub Desktop.
Nix raylua
{ stdenv, lib, fetchFromGitHub, cmake,
mesa, libGLU, glfw,
libX11, libXi, libXcursor, libXrandr, libXinerama,
alsaSupport ? stdenv.hostPlatform.isLinux, alsaLib,
pulseSupport ? stdenv.hostPlatform.isLinux, libpulseaudio,
includeEverything ? true
}:
stdenv.mkDerivation rec {
pname = "raylib";
version = "3.5.0";
src = fetchFromGitHub {
owner = "raysan5";
repo = pname;
rev = version;
sha256 = "0syvd5js1lbx3g4cddwwncqg95l6hb3fdz5nsh5pqy7fr6v84kwj";
};
nativeBuildInputs = [ cmake ];
buildInputs = [
mesa libGLU glfw libX11 libXi libXcursor libXrandr libXinerama
] ++ lib.optional alsaSupport alsaLib
++ lib.optional pulseSupport libpulseaudio;
# https://github.com/raysan5/raylib/wiki/CMake-Build-Options
cmakeFlags = [
"-DUSE_EXTERNAL_GLFW=ON"
"-DSHARED=ON"
"-DBUILD_EXAMPLES=OFF"
] ++ lib.optional includeEverything "-DINCLUDE_EVERYTHING=ON";
# fix libasound.so/libpulse.so not being found
preFixup = ''
${lib.optionalString alsaSupport "patchelf --add-needed ${alsaLib}/lib/libasound.so $out/lib/libraylib.so.${version}"}
${lib.optionalString pulseSupport "patchelf --add-needed ${libpulseaudio}/lib/libpulse.so $out/lib/libraylib.so.${version}"}
'';
meta = with stdenv.lib; {
description = "raylib is a simple and easy-to-use library to enjoy videogames programming";
homepage = "http://www.raylib.com/";
license = licenses.zlib;
maintainers = with maintainers; [ adamlwgriffiths ];
platforms = platforms.linux;
};
}
# this is totally broken
# need to reference nix/raylib/default.nix so we can set LUA_PATH/LUA_CPATH accordingly
# httlet
libs = [];
inps://github.com/NixOS/nixpkgs/blob/c6975c45c3d65bd70c6566d1dcd0604eeba1cdc4/pkgs/applications/window-managers/awesome/default.nix#L67-L79
{ stdenv, lib, fetchFromGitHub, make, luaPackages }:
let
raylib = pkgs.callPackage ../raylib/default.nix { };
in
stdenv.mkDerivation rec {
pname = "raylua";
version = "3.5.0";
src = fetchFromGitHub {
owner = "Rabios";
repo = pname;
rev = version;
sha256 = "0syvd5js1lbx3g4cddwwncqg95l6hb3fdz5nsh5pqy7fr6v84kwj";
};
buildInputs = [
luaPackages.lua
raylib
];
LUA_CPATH = "${raylib}/lib/?.so";
meta = with stdenv.lib; {
description = "Lua bindings for raylib, a simple and easy-to-use library to enjoy videogames programming";
homepage = "https://github.com/Rabios/raylua";
license = licenses.isc;
maintainers = with maintainers; [ adamlwgriffiths ];
platforms = platforms.linux;
};
}
{ pkgs ? import <nixpkgs> {} }:
let
unstable = import <unstable> {};
raylib = pkgs.callPackage ./nix/raylib/default.nix { };
#raylib-lua = toLuaModule ( ./nix/raylib-lua/default.nix { } );
in
pkgs.mkShell {
buildInputs = [
pkgs.glfw
pkgs.luajit
raylib
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment