2013-09-18 03:18:34 +00: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 20:56:59 +00:00
|
|
|
{ config, lib, ... }:
|
2013-09-18 03:18:34 +00: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 09:13:48 +00: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
|
2024-04-17 11:37:58 +00:00
|
|
|
PAGER = lib.mkDefault "less";
|
|
|
|
EDITOR = lib.mkDefault "nano";
|
2014-06-10 11:07:10 +00:00
|
|
|
};
|
|
|
|
|
2021-10-05 09:13:48 +00:00
|
|
|
# since we set PAGER to this above, make sure it's installed
|
|
|
|
programs.less.enable = true;
|
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
environment.profiles = lib.mkAfter
|
2019-08-10 08:28:12 +00:00
|
|
|
[ "/nix/var/nix/profiles/default"
|
2013-09-18 03:18:34 +00:00
|
|
|
"/run/current-system/sw"
|
|
|
|
];
|
|
|
|
|
2023-06-26 08:12:03 +00:00
|
|
|
environment.sessionVariables =
|
|
|
|
{
|
|
|
|
XDG_CONFIG_DIRS = [ "/etc/xdg" ]; # needs to be before profile-relative paths to allow changes through environment.etc
|
|
|
|
};
|
|
|
|
|
2014-08-29 20:38:12 +00:00
|
|
|
# TODO: move most of these elsewhere
|
2019-08-19 14:05:10 +00:00
|
|
|
environment.profileRelativeSessionVariables =
|
2017-05-06 07:34:19 +00:00
|
|
|
{ PATH = [ "/bin" ];
|
2014-08-29 20:38:12 +00:00
|
|
|
INFOPATH = [ "/info" "/share/info" ];
|
|
|
|
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 20:38:12 +00:00
|
|
|
XDG_CONFIG_DIRS = [ "/etc/xdg" ];
|
|
|
|
XDG_DATA_DIRS = [ "/share" ];
|
2023-11-26 07:55:37 +00:00
|
|
|
LIBEXEC_PATH = [ "/libexec" ];
|
2014-08-29 20:38:12 +00:00
|
|
|
};
|
2013-09-18 03:18:34 +00: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 03:18:34 +00:00
|
|
|
environment.extraInit =
|
|
|
|
''
|
|
|
|
export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"
|
2024-04-17 11:37:58 +00:00
|
|
|
export NIX_PROFILES="${builtins.concatStringsSep " " (lib.reverseList cfg.profiles)}"
|
2013-09-18 03:18:34 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|