{
	description = "Legacy Minecraft Launcher";
	
	inputs = {
		nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
		flake-utils.url = "github:numtide/flake-utils";
	};
	
	outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system:
		let
			pkgs = import nixpkgs { inherit system; };
		in
		{
			packages.default = pkgs.stdenvNoCC.mkDerivation {
				pname = "legacy-launcher";
				version = "latest";
				
				src = pkgs.fetchurl {
					url = "https://ely.by/load/launcher/jar";
					sha256 = "sha256-n4J+/I8hsU4EA6eqyUUIScJhvLpkUdmr7u5jiLhQhX4=";
				};
				
				nativeBuildInputs = [ pkgs.makeWrapper ];
				
				dontUnpack = true;
				
				installPhase = ''
				mkdir -p $out/bin
				mkdir -p $out/share/{applications,legacy-launcher}
				
				# Install JAR
				install -Dm644 $src \
				  $out/share/legacy-launcher/LegacyLauncher_legacy.jar
				
				# Create launcher wrapper
				makeWrapper ${pkgs.jre}/bin/java \
				  $out/bin/legacy-launcher \
				  --add-flags "-jar $out/share/legacy-launcher/LegacyLauncher_legacy.jar"
				
				# Desktop entry
				install -Dm644 ${./legacy-launcher.desktop} \
				  $out/share/applications/legacy-launcher.desktop
				'';
				
				meta = with pkgs.lib; {
					description = "Stable, fast and simple Minecraft Launcher";
					homepage = "https://llaun.ch";
					license = licenses.gpl3Only;
					platforms = platforms.all;
				};
			};
		 }
	);
}
