From 083f743c1f1f2fc4db4833fe4e65f6be980eb946 Mon Sep 17 00:00:00 2001 From: Colin Date: Thu, 29 Feb 2024 15:18:51 +0000 Subject: [PATCH] remove nixpkgs `less` defaults and manage PAGER myself this lets me avoid the lesspipe cross failures, notably --- hosts/common/polyunfill.nix | 8 +++++++- hosts/common/programs/assorted.nix | 1 + hosts/common/programs/default.nix | 1 + hosts/common/programs/less.nix | 6 ++++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 hosts/common/programs/less.nix diff --git a/hosts/common/polyunfill.nix b/hosts/common/polyunfill.nix index 23cb5e23..4c001b82 100644 --- a/hosts/common/polyunfill.nix +++ b/hosts/common/polyunfill.nix @@ -13,7 +13,7 @@ "/run/current-system/sw" ]; - # NIXPKGS_CONFIG defaults to "/etc/nix/nixpkgs-config.nix", for idfk why. + # NIXPKGS_CONFIG defaults to "/etc/nix/nixpkgs-config.nix" in . # that's never existed on my system and everything does fine without it set empty (no nixpkgs API to forcibly *unset* it). environment.variables.NIXPKGS_CONFIG = lib.mkForce ""; # XDG_CONFIG_DIRS defaults to "/etc/xdg", which doesn't exist. @@ -42,4 +42,10 @@ # so as to inform when trying to run a non-nixos binary? # IMO that's confusing: i thought /lib/ld-linux.so was some file actually required by nix. environment.stub-ld.enable = false; + + # `less.enable` sets LESSKEYIN_SYSTEM, LESSOPEN, LESSCLOSE env vars, which does confusing "lesspipe" things, so disable that. + # it's enabled by default from ``, who also sets `PAGER="less"` and `EDITOR="nano"` (keep). + programs.less.enable = lib.mkForce false; + environment.variables.PAGER = lib.mkOverride 900 ""; # mkDefault sets 1000. non-override is 100. 900 will beat the nixpkgs `mkDefault` but not anyone else. + environment.variables.EDITOR = lib.mkOverride 900 ""; } diff --git a/hosts/common/programs/assorted.nix b/hosts/common/programs/assorted.nix index 0342f2e9..a57b44d9 100644 --- a/hosts/common/programs/assorted.nix +++ b/hosts/common/programs/assorted.nix @@ -62,6 +62,7 @@ in # "iw" "jq" "killall" + "less" # "libcap_ng" # for `netcap` "lsof" # "miniupnpc" diff --git a/hosts/common/programs/default.nix b/hosts/common/programs/default.nix index c67adbf6..1d3bbbce 100644 --- a/hosts/common/programs/default.nix +++ b/hosts/common/programs/default.nix @@ -53,6 +53,7 @@ ./kdenlive.nix ./komikku.nix ./koreader + ./less.nix ./libreoffice.nix ./lemoa.nix ./loupe.nix diff --git a/hosts/common/programs/less.nix b/hosts/common/programs/less.nix new file mode 100644 index 00000000..c3e26dd2 --- /dev/null +++ b/hosts/common/programs/less.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + sane.programs.less = { + env.PAGER = "less"; + }; +}