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 | |
init
| -rw-r--r-- | flake.lock | 26 | ||||
| -rw-r--r-- | flake.nix | 13 | ||||
| -rw-r--r-- | package.nix | 65 | ||||
| -rw-r--r-- | src/Game/Main.hs | 6 |
4 files changed, 110 insertions, 0 deletions
diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9386f3f --- /dev/null +++ b/flake.lock @@ -0,0 +1,26 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1764611609, + "narHash": "sha256-yU9BNcP0oadUKupw0UKmO9BKDOVIg9NStdJosEbXf8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8c29968b3a942f2903f90797f9623737c215737c", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixpkgs-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6e93c4c --- /dev/null +++ b/flake.nix @@ -0,0 +1,13 @@ +{ + inputs = { + nixpkgs.url = "nixpkgs/nixpkgs-unstable"; + }; + outputs = {nixpkgs, ...}: let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + in { + packages.${system} = { + default = pkgs.callPackage ./package.nix {}; + }; + }; +} 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"]; + }; + } diff --git a/src/Game/Main.hs b/src/Game/Main.hs new file mode 100644 index 0000000..839ea70 --- /dev/null +++ b/src/Game/Main.hs @@ -0,0 +1,6 @@ +module Game (main) where + +main :: IO () +main = do + putStrLn "Hallo Welt" + return () |
