2013-09-18 04:18:34 +01:00
|
|
|
# This module defines a standard configuration for NixOS global environment.
|
|
|
|
|
|
|
|
# Most of the stuff here should probably be moved elsewhere sometime.
|
|
|
|
|
2018-07-20 21:56:59 +01:00
|
|
|
{ config, lib, ... }:
|
2013-09-18 04:18:34 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2013-09-18 04:18:34 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.environment;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
|
|
|
environment.variables =
|
2017-01-05 19:16:48 +00:00
|
|
|
{ NIXPKGS_CONFIG = "/etc/nix/nixpkgs-config.nix";
|
2021-10-05 10:13:48 +01:00
|
|
|
# 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
|
2021-07-01 21:03:03 +01:00
|
|
|
PAGER = mkDefault "less";
|
2014-02-17 21:37:39 +00:00
|
|
|
EDITOR = mkDefault "nano";
|
2019-08-24 15:01:01 +01:00
|
|
|
XDG_CONFIG_DIRS = [ "/etc/xdg" ]; # needs to be before profile-relative paths to allow changes through environment.etc
|
2014-06-10 12:07:10 +01:00
|
|
|
};
|
|
|
|
|
2021-10-05 10:13:48 +01:00
|
|
|
# since we set PAGER to this above, make sure it's installed
|
|
|
|
programs.less.enable = true;
|
|
|
|
|
2019-08-10 09:28:12 +01:00
|
|
|
environment.profiles = mkAfter
|
|
|
|
[ "/nix/var/nix/profiles/default"
|
2013-09-18 04:18:34 +01:00
|
|
|
"/run/current-system/sw"
|
|
|
|
];
|
|
|
|
|
2014-08-29 21:38:12 +01:00
|
|
|
# TODO: move most of these elsewhere
|
2019-08-19 15:05:10 +01:00
|
|
|
environment.profileRelativeSessionVariables =
|
2017-05-06 08:34:19 +01:00
|
|
|
{ PATH = [ "/bin" ];
|
2014-08-29 21:38:12 +01:00
|
|
|
INFOPATH = [ "/info" "/share/info" ];
|
|
|
|
KDEDIRS = [ "" ];
|
2015-10-17 15:39:40 +01:00
|
|
|
QT_PLUGIN_PATH = [ "/lib/qt4/plugins" "/lib/kde4/plugins" ];
|
2014-08-29 21:38:12 +01:00
|
|
|
QTWEBKIT_PLUGIN_PATH = [ "/lib/mozilla/plugins/" ];
|
2022-03-14 14:21:33 +00:00
|
|
|
GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" "/lib/gtk-4.0" ];
|
2014-08-29 21:38:12 +01:00
|
|
|
XDG_CONFIG_DIRS = [ "/etc/xdg" ];
|
|
|
|
XDG_DATA_DIRS = [ "/share" ];
|
|
|
|
MOZ_PLUGIN_PATH = [ "/lib/mozilla/plugins" ];
|
2015-01-19 17:05:33 +00:00
|
|
|
LIBEXEC_PATH = [ "/lib/libexec" ];
|
2014-08-29 21:38:12 +01:00
|
|
|
};
|
2013-09-18 04:18:34 +01:00
|
|
|
|
2022-03-14 14:21:33 +00:00
|
|
|
environment.pathsToLink = [ "/lib/gtk-2.0" "/lib/gtk-3.0" "/lib/gtk-4.0" ];
|
|
|
|
|
2013-09-18 04:18:34 +01:00
|
|
|
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)}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|