This commit is contained in:
andromeda
2026-01-24 17:07:38 +01:00
commit 0ed50d577b
6 changed files with 186 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
lib
result*

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "rgfw"]
path = rgfw
url = https://github.com/ColleagueRiley/RGFW

113
flake.lock generated Normal file
View File

@@ -0,0 +1,113 @@
{
"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": 1765888948,
"narHash": "sha256-rgGAUQVfJ0sKXm9bzh7XIJUHh/JkEsz/LX6k8aCKeD4=",
"owner": "well-typed",
"repo": "hs-bindgen",
"rev": "fd74e8fa4216eccd67069ec9d8637b57000ffc83",
"type": "github"
},
"original": {
"owner": "well-typed",
"repo": "hs-bindgen",
"rev": "fd74e8fa4216eccd67069ec9d8637b57000ffc83",
"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": 1765772535,
"narHash": "sha256-aq+dQoaPONOSjtFIBnAXseDm9TUhIbe215TPmkfMYww=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "09b8fda8959d761445f12b55f380d90375a1d6bb",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixpkgs-unstable",
"type": "indirect"
}
},
"root": {
"inputs": {
"hs-bindgen": "hs-bindgen",
"nixpkgs": "nixpkgs_2"
}
}
},
"root": "root",
"version": 7
}

59
flake.nix Normal file
View File

@@ -0,0 +1,59 @@
{
inputs = {
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
hs-bindgen.url = "github:well-typed/hs-bindgen/fd74e8fa4216eccd67069ec9d8637b57000ffc83";
self.submodules = true;
};
outputs = {
nixpkgs,
hs-bindgen,
self,
...
}: let
version = "0.1.0";
package = {
mkDerivation,
lib,
base,
}:
mkDerivation {
pname = "hs-rgfw";
inherit version;
src = ./.;
libraryHaskellDepends = [
base
];
libraryPkgconfigDepends = [
];
homepage = "https://git.mtgmonkey.net/Andromeda/hs-rgfw";
license = lib.licenses.bsd3;
platforms = ["x86_64-linux"];
};
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [
hs-bindgen.overlays.libclangBindings
hs-bindgen.overlays.hsBindgen
];
};
in {
devShells.${system} = {
default = pkgs.mkShell {
stdenv = pkgs.clangStdenv;
packages = [
pkgs.clang
pkgs.cabal-install
pkgs.hs-bindgen-cli
pkgs.hsBindgenHook
];
inputsFrom = [
self.packages.${system}.default
];
};
};
packages.${system} = {
default = pkgs.haskellPackages.callPackage package {};
};
};
}

8
generate.sh Executable file
View File

@@ -0,0 +1,8 @@
hs-bindgen-cli preprocess \
-Irgfw \
--create-output-dirs \
--overwrite-files \
--hs-output-dir lib \
--module RGFW.Generated \
--clang-option=-DRGFW_OPENGL \
RGFW.h

1
rgfw Submodule

Submodule rgfw added at 83d945ae89