summary refs log tree commit diff
path: root/pkgs/applications/terminal-emulators/foot/default.nix
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-08-27 15:36:04 +0200
committersterni <sternenseemann@systemli.org>2021-09-05 14:28:54 +0200
commitca6cb24b966832c851c01754e069edfe7bccaa77 (patch)
treefa9207f7ec734232c3b32be2fdea97671f943544 /pkgs/applications/terminal-emulators/foot/default.nix
parent51c4e675e293a172ad8d3a84ef99497067841601 (diff)
downloadnixpkgs-ca6cb24b966832c851c01754e069edfe7bccaa77.tar
nixpkgs-ca6cb24b966832c851c01754e069edfe7bccaa77.tar.gz
nixpkgs-ca6cb24b966832c851c01754e069edfe7bccaa77.tar.bz2
nixpkgs-ca6cb24b966832c851c01754e069edfe7bccaa77.tar.lz
nixpkgs-ca6cb24b966832c851c01754e069edfe7bccaa77.tar.xz
nixpkgs-ca6cb24b966832c851c01754e069edfe7bccaa77.tar.zst
nixpkgs-ca6cb24b966832c851c01754e069edfe7bccaa77.zip
foot: 1.8.2 -> 1.9.0
https://codeberg.org/dnkl/foot/releases/tag/1.9.0

Main change requiring intervention from our side is the new alternative
terminfo install location used by foot in order to coexist with ncurses'
install location.

We want to keep using the normal terminfo install location:

* ncurses and foot have separate store paths so there won't be an
  actual conflict

* buildEnv etc. can deal with file conflicts when building the
  system path

Since foot now sets the TERMINFO environment variable to its terminfo
directory, we can stop installing foot's terminfo globally always (via
propagated-user-env-package) instead `foot.terminfo` now only needs to
be installed on remote systems were you want to have the proper terminfo
for foot.

We'll need to see if this works reliably in the future. NixOS sets
TERMINFO_DIRS, so there may be packages that have been patched to
respect that, but not TERMINFO.
Diffstat (limited to 'pkgs/applications/terminal-emulators/foot/default.nix')
-rw-r--r--pkgs/applications/terminal-emulators/foot/default.nix51
1 files changed, 34 insertions, 17 deletions
diff --git a/pkgs/applications/terminal-emulators/foot/default.nix b/pkgs/applications/terminal-emulators/foot/default.nix
index 8e7bbed9097..ec75454514c 100644
--- a/pkgs/applications/terminal-emulators/foot/default.nix
+++ b/pkgs/applications/terminal-emulators/foot/default.nix
@@ -2,7 +2,6 @@
 , lib
 , fetchFromGitea
 , fetchurl
-, fetchpatch
 , runCommand
 , fcft
 , freetype
@@ -28,7 +27,7 @@
 }:
 
 let
-  version = "1.8.2";
+  version = "1.9.0";
 
   # build stimuli file for PGO build and the script to generate it
   # independently of the foot's build, so we can cache the result
@@ -89,6 +88,8 @@ let
   # using a compiler which foot's PGO build supports (clang or gcc)
   doPgo = allowPgo && (stdenv.hostPlatform == stdenv.buildPlatform)
     && compilerName != "unknown";
+
+  terminfoDir = "${placeholder "terminfo"}/share/terminfo";
 in
 stdenv.mkDerivation rec {
   pname = "foot";
@@ -99,18 +100,9 @@ stdenv.mkDerivation rec {
     owner = "dnkl";
     repo = pname;
     rev = version;
-    sha256 = "1k0alz991cslls4926c5gq02pdq0vfw9jfpprh2a1vb59xgikv7h";
+    sha256 = "0mkzq5lbgl5qp5nj8sk5gyg9hrrklmbjdqzlcr2a6rlmilkxlhwm";
   };
 
-  patches = [
-    # Fixes PGO builds with clang
-    (fetchpatch {
-      url = "https://codeberg.org/dnkl/foot/commit/2acd4b34c57659d86dca76c58e4363de9b0a1f17.patch";
-      sha256 = "13xi9ppaqx2p88cxbh6801ry9ral70ylh40agn6ij7pklybs4d7s";
-      includes = [ "pgo/pgo.c" ];
-    })
-  ];
-
   depsBuildBuild = [
     pkg-config
   ];
@@ -154,7 +146,15 @@ stdenv.mkDerivation rec {
 
   mesonFlags = [
     "-Db_lto=true"
-    "-Dterminfo-install-location=${placeholder "terminfo"}/share/terminfo"
+    # Prevent foot from installing its terminfo file into a custom location,
+    # we need to do this manually in postInstall.
+    # See https://codeberg.org/dnkl/foot/pulls/673,
+    # https://codeberg.org/dnkl/foot/src/tag/1.9.0/INSTALL.md#options
+    "-Dterminfo=disabled"
+    # Ensure TERM=foot is used
+    "-Ddefault-terminfo=foot"
+    # Tell foot what to set TERMINFO to
+    "-Dcustom-terminfo-install-location=${terminfoDir}"
   ];
 
   # build and run binary generating PGO profiles,
@@ -174,11 +174,11 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "terminfo" ];
 
-  # make sure nix-env and buildEnv also include the
-  # terminfo output when the package is installed
   postInstall = ''
-    mkdir -p "$out/nix-support"
-    echo "$terminfo" >> "$out/nix-support/propagated-user-env-packages"
+    # build and install foot's terminfo to the standard location
+    # instead of its custom location
+    mkdir -p "${terminfoDir}"
+    tic -o "${terminfoDir}" -x -e foot,foot-direct "$NIX_BUILD_TOP/$sourceRoot/foot.info"
   '';
 
   passthru.tests = {
@@ -189,6 +189,10 @@ stdenv.mkDerivation rec {
     clang-latest-compilation = foot.override {
       inherit (llvmPackages_latest) stdenv;
     };
+
+    noPgo = foot.override {
+      allowPgo = false;
+    };
   };
 
   meta = with lib; {
@@ -198,5 +202,18 @@ stdenv.mkDerivation rec {
     license = licenses.mit;
     maintainers = [ maintainers.sternenseemann ];
     platforms = platforms.linux;
+    # From (presumably) ncurses version 6.3, it will ship a foot
+    # terminfo file. This however won't include some non-standard
+    # capabilities foot's bundled terminfo file contains. Unless we
+    # want to have some features in e. g. vim or tmux stop working,
+    # we need to make sure that the foot terminfo overwrites ncurses'
+    # one. Due to <nixpkgs/nixos/modules/config/system-path.nix>
+    # ncurses is always added to environment.systemPackages on
+    # NixOS with its priority increased by 3, so we need to go
+    # one bigger.
+    # This doesn't matter a lot for local use since foot sets
+    # TERMINFO to a store path, but allows installing foot.terminfo
+    # on remote systems for proper foot terminfo support.
+    priority = (ncurses.meta.priority or 5) + 3 + 1;
   };
 }