{ description = "Flake for building FreeOrion (master branch)"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; flake-utils.url = "github:numtide/flake-utils"; freeorion-src.url = "github:freeorion/freeorion"; freeorion-src.flake = false; # Optionally, pin to a commit: url = "github:freeorion/freeorion/COMMIT"; }; outputs = { self, nixpkgs, flake-utils, freeorion-src }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; buildInputs = with pkgs; [ cmake git python310 pkg-config boost python310Packages.boost zlib freetype libpng libvorbis libogg openal SDL2 glew ]; nativeBuildInputs = with pkgs; [ cmake git pkg-config makeWrapper ]; in { packages.freeorion = pkgs.stdenv.mkDerivation { pname = "freeorion"; version = "unstable"; # or use date/commit src = freeorion-src; # Use flake input as src buildInputs = buildInputs; nativeBuildInputs = nativeBuildInputs; cmakeFlags = [ "-DCMAKE_BUILD_TYPE=Release" "-DBUILD_TESTING=Off" "-DCMAKE_INSTALL_RPATH=$out/lib" "-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON" ]; doCheck = false; installPhase = '' # mkdir -p $out/bin # cp /build/source/build/freeorion $out/bin # cp /build/source/build/freeorionca $out/bin # cp /build/source/build/freeoriond $out/bin cmake --install . --prefix=$out wrapProgram $out/bin/freeorion --set LD_LIBRARY_PATH "$out/lib/freeorion:${pkgs.stdenv.cc.cc.lib}/lib" ''; # postFixup = '' # patchelf --set-rpath $out # ''; meta = with pkgs.lib; { description = "FreeOrion, a free, open source, turn-based space empire and galactic conquest game"; homepage = "https://www.freeorion.org/"; license = licenses.gpl2Plus; maintainers = with maintainers; [ ]; platforms = platforms.linux; }; }; defaultPackage = self.packages.${system}.freeorion; }); }