diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..99a2bf7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,24 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1696193975, + "narHash": "sha256-mnQjUcYgp9Guu3RNVAB2Srr1TqKcPpRXmJf4LJk6KRY=", + "path": "/nix/store/5rb11cz8xmv8cdk7b0w80pzczbzk0p26-source", + "rev": "fdd898f8f79e8d2f99ed2ab6b3751811ef683242", + "type": "path" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..305eb08 --- /dev/null +++ b/flake.nix @@ -0,0 +1,46 @@ +{ + inputs.nixpkgs.url = "nixpkgs"; + + outputs = { self, nixpkgs, ... }@inputs: + let + supportedSystems = [ "x86_64-linux" ]; + forAllSystems' = nixpkgs.lib.genAttrs; + forAllSystems = forAllSystems' supportedSystems; + + pkgsForSystem = + system: + import nixpkgs { inherit system; overlays = [ ]; }; + in + { + devShells = forAllSystems (system: + let + pkgs = pkgsForSystem system; + in + { + default = + pkgs.mkShell rec { + LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs; + buildInputs = with pkgs; [ + 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 + ]; + }; + } + ); + }; +}