33 rustPlatform ,
44 pkg-config ,
55 udev ,
6+ zstd ,
67 vulkan-loader ,
78 libGL ,
89 wayland ,
1314 libxcursor ? xorg . libXcursor ,
1415 libxi ? xorg . libXi ,
1516 libxrandr ? xorg . libXrandr ,
17+ # Off: only the command line, `lightforge`, without the launcher.
18+ withGui ? true ,
1619} :
1720
1821let
3134 ] ;
3235in
3336rustPlatform . buildRustPackage {
34- pname = "lightforge" ;
37+ pname = if withGui then "lightforge" else "lightforge-cli ";
3538 inherit ( cargoToml . workspace. package ) version ;
3639
3740 src = lib . fileset. toSource {
@@ -52,16 +55,22 @@ rustPlatform.buildRustPackage {
5255
5356 cargoLock. lockFile = ../../Cargo.lock ;
5457
58+ cargoBuildFlags = lib . optionals ( ! withGui ) [ "-p" "lightforge-cli" ] ;
59+ cargoTestFlags = lib . optionals ( ! withGui ) [ "-p" "lightforge-core" "-p" "lightforge-cli" ] ;
60+
5561 nativeBuildInputs = [ pkg-config ] ;
56- buildInputs = [ udev ] ;
62+ # zstd: Nix's Rust builds set ZSTD_SYS_USE_PKG_CONFIG, so zstd-sys links
63+ # the system library instead of building its bundled copy. udev: for
64+ # gamepads in the launcher.
65+ buildInputs = [ zstd ] ++ lib . optionals withGui [ udev ] ;
5766
58- postInstall = ''
67+ postInstall = lib . optionalString withGui ''
5968 install -Dm644 packaging/pro.tuxcore.Lightforge.desktop -t $out/share/applications
6069 install -Dm644 packaging/pro.tuxcore.Lightforge.metainfo.xml -t $out/share/metainfo
6170 cp -r packaging/icons $out/share/icons
6271 '' ;
6372
64- postFixup = ''
73+ postFixup = lib . optionalString withGui ''
6574 patchelf --add-rpath ${ lib . makeLibraryPath runtimeLibs } $out/bin/lightforge-gui
6675 '' ;
6776
@@ -71,7 +80,7 @@ rustPlatform.buildRustPackage {
7180 description = "Install, update and play World of Warcraft on Linux, and a home for all your other Battle.net games" ;
7281 homepage = cargoToml . workspace. package. homepage ;
7382 license = lib . licenses. gpl3Plus ;
74- mainProgram = "lightforge-gui" ;
83+ mainProgram = if withGui then "lightforge-gui" else "lightforge ";
7584 platforms = [ "x86_64-linux" ] ;
7685 } ;
7786}
0 commit comments