monotonicity

A city-building and transport simulation game written in Lean

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
{
  description = "An OpenTTD-like game written in Lean";

  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

  outputs =
    { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = nixpkgs.legacyPackages.${system};
    in
    {
      packages.${system}.default = pkgs.leanPackages.buildLakePackage {
        pname = "leanttd";
        src = self;
        version = "0.1";
        lakeHash = "sha256-z/yuuwpGutWWC1++ZJ189If4TGgJunpwNCh9NGasnRo=";
        buildInputs = [ pkgs.raylib ];
        # This fixes a linker error
        hardeningDisable = [ "bindnow" ];
        postConfigure = ''
          # Make sure the linker can find libraylib.so
          substituteInPlace lakefile.toml --replace-fail \
            '["-lraylib"]' \
            '["-L${pkgs.raylib}/lib", "-lraylib"]'
          # Patch Raylean to fix a compilation error
          cd .lake/packages/raylean
          patch -p1 < ../../../raylean.patch
          cd -
        '';
      };
      apps.${system}.default = {
        type = "app";
        program = "${self.packages.${system}.default}/bin/leanttd";
      };
      formatter.${system} = pkgs.nixfmt-tree;
    };
}