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 Vision
------- -------
kte will be a small, fast, and understandable text editor with a 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 original ke editor while preserving its familiar WordStar/VDEstyle
command model and Emacsinfluenced ergonomics. The focus is on command model and Emacsinfluenced ergonomics. The focus is on
simplicity of design, excellent latency, and pragmatic features you simplicity of design, excellent latency, and pragmatic features you

View File

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