This is very useful if you want to distribute channels (and thus expressions as well) in a similar fashion to Debians APT sources (or PPAs or whatnot). So, for example if you have a channel with some additional functions or packages, you simply add that channel with: sudo nix-channel --add https://example.com/my-nifty-channel foo And you can access that channel using <foo>, for example in your configuration.nix: { imports = [ <foo/modules/shiny-little-module> ]; environment.systemPackages = with import <foo/pkgs> {}; [ bar blah ]; services.udev.extraRules = import <foo/lib/udev/mkrule.nix> { kernel = "eth*"; attr.address = "00:1D:60:B9:6D:4F"; name = "my_fast_network_card"; }; } Within nixpkgs, we shouldn't have <nixos> used anywhere anymore, so we shouldn't get into conflicts. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
80 lines
2.3 KiB
Nix
80 lines
2.3 KiB
Nix
# This module defines a standard configuration for NixOS global environment.
|
|
|
|
# Most of the stuff here should probably be moved elsewhere sometime.
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.environment;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
config = {
|
|
|
|
environment.variables =
|
|
{ LOCATE_PATH = "/var/cache/locatedb";
|
|
NIXPKGS_CONFIG = "/etc/nix/nixpkgs-config.nix";
|
|
PAGER = mkDefault "less -R";
|
|
EDITOR = mkDefault "nano";
|
|
};
|
|
|
|
environment.sessionVariables =
|
|
{ NIX_PATH =
|
|
[ "/nix/var/nix/profiles/per-user/root/channels"
|
|
"/nix/var/nix/profiles/per-user/root/channels/nixos"
|
|
"nixpkgs=/etc/nixos/nixpkgs"
|
|
"nixos-config=/etc/nixos/configuration.nix"
|
|
];
|
|
};
|
|
|
|
environment.profiles =
|
|
[ "$HOME/.nix-profile"
|
|
"/nix/var/nix/profiles/default"
|
|
"/run/current-system/sw"
|
|
];
|
|
|
|
# TODO: move most of these elsewhere
|
|
environment.profileRelativeEnvVars =
|
|
{ PATH = [ "/bin" "/sbin" "/lib/kde4/libexec" ];
|
|
INFOPATH = [ "/info" "/share/info" ];
|
|
PKG_CONFIG_PATH = [ "/lib/pkgconfig" ];
|
|
TERMINFO_DIRS = [ "/share/terminfo" ];
|
|
PERL5LIB = [ "/lib/perl5/site_perl" ];
|
|
KDEDIRS = [ "" ];
|
|
STRIGI_PLUGIN_PATH = [ "/lib/strigi/" ];
|
|
QT_PLUGIN_PATH = [ "/lib/qt4/plugins" "/lib/kde4/plugins" "/lib/qt5/plugins" ];
|
|
QML_IMPORT_PATH = [ "/lib/qt5/imports" ];
|
|
QML2_IMPORT_PATH = [ "/lib/qt5/qml" ];
|
|
QTWEBKIT_PLUGIN_PATH = [ "/lib/mozilla/plugins/" ];
|
|
GTK_PATH = [ "/lib/gtk-2.0" "/lib/gtk-3.0" ];
|
|
XDG_CONFIG_DIRS = [ "/etc/xdg" ];
|
|
XDG_DATA_DIRS = [ "/share" ];
|
|
MOZ_PLUGIN_PATH = [ "/lib/mozilla/plugins" ];
|
|
LIBEXEC_PATH = [ "/lib/libexec" ];
|
|
};
|
|
|
|
environment.extraInit =
|
|
''
|
|
# reset TERM with new TERMINFO available (if any)
|
|
export TERM=$TERM
|
|
|
|
unset ASPELL_CONF
|
|
for i in ${concatStringsSep " " (reverseList cfg.profiles)} ; do
|
|
if [ -d "$i/lib/aspell" ]; then
|
|
export ASPELL_CONF="dict-dir $i/lib/aspell"
|
|
fi
|
|
done
|
|
|
|
export NIX_USER_PROFILE_DIR="/nix/var/nix/profiles/per-user/$USER"
|
|
export NIX_PROFILES="${concatStringsSep " " (reverseList cfg.profiles)}"
|
|
'';
|
|
|
|
};
|
|
|
|
}
|