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 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 KDEDIRS = [ "" ];
37 STRIGI_PLUGIN_PATH = [ "/lib/strigi/" ];
38 QT_PLUGIN_PATH = [ "/lib/qt4/plugins" "/lib/kde4/plugins" ];
39 QTWEBKIT_PLUGIN_PATH = [ "/lib/mozilla/plugins/" ];
40 GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" ];
41 XDG_CONFIG_DIRS = [ "/etc/xdg" ];
42 XDG_DATA_DIRS = [ "/share" ];
43 MOZ_PLUGIN_PATH = [ "/lib/mozilla/plugins" ];
44 LIBEXEC_PATH = [ "/lib/libexec" ];
45 };
46
47 environment.extraInit =
48 ''
49 unset ASPELL_CONF
50 for i in ${concatStringsSep " " (reverseList cfg.profiles)} ; do
51 if [ -d "$i/lib/aspell" ]; then
52 export ASPELL_CONF="dict-dir $i/lib/aspell"
53 fi
54 done
55
56 export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"
57 export NIX_PROFILES="${concatStringsSep " " (reverseList cfg.profiles)}"
58 '';
59
60 };
61
62}