at 23.11-beta 1.7 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 }; 26 27 # since we set PAGER to this above, make sure it's installed 28 programs.less.enable = true; 29 30 environment.profiles = mkAfter 31 [ "/nix/var/nix/profiles/default" 32 "/run/current-system/sw" 33 ]; 34 35 environment.sessionVariables = 36 { 37 XDG_CONFIG_DIRS = [ "/etc/xdg" ]; # needs to be before profile-relative paths to allow changes through environment.etc 38 }; 39 40 # TODO: move most of these elsewhere 41 environment.profileRelativeSessionVariables = 42 { PATH = [ "/bin" ]; 43 INFOPATH = [ "/info" "/share/info" ]; 44 QTWEBKIT_PLUGIN_PATH = [ "/lib/mozilla/plugins/" ]; 45 GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" "/lib/gtk-4.0" ]; 46 XDG_CONFIG_DIRS = [ "/etc/xdg" ]; 47 XDG_DATA_DIRS = [ "/share" ]; 48 LIBEXEC_PATH = [ "/lib/libexec" ]; 49 }; 50 51 environment.pathsToLink = [ "/lib/gtk-2.0" "/lib/gtk-3.0" "/lib/gtk-4.0" ]; 52 53 environment.extraInit = 54 '' 55 export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER" 56 export NIX_PROFILES="${concatStringsSep " " (reverseList cfg.profiles)}" 57 ''; 58 59 }; 60 61}