diff options
| author | mtgmonkey <mtgmonkey@nixos> | 2025-12-09 22:18:41 +0100 |
|---|---|---|
| committer | mtgmonkey <mtgmonkey@nixos> | 2025-12-09 22:18:41 +0100 |
| commit | 5e2d2b89c855cc0713d6f64788eaca530f21fc81 (patch) | |
| tree | f35ada16efe8db988e13de3af3f8f1bc5ea4c2bf /flake.nix | |
init
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..5783646 --- /dev/null +++ b/flake.nix @@ -0,0 +1,91 @@ +{ + inputs = { + nixpkgs.url = "nixpkgs/nixpkgs-unstable"; + }; + outputs = {nixpkgs, ...}: let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + debugGhcOptions = pkgs.lib.concatStringsSep " " (debugGhcFlags ++ commonGhcFlags); + debugGhcFlags = + [ + "-O0" + "-Wall" + "-Widentities" + "-Wincomplete-record-updates" + "-Wincomplete-uni-patterns" + # "-Wmissing-export-lists" + "-Wmissing-home-modules" + "-Wpartial-fields" + "-Wredundant-constraints" + ] + ++ commonGhcFlags; + haddockOptions = pkgs.lib.concatStringsSep " " haddockFlags; + haddockFlags = [ + "--html" + "--odir docs" + "--optghc=-i./src" + "src/Game.hs" + ]; + releaseGhcOptions = pkgs.lib.concatStringsSep " " (releaseGhcFlags ++ commonGhcFlags); + releaseGhcFlags = + [ + "-O2" + "-threaded" + "-rtsopts" + "-with-rtsopts=-N" + "-main-is Main" + ] + ++ commonGhcFlags; + noHaddockOptions = ""; + commonGhcFlags = [ + "-i./src" + "-threaded" + "-rtsopts" + "-with-rtsopts=-N" + "-main-is Main" + ]; + ghcPackages = p: [ + ]; + buildDeps = [ + pkgs.pkg-config + pkgs.wayland-protocols + pkgs.wayland-scanner + + pkgs.egl-wayland + pkgs.libGL + pkgs.libxkbcommon + pkgs.wayland + pkgs.xorg.libX11 + pkgs.xorg.libXcursor + pkgs.xorg.libXi + pkgs.xorg.libXrandr + ]; + in { + packages.${system} = { + debug = pkgs.callPackage ./package.nix { + ghcOptions = debugGhcOptions; + haddockOptions = noHaddockOptions; + inherit ghcPackages; + inherit buildDeps; + }; + release = pkgs.callPackage ./package.nix { + ghcOptions = releaseGhcOptions; + haddockOptions = noHaddockOptions; + inherit ghcPackages; + inherit buildDeps; + }; + docs = pkgs.callPackage ./package.nix { + ghcOptions = "--version"; + inherit haddockOptions; + inherit ghcPackages; + inherit buildDeps; + }; + default = pkgs.callPackage ./package.nix { + ghcOptions = releaseGhcOptions; + inherit haddockOptions; + inherit ghcPackages; + inherit buildDeps; + }; + }; + }; +} |
