diff options
| author | mtgmonkey <mtgmonkey@nixos> | 2025-12-04 16:31:03 +0100 |
|---|---|---|
| committer | mtgmonkey <mtgmonkey@nixos> | 2025-12-04 16:31:03 +0100 |
| commit | a72d3b02198412dd514dd81f703ff618c980eb52 (patch) | |
| tree | 370bed4f94dae8191a6acc47d1b80fab889ce9dd /package.nix | |
init
Diffstat (limited to 'package.nix')
| -rw-r--r-- | package.nix | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..f9513ce --- /dev/null +++ b/package.nix @@ -0,0 +1,65 @@ +{ + haskellPackages, + lib, + stdenv, + ... +}: let + ghcExeOptions = lib.concatStringsSep " " ghcFlags; + ghcFlags = [ + "-O" + "-Wall" + "-Widentities" + "-Wincomplete-record-updates" + "-Wincomplete-uni-patterns" + # "-Wmissing-export-lists" + "-Wmissing-home-modules" + "-Wpartial-fields" + "-Wredundant-constraints" + "-threaded" + "-rtsopts" + "-with-rtsopts=-N" + # src + "-i./src" + "-main-is Game" + ]; + haddockOptions = lib.concatStringsSep " " haddockFlags; + haddockFlags = [ + "--html" + "--odir docs" + "--optghc=-i./src" + "src/Game/Main.hs" + ]; + ghcPackages = p: [ + p.GLFW-b + p.linear + p.OpenGL + ]; +in + stdenv.mkDerivation { + pname = "haskengl"; + version = "0.1.0"; + src = ./.; + nativeBuildInputs = [ + (haskellPackages.ghcWithPackages ghcPackages) + ]; + buildInputs = [ + ]; + configurePhase = '' + ''; + buildPhase = '' + ghc ${ghcExeOptions} ./src/Game/Main.hs -o ./Main + haddock ${haddockOptions} + ''; + installPhase = '' + mkdir -p $out/bin + cp ./Main $out/bin/hs-game + cp ./docs $out/docs -r + ''; + + meta = { + homepage = "https://mtgmonkey.net"; + license = lib.licenses.wtfpl; + mainProgram = "hs-game"; + platforms = ["x86_64-linux"]; + }; + } |
