init
This commit is contained in:
26
flake.lock
generated
Normal file
26
flake.lock
generated
Normal file
@@ -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
|
||||
}
|
||||
13
flake.nix
Normal file
13
flake.nix
Normal file
@@ -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 {};
|
||||
};
|
||||
};
|
||||
}
|
||||
65
package.nix
Normal file
65
package.nix
Normal file
@@ -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"];
|
||||
};
|
||||
}
|
||||
6
src/Game/Main.hs
Normal file
6
src/Game/Main.hs
Normal file
@@ -0,0 +1,6 @@
|
||||
module Game (main) where
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
putStrLn "Hallo Welt"
|
||||
return ()
|
||||
Reference in New Issue
Block a user