Skip to content

Commit

Permalink
Added nix flake package
Browse files Browse the repository at this point in the history
  • Loading branch information
Soupstraw committed Dec 4, 2023
1 parent 125ae9a commit 77486e3
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 14 deletions.
19 changes: 19 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ mkDerivation, base, containers, exceptions, lens, lib, libGL
, libX11, libXcursor, libXext, libXi, libXinerama, libXrandr, raylib, ...
}:
mkDerivation {
pname = "h-raylib";
version = "5.0.0.1";
src = ./.;
isLibrary = true;
isExecutable = true;
configureFlags = [
"-fplatform-nixos"
];
libraryHaskellDepends = [ base containers exceptions lens ];
librarySystemDepends = [
libGL libX11 libXcursor libXext libXi libXinerama libXrandr raylib
];
description = "Raylib bindings for Haskell";
license = lib.licenses.asl20;
}
47 changes: 33 additions & 14 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
inputs.nixpkgs.url = "nixpkgs";
inputs = {
nixpkgs.url = "nixpkgs";
};

outputs = { self, nixpkgs, ... }@inputs:
let
Expand All @@ -9,7 +11,25 @@

pkgsForSystem =
system:
import nixpkgs { inherit system; overlays = [ ]; };
import nixpkgs {
inherit system;
overlays = [
(self: super: {
raylib = super.raylib.overrideAttrs (old: {
patches = [];
src = self.fetchFromGitHub {
owner = "raysan5";
repo = "raylib";
rev = "e33e9da277865207123158430ebf42cc5626e5b7";
sha256 = "sha256-tLvaO8zWHx8+NTV17X49JveWdVPG5AKuTzFsyDDaTss=";
};
postFixup = ''
cp ../src/*.h $out/include/
'';
});
})
];
};
in
{
devShells = forAllSystems (system:
Expand All @@ -24,23 +44,22 @@
stdenv.cc
ghc

((raylib.override { includeEverything = true; }).overrideAttrs (old: {
patches = [];
src = fetchFromGitHub {
owner = "raysan5";
repo = "raylib";
rev = "b8cd10264b6d34ff4b09ccdd0b0f7b254cf3b122";
sha256 = "sha256-VRNQZ0Pp1uczhLSF4Hz2QWiEini2jFtEGJDZMcLE+0w=";
};
postFixup = ''
cp ../src/*.h $out/include/
'';
}))
glfw
cabal-install
xorg.libXinerama
xorg.libXcursor
xorg.libXrandr
xorg.libXi
xorg.libXext
raylib
];
};
}
);
packages = forAllSystems (system: let
pkgs = pkgsForSystem system;
in {
default = import ./default.nix (pkgs // pkgs.xorg // pkgs.haskellPackages);
});
};
}

0 comments on commit 77486e3

Please sign in to comment.