{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    flake-parts.url = "github:hercules-ci/flake-parts";
    fenix = {
      url = "github:nix-community/fenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };
    systems.url = "github:nix-systems/default";
  };

  outputs = inputs:
    inputs.flake-parts.lib.mkFlake {inherit inputs;} {
      systems = import inputs.systems;
      perSystem = {
        config,
        self',
        pkgs,
        lib,
        system,
        ...
      }: let
        fenix = inputs.fenix.packages.${system};
        libs = with pkgs; [
          (fenix.fromToolchainFile {
            file = ./rust-toolchain.toml;
            sha256 = "sha256-AJ6LX/Q/Er9kS15bn9iflkUwcgYqRQxiOIL2ToVAXaU=";
          })
          fenix.rust-analyzer
          wabt
          maven
          cmake
          ninja
          pkg-config
          protobuf

          #needed for minecraft to function properly
          libGL
          glfw-wayland-minecraft
          libpulseaudio
          openal
          flite
        ];
        mkDevshell = openIdea:
          pkgs.mkShell {
            nativeBuildInputs = with pkgs; [
              jetbrains.jdk
            ];

            buildInputs = libs;
            LD_LIBRARY_PATH = lib.makeLibraryPath libs;

            env = {
              JAVA_HOME = "${pkgs.jetbrains.jdk}/lib/openjdk/";
            };

            shellHook =
              if openIdea
              then ''
                idea-community ./
                exit
              ''
              else "";
          };
      in {
        formatter = pkgs.alejandra;
        devShells = {
          default = mkDevshell false;
          idea = mkDevshell true;
        };
      };
    };
}