build non-gui by default

This commit is contained in:
2025-11-30 04:33:58 -08:00
parent f34e88c490
commit 96242154f7
4 changed files with 141 additions and 54 deletions

49
default-gui.nix Normal file
View File

@@ -0,0 +1,49 @@
{
lib,
stdenv,
cmake,
libGL,
SDL2,
xorg.libX11
installShellFiles,
...
}:
let
cmakeContent = builtins.readFile ./CMakeLists.txt;
cmakeLines = lib.splitString "\n" cmakeContent;
versionLine = lib.findFirst (l: builtins.match ".*set\\(KE_VERSION \".+\"\\).*" l
version = builtins.head (builtins.match ".*set\\(KE_VERSION \"(.+)\"\\).*" versio
in
pkgs.stdenv.mkDerivation {
pname = "kte";
inherit version;
src = ./.;
nativeBuildInputs = [ pkgs.cmake pkgs.pkg-config ];
buildInputs = with pkgs; [
ncurses
SDL2
libGL
xorg.libX11
];
cmakeFlags = [
"-DBUILD_GUI=ON"
"-DCURSES_NEED_NCURSES=TRUE"
"-DCURSES_NEED_WIDE=TRUE"
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp kte $out/bin/
cp kge $out/bin/
installManPage ../docs/kte.1
installManPage ../docs/kte.1
runHook postInstall
'';
}