aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix113
1 files changed, 67 insertions, 46 deletions
diff --git a/flake.nix b/flake.nix
index 5b55e7f..b1edc6f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,5 +1,5 @@
{
- description = "Raylib C/C++ Dev Environment";
+ description = "Dungeon project dev environment with Raylib 5.5, raytmx, and hoxml";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
@@ -15,74 +15,95 @@
"aarch64-darwin"
];
- forEachSystem = nixpkgs.lib.genAttrs supportedSystems;
+ forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
{
- packages = forEachSystem (system:
+ packages = forAllSystems (
+ system:
let
- pkgs = nixpkgs.legacyPackages.${system};
+ pkgs = import nixpkgs { inherit system; };
+
+ myRaylib = pkgs.raylib.overrideAttrs (oldAttrs: {
+ version = "5.5";
+ src = pkgs.fetchFromGitHub {
+ owner = "raysan5";
+ repo = "raylib";
+ rev = "c1ab645ca298a2801097931d1079b10ff7eb9df8";
+ hash = "sha256-J99i4z4JF7d6mJNuJIB0rHNDhXJ5AEkG0eBvvuBLHrY=";
+ };
+ });
+
+ raytmx = pkgs.stdenv.mkDerivation {
+ pname = "raytmx";
+ version = "d4e09bc";
+ src = pkgs.fetchFromGitHub {
+ owner = "luphi";
+ repo = "raytmx";
+ rev = "d4e09bcfa7a2fb553853b15b25f0fa74f6cb8912";
+ hash = "sha256-uahAiQ2HucRV86/ZOoYw03mhd8hLVcGPmheG5cy44oU=";
+ };
+ installPhase = ''
+ mkdir -p $out/include
+ cp raytmx.h $out/include/
+ '';
+ };
+
+ hoxml = pkgs.stdenv.mkDerivation {
+ pname = "hoxml";
+ version = "12938da";
+ src = pkgs.fetchFromGitHub {
+ owner = "luphi";
+ repo = "hoxml";
+ rev = "12938da4ce3217ce7986acfc7745744acb7c5dfb";
+ hash = "sha256-h5fouCX0+GRtEnJ5KlaIyDTj5I0oFmlUj8NsvjKzGho=";
+ };
+ installPhase = ''
+ mkdir -p $out/include
+ cp hoxml.h $out/include/
+ '';
+ };
+
in
{
default = pkgs.stdenv.mkDerivation {
- pname = "dungeon-crawler";
+ pname = "dungeon";
version = "0.1.0";
+
src = ./.;
- nativeBuildInputs = with pkgs; [
- pkg-config
- gnumake
+ buildInputs = [
+ myRaylib
+ raytmx
+ hoxml
];
- buildInputs = with pkgs; [
- raylib
- ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
- libGL
- libX11
- libXrandr
- libXi
- libXcursor
- libXinerama
+ nativeBuildInputs = [
+ pkgs.pkg-config
+ pkgs.cmake
];
- buildPhase = ''
- make
- '';
-
- installPhase = ''
- mkdir -p $out/bin
- cp bin/dungeon_game $out/bin/dungeon-crawler
- '';
+ cmakeFlags = [ "-DUSE_NIX=ON" ];
};
- });
-
- apps = forEachSystem (system: {
- default = {
- type = "app";
- program = "${self.packages.${system}.default}/bin/dungeon-crawler";
- };
- });
+ }
+ );
- devShells = forEachSystem (
+ devShells = forAllSystems (
system:
let
- pkgs = nixpkgs.legacyPackages.${system};
+ pkgs = import nixpkgs { inherit system; };
in
{
default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.default ];
- packages = with pkgs; [
- gcc
- clang-tools
- gdb
- tiled
- zsh
- ];
- shellHook = ''
- export SHELL=${pkgs.zsh}/bin/zsh
- echo "Raylib dev shell loaded."
- '';
};
}
);
+
+ apps = forAllSystems (system: {
+ default = {
+ type = "app";
+ program = "${self.packages.${system}.default}/bin/dungeon_game";
+ };
+ });
};
}