This commit is contained in:
Khaïs COLIN 2025-08-24 20:16:05 +02:00
commit 431a611616
Signed by: logistic-bot
SSH key fingerprint: SHA256:3zI3/tx0ZpCLHCLPmEaGR4oeYCPMCzQxXhXutBmtOAU
3 changed files with 160 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result

78
flake.lock generated Normal file
View file

@ -0,0 +1,78 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"freeorion-src": {
"flake": false,
"locked": {
"lastModified": 1755374471,
"narHash": "sha256-T+6hTlu/dZnXICe5XMaQnKOXQxw5YTrrLUbyzCKA3mk=",
"owner": "freeorion",
"repo": "freeorion",
"rev": "e1080068ffff83bd53c27058801aed72cff0f3a1",
"type": "github"
},
"original": {
"owner": "freeorion",
"repo": "freeorion",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1735563628,
"narHash": "sha256-OnSAY7XDSx7CtDoqNh8jwVwh4xNL/2HaJxGjryLWzX8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b134951a4c9f3c995fd7be05f3243f8ecd65d798",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"freeorion-src": "freeorion-src",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

81
flake.nix Normal file
View file

@ -0,0 +1,81 @@
{
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;
});
}