at 17.09-beta 1.8 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, pkgs, ... }: 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 PAGER = mkDefault "less -R"; 22 EDITOR = mkDefault "nano"; 23 XCURSOR_PATH = [ "$HOME/.icons" ]; 24 }; 25 26 environment.profiles = 27 [ "$HOME/.nix-profile" 28 "/nix/var/nix/profiles/default" 29 "/run/current-system/sw" 30 ]; 31 32 # TODO: move most of these elsewhere 33 environment.profileRelativeEnvVars = 34 { PATH = [ "/bin" ]; 35 INFOPATH = [ "/info" "/share/info" ]; 36 PKG_CONFIG_PATH = [ "/lib/pkgconfig" ]; 37 PERL5LIB = [ "/lib/perl5/site_perl" ]; 38 KDEDIRS = [ "" ]; 39 STRIGI_PLUGIN_PATH = [ "/lib/strigi/" ]; 40 QT_PLUGIN_PATH = [ "/lib/qt4/plugins" "/lib/kde4/plugins" ]; 41 QTWEBKIT_PLUGIN_PATH = [ "/lib/mozilla/plugins/" ]; 42 GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" ]; 43 XDG_CONFIG_DIRS = [ "/etc/xdg" ]; 44 XDG_DATA_DIRS = [ "/share" ]; 45 XCURSOR_PATH = [ "/share/icons" ]; 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}