forked from NotAShelf/beer
nix: load terminfo in the devshell and complete the package build
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I9d341443399d553c197f56bf66a578426a6a6964
This commit is contained in:
parent
7254cbf381
commit
8486c343d7
3 changed files with 51 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,3 +1,4 @@
|
||||||
/target
|
/target
|
||||||
/result
|
/result
|
||||||
/result-*
|
/result-*
|
||||||
|
/.terminfo
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,17 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
rustPlatform,
|
rustPlatform,
|
||||||
|
pkg-config,
|
||||||
|
makeBinaryWrapper,
|
||||||
|
ncurses,
|
||||||
|
wayland,
|
||||||
|
libxkbcommon,
|
||||||
|
freetype,
|
||||||
|
fontconfig,
|
||||||
}:
|
}:
|
||||||
rustPlatform.buildRustPackage (finalAttrs: {
|
rustPlatform.buildRustPackage (finalAttrs: {
|
||||||
pname = "beer";
|
pname = "beer";
|
||||||
version = "0.0.0";
|
version = "0.0.1";
|
||||||
|
|
||||||
src = let
|
src = let
|
||||||
fs = lib.fileset;
|
fs = lib.fileset;
|
||||||
|
|
@ -16,14 +23,42 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||||
(fs.fileFilter (file: builtins.any file.hasExt ["rs"]) (s + /src))
|
(fs.fileFilter (file: builtins.any file.hasExt ["rs"]) (s + /src))
|
||||||
(s + /Cargo.lock)
|
(s + /Cargo.lock)
|
||||||
(s + /Cargo.toml)
|
(s + /Cargo.toml)
|
||||||
|
(s + /terminfo)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
cargoLock.lockFile = "${finalAttrs.src}/Cargo.lock";
|
cargoLock.lockFile = "${finalAttrs.src}Cargo.lock";
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkg-config
|
||||||
|
makeBinaryWrapper
|
||||||
|
ncurses # tic
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
wayland
|
||||||
|
libxkbcommon
|
||||||
|
freetype
|
||||||
|
fontconfig
|
||||||
|
];
|
||||||
|
|
||||||
|
# Install the terminfo entry, and make the Wayland/xkb libraries (loaded via
|
||||||
|
# dlopen, so not captured by rpath) discoverable at runtime.
|
||||||
|
postInstall = ''
|
||||||
|
mkdir -p "$out/share/terminfo"
|
||||||
|
tic -x -o "$out/share/terminfo" terminfo/beer.info
|
||||||
|
wrapProgram "$out/bin/beer" \
|
||||||
|
--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [wayland libxkbcommon]}
|
||||||
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
description = "A fast, software-rendered, Wayland-native terminal emulator";
|
||||||
|
homepage = "https://github.com/NotAShelf/beer";
|
||||||
|
license = lib.licenses.eupl12;
|
||||||
maintainers = with lib.maintainers; [NotAShelf];
|
maintainers = with lib.maintainers; [NotAShelf];
|
||||||
mainProgram = "beer";
|
mainProgram = "beer";
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
taplo,
|
taplo,
|
||||||
cargo-deny,
|
cargo-deny,
|
||||||
pkg-config,
|
pkg-config,
|
||||||
|
ncurses,
|
||||||
wayland,
|
wayland,
|
||||||
wayland-protocols,
|
wayland-protocols,
|
||||||
wayland-scanner,
|
wayland-scanner,
|
||||||
|
|
@ -17,7 +18,7 @@
|
||||||
harfbuzz,
|
harfbuzz,
|
||||||
}:
|
}:
|
||||||
mkShell {
|
mkShell {
|
||||||
name = "rust";
|
name = "beer-dev";
|
||||||
|
|
||||||
strictDeps = true;
|
strictDeps = true;
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
|
@ -25,19 +26,11 @@ mkShell {
|
||||||
rustc
|
rustc
|
||||||
clippy
|
clippy
|
||||||
rustfmt
|
rustfmt
|
||||||
rustc
|
|
||||||
cargo
|
|
||||||
|
|
||||||
# Tools
|
|
||||||
rustfmt
|
|
||||||
clippy
|
|
||||||
cargo
|
|
||||||
taplo
|
taplo
|
||||||
|
|
||||||
# LSP
|
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
cargo-deny
|
cargo-deny
|
||||||
pkg-config
|
pkg-config
|
||||||
|
ncurses # tic, to compile the terminfo entry
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
|
@ -49,4 +42,14 @@ mkShell {
|
||||||
fontconfig
|
fontconfig
|
||||||
harfbuzz
|
harfbuzz
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Compile the beer terminfo into a project-local database and put it ahead of
|
||||||
|
# the system one, so TERM=beer resolves inside the shell (and for the shell
|
||||||
|
# beer spawns, which inherits this env). The trailing ':' keeps the system
|
||||||
|
# database on the search path.
|
||||||
|
shellHook = ''
|
||||||
|
if tic -x -o "$PWD/.terminfo" terminfo/beer.info 2>/dev/null; then
|
||||||
|
export TERMINFO_DIRS="$PWD/.terminfo:"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue