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";
version = "0.1.0"; # change if you have a version src = ./.;
src = ./.; nativeBuildInputs = [ pkgs.cmake pkgs.pkg-config ];
buildInputs = with pkgs; [
ncurses
SDL2
libGL
xorg.libX11
];
nativeBuildInputs = [ pkgs.cmake ]; cmakeFlags = [
buildInputs = with pkgs; [ "-DBUILD_GUI=ON"
ncurses # provides libncursesw.so + headers via .dev output "-DCURSES_NEED_NCURSES=TRUE"
]; "-DCURSES_NEED_WIDE=TRUE"
];
# Crucial: tell CMake to use wide ncurses and prefer pkg-config # Alternative (even stronger): completely hide the broken module
cmakeFlags = [ preConfigure = ''
"-DCURSES_NEED_NCURSES=TRUE" # If the project ships its own FindSDL2.cmake in cmake/, hide it
"-DCURSES_NEED_WIDE=TRUE" if [ -f cmake/FindSDL2.cmake ]; then
"-DUSE_PKGCONFIG=ON" mv cmake/FindSDL2.cmake cmake/FindSDL2.cmake.disabled
]; echo "Disabled bundled FindSDL2.cmake"
fi
# 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"
''; '';
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 mainProgram = "kte";
platforms = platforms.linux; platforms = platforms.linux;
mainProgram = "kte";
};
}; };
};
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
};
});
}