at 22.05-pre 1.9 kB view raw
1# This module defines a standard configuration for NixOS global environment. 2 3# Most of the stuff here should probably be moved elsewhere sometime. 4 5{ config, lib, ... }: 6 7with lib; 8 9let 10 11 cfg = config.environment; 12 13in 14 15{ 16 17 config = { 18 19 environment.variables = 20 { NIXPKGS_CONFIG = "/etc/nix/nixpkgs-config.nix"; 21 # note: many programs exec() this directly, so default options for less must not 22 # be specified here; do so in the default value of programs.less.envVariables instead 23 PAGER = mkDefault "less"; 24 EDITOR = mkDefault "nano"; 25 XDG_CONFIG_DIRS = [ "/etc/xdg" ]; # needs to be before profile-relative paths to allow changes through environment.etc 26 }; 27 28 # since we set PAGER to this above, make sure it's installed 29 programs.less.enable = true; 30 31 environment.profiles = mkAfter 32 [ "/nix/var/nix/profiles/default" 33 "/run/current-system/sw" 34 ]; 35 36 # TODO: move most of these elsewhere 37 environment.profileRelativeSessionVariables = 38 { PATH = [ "/bin" ]; 39 INFOPATH = [ "/info" "/share/info" ]; 40 KDEDIRS = [ "" ]; 41 QT_PLUGIN_PATH = [ "/lib/qt4/plugins" "/lib/kde4/plugins" ]; 42 QTWEBKIT_PLUGIN_PATH = [ "/lib/mozilla/plugins/" ]; 43 GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" ]; 44 XDG_CONFIG_DIRS = [ "/etc/xdg" ]; 45 XDG_DATA_DIRS = [ "/share" ]; 46 MOZ_PLUGIN_PATH = [ "/lib/mozilla/plugins" ]; 47 LIBEXEC_PATH = [ "/lib/libexec" ]; 48 }; 49 50 environment.extraInit = 51 '' 52 unset ASPELL_CONF 53 for i in ${concatStringsSep " " (reverseList cfg.profiles)} ; do 54 if [ -d "$i/lib/aspell" ]; then 55 export ASPELL_CONF="dict-dir $i/lib/aspell" 56 fi 57 done 58 59 export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER" 60 export NIX_PROFILES="${concatStringsSep " " (reverseList cfg.profiles)}" 61 ''; 62 63 }; 64 65}