1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-28 08:31:59 +00:00
nixpkgs/nixos/modules/programs/environment.nix
Matt McHenry a2a0a58f7c
less: improve default settings (#139988)
* less: enable by default and set LESS=-R via lesskey

* since we set PAGER=less, programs.less.enable should default to
  true.

* some programs, notably git, set a custom LESS environment if none is
  present.  using the lesskey mechanism to set LESS=-R lets such
  programs continue to run less as they see fit.

This reverts commit 0e7b4e60a8.

* less: remove use of deprecated lesskey binary format

* less: enable in environment.nix rather than less.nix

per discussion in #139988
2021-10-05 11:13:48 +02:00

66 lines
1.9 KiB
Nix

# This module defines a standard configuration for NixOS global environment.
# Most of the stuff here should probably be moved elsewhere sometime.
{ config, lib, ... }:
with lib;
let
cfg = config.environment;
in
{
config = {
environment.variables =
{ NIXPKGS_CONFIG = "/etc/nix/nixpkgs-config.nix";
# note: many programs exec() this directly, so default options for less must not
# be specified here; do so in the default value of programs.less.envVariables instead
PAGER = mkDefault "less";
EDITOR = mkDefault "nano";
XDG_CONFIG_DIRS = [ "/etc/xdg" ]; # needs to be before profile-relative paths to allow changes through environment.etc
};
# since we set PAGER to this above, make sure it's installed
programs.less.enable = true;
environment.profiles = mkAfter
[ "/nix/var/nix/profiles/default"
"/run/current-system/sw"
];
# TODO: move most of these elsewhere
environment.profileRelativeSessionVariables =
{ PATH = [ "/bin" ];
INFOPATH = [ "/info" "/share/info" ];
KDEDIRS = [ "" ];
QT_PLUGIN_PATH = [ "/lib/qt4/plugins" "/lib/kde4/plugins" ];
QTWEBKIT_PLUGIN_PATH = [ "/lib/mozilla/plugins/" ];
GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" ];
XDG_CONFIG_DIRS = [ "/etc/xdg" ];
XDG_DATA_DIRS = [ "/share" ];
MOZ_PLUGIN_PATH = [ "/lib/mozilla/plugins" ];
LIBEXEC_PATH = [ "/lib/libexec" ];
};
environment.extraInit =
''
unset ASPELL_CONF
for i in ${concatStringsSep " " (reverseList cfg.profiles)} ; do
if [ -d "$i/lib/aspell" ]; then
export ASPELL_CONF="dict-dir $i/lib/aspell"
fi
done
export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"
export NIX_PROFILES="${concatStringsSep " " (reverseList cfg.profiles)}"
'';
};
}