Update NixOS build.

This commit is contained in:
2025-11-30 01:17:39 -08:00
parent c2785de96b
commit 91bc986e51
3 changed files with 46 additions and 53 deletions

View File

@@ -3,7 +3,7 @@ kte — Kyle's Text Editor
Vision
-------
kte will be a small, fast, and understandable text editor with a
terminalfirst UX and an optional ImGui GUI. It modernizes the
terminal<EFBFBD>first UX and an optional ImGui GUI. It modernizes the
original ke editor while preserving its familiar WordStar/VDEstyle
command model and Emacsinfluenced ergonomics. The focus is on
simplicity of design, excellent latency, and pragmatic features you

View File

@@ -2,24 +2,23 @@
let
pkgs = import <nixpkgs> {};
in
pkgs.stdenv.mkDerivation rec {
pkgs.stdenv.mkDerivation {
pname = "kte";
version = "0.1.0";
src = ./.;
nativeBuildInputs = [ pkgs.cmake ];
buildInputs = [ pkgs.ncurses ];
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"
];
meta = with pkgs.lib; {
description = "A small terminal text editor";
license = licenses.mit;
platforms = platforms.linux;
mainProgram = "kte";
};
}

View File

@@ -1,6 +1,6 @@
# flake.nix
{
description = "kte a small terminal text editor";
description = "kte ImGui/SDL2 text editor";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@@ -11,51 +11,45 @@
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages.default = pkgs.stdenv.mkDerivation {
pname = "kte";
version = "0.1.0"; # change if you have a version
in {
packages.default = pkgs.stdenv.mkDerivation {
pname = "kte";
version = "0.1.0";
src = ./.;
src = ./.;
nativeBuildInputs = [ pkgs.cmake pkgs.pkg-config ];
buildInputs = with pkgs; [
ncurses
SDL2
libGL
xorg.libX11
];
nativeBuildInputs = [ pkgs.cmake ];
buildInputs = with pkgs; [
ncurses # provides libncursesw.so + headers via .dev output
];
cmakeFlags = [
"-DBUILD_GUI=ON"
"-DCURSES_NEED_NCURSES=TRUE"
"-DCURSES_NEED_WIDE=TRUE"
];
# Crucial: tell CMake to use wide ncurses and prefer pkg-config
cmakeFlags = [
"-DCURSES_NEED_NCURSES=TRUE"
"-DCURSES_NEED_WIDE=TRUE"
"-DUSE_PKGCONFIG=ON"
];
# Optional: make it obvious in the build log
preConfigure = ''
echo "Using ncurses from ${pkgs.ncurses}"
echo "lib dir: ${pkgs.ncurses}/lib"
echo "include dir: ${pkgs.ncurses.dev}/include"
# Alternative (even stronger): completely hide the broken module
preConfigure = ''
# If the project ships its own FindSDL2.cmake in cmake/, hide it
if [ -f cmake/FindSDL2.cmake ]; then
mv cmake/FindSDL2.cmake cmake/FindSDL2.cmake.disabled
echo "Disabled bundled FindSDL2.cmake"
fi
'';
meta = with pkgs.lib; {
description = "A small terminal text editor";
license = licenses.mit; # change if needed
platforms = platforms.linux;
mainProgram = "kte";
};
meta = with pkgs.lib; {
description = "kte ImGui/SDL2 GUI editor";
mainProgram = "kte";
platforms = platforms.linux;
};
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
cmake
gdb
clang-tools # for clangd, clang-format, etc.
ncurses
];
# Makes ncurses visible to every tool (including manual cmake runs)
hardeningDisable = [ "all" ]; # optional, only if you hit fortify issues
};
});
}
devShells.default = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.default ];
packages = with pkgs; [ gdb clang-tools ];
};
});
}