init - nonworking

This commit is contained in:
mtgmonkey
2025-12-12 23:38:13 +01:00
commit c761796c3f
4 changed files with 14209 additions and 0 deletions

112
flake.lock generated Normal file
View File

@@ -0,0 +1,112 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1763759067,
"narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"hs-bindgen": {
"inputs": {
"flake-parts": "flake-parts",
"libclang-bindings-src": "libclang-bindings-src",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1765557367,
"narHash": "sha256-GMD8TF7TC9uvzd3SGMQp4pQyS4875IUhrNWJ5jgP7KQ=",
"owner": "well-typed",
"repo": "hs-bindgen",
"rev": "8ae66be2d8fbcd47024c168620ea198e2f23bfd9",
"type": "github"
},
"original": {
"owner": "well-typed",
"repo": "hs-bindgen",
"type": "github"
}
},
"libclang-bindings-src": {
"flake": false,
"locked": {
"lastModified": 1765293798,
"narHash": "sha256-fZvyZo5emD1W5LwrIg2zTUYE9StRh3xF8TcuXjzKIAk=",
"owner": "well-typed",
"repo": "libclang",
"rev": "b8305bd9c3e8e8f63d6f415553388be7f233ef45",
"type": "github"
},
"original": {
"owner": "well-typed",
"repo": "libclang",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1764947035,
"narHash": "sha256-EYHSjVM4Ox4lvCXUMiKKs2vETUSL5mx+J2FfutM7T9w=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a672be65651c80d3f592a89b3945466584a22069",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1761765539,
"narHash": "sha256-b0yj6kfvO8ApcSE+QmA6mUfu8IYG6/uU28OFn4PaC8M=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "719359f4562934ae99f5443f20aa06c2ffff91fc",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1765425892,
"narHash": "sha256-jlQpSkg2sK6IJVzTQBDyRxQZgKADC2HKMRfGCSgNMHo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5d6bdbddb4695a62f0d00a3620b37a15275a5093",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixpkgs-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"hs-bindgen": "hs-bindgen",
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}

49
flake.nix Normal file
View File

@@ -0,0 +1,49 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
hs-bindgen.url = "github:well-typed/hs-bindgen";
};
outputs = {
nixpkgs,
hs-bindgen,
self,
...
}: let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in {
devShells.${system} = {
default = pkgs.mkShell {
stdenv = pkgs.clangStdenv;
packages = [
pkgs.pkg-config
pkgs.xorg.libX11
pkgs.xorg.libXcursor
pkgs.xorg.libXrandr
pkgs.xorg.libXi
pkgs.libGL
pkgs.clang
hs-bindgen.packages.${system}.default
];
shellHook = ''
# template
# export BINDGEN_EXTRA_CLANG_ARGS="$BINDGEN_EXTRA_CLANG_ARGS "
# c flags from Nix
export BINDGEN_EXTRA_CLANG_ARGS="$BINDGEN_EXTRA_CLANG_ARGS $(cat ${pkgs.clang}/nix-support/cc-cflags) $(cat ${pkgs.clang}/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE"
# pkg-config for libraries
export BINDGEN_EXTRA_CLANG_ARGS="$BINDGEN_EXTRA_CLANG_ARGS $(pkg-config --cflags --libs x11 xrandr xcursor xi gl)"
# add local headers
export BINDGEN_EXTRA_CLANG_ARGS="$BINDGEN_EXTRA_CLANG_ARGS -isystem $PWD/lib"
# no global include
# export BINDGEN_BUILTIN_INCLUDE_DIR=disable
echo $BINDGEN_EXTRA_CLANG_ARGS
'';
};
};
};
}

14034
lib/RGFW.h Normal file

File diff suppressed because it is too large Load Diff

14
lib/RGFW_HS.h Normal file
View File

@@ -0,0 +1,14 @@
#ifndef RGFW_HS // avoid repeated imports
#define RGFW_HS
// TODO add actual include logic
#define RGFW_IMPLEMENTATION
#define RGFW_DEBUG
#define RGFW_OPENGL
#define Time X11Time // fixes namespace clash with GHC when building with Nix
#include "RGFW.h"
#undef Time
#endif