From e2b9b63743f6d13e4aed9aaa72d974a0d9a64d3a Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 15 Jan 2023 16:10:12 +0000 Subject: [PATCH] terminfos: init --- nix/pkgs/default.nix | 2 ++ nix/pkgs/terminfos/default.nix | 32 +++++++++++++++++++++++++++ ops/nixos/lib/home-manager/common.nix | 25 ++++++++++++++++++--- 3 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 nix/pkgs/terminfos/default.nix diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix index 8f2280e86e..541c79aa7c 100644 --- a/nix/pkgs/default.nix +++ b/nix/pkgs/default.nix @@ -82,4 +82,6 @@ fr24feed = pkgs.callPackage ./fr24feed { }; qrca = pkgs.libsForQt5.callPackage ./qrca { }; + + terminfos = pkgs.callPackage ./terminfos { }; } // (import ./heptapod-runner args) diff --git a/nix/pkgs/terminfos/default.nix b/nix/pkgs/terminfos/default.nix new file mode 100644 index 0000000000..934e7fda10 --- /dev/null +++ b/nix/pkgs/terminfos/default.nix @@ -0,0 +1,32 @@ +{ stdenvNoCC, kitty, ncurses, rxvt-unicode-unwrapped, alacritty, symlinkJoin }: + +let + kitty-terminfo = stdenvNoCC.mkDerivation { + pname = "kitty-terminfo"; + inherit (kitty) version src; + + dontBuild = true; + + nativeBuildInputs = [ + ncurses + ]; + + installPhase = '' + runHook preInstall + + install -d $out/share/terminfo + export TERMINFO=$out/share/terminfo + tic -x terminfo/kitty.terminfo + + runHook postInstall + ''; + }; +in + symlinkJoin { + name = "terminfos"; + paths = [ + kitty-terminfo + rxvt-unicode-unwrapped.terminfo + alacritty.terminfo + ]; + } diff --git a/ops/nixos/lib/home-manager/common.nix b/ops/nixos/lib/home-manager/common.nix index 550cfc015c..b5bf4f200c 100644 --- a/ops/nixos/lib/home-manager/common.nix +++ b/ops/nixos/lib/home-manager/common.nix @@ -1,6 +1,23 @@ { config, configName, depot, lib, pkgs, ... }: let inherit (pkgs.stdenv.hostPlatform) isDarwin isLinux; + + kitty-terminfo = pkgs.mkDerivation { + pname = "kitty-terminfo"; + inherit (pkgs.kitty) version src; + + dontBuild = true; + + installPhase = '' + runHook preInstall + + install -d $out/share/terminfo + export TERMINFO=$out/share/terminfo + tic terminfo/kitty.terminfo + + runHook postInstall + ''; + }; in { imports = [ ./ntfy.nix ]; @@ -26,7 +43,9 @@ in home.homeDirectory = if isDarwin then "/Users/lukegb" else "/home/lukegb"; home.file = { ".hgrc".source = ./hgrc; - }; + } // (lib.optionalAttrs isDarwin { + ".terminfo".source = depot.nix.pkgs.terminfos; + }); home.sessionVariables = { EDITOR = "vim"; VISUAL = "vim"; @@ -133,8 +152,8 @@ in #!/bin/sh exec "${home-manager}/bin/home-manager" -f "${config.home.homeDirectory}/depot/home-manager-ext.nix" -A "${configName}" "$@" '') - rxvt-unicode-unwrapped.terminfo tmux rsync libarchive tcpdump restic - alacritty.terminfo kitty.terminfo + tmux rsync libarchive tcpdump restic + depot.nix.pkgs.terminfos iftop htop jq depot.nix.pkgs.mercurial ] ++ lib.optionals isLinux [