2 nixpkgs = import .lib/nix/nixpkgs.nix;
3 pkgs = import nixpkgs {
4 config = {}; # Make the config pure, ignoring user's config.
5 overlays = import ./overlays.nix;
9 # Configuration of shell/modules/
10 configuration = {config, ...}: {
18 gnupgHome = toString ../sec/gnupg;
19 keys = import shell/gnupg/keys.nix;
28 # Using modules enables to separate specific configurations
29 # from reusable code in shell/modules.nix and shell/modules/
30 # which may find its way in another git repository one day.
32 (import shell/modules.nix {
35 modules = [ configuration ];
38 pkgs.stdenv.mkDerivation {
39 name = "sourcephile-nix";
41 #preferLocalBuild = true;
42 #allowSubstitutes = false;
43 buildInputs = modules.nix-shell.buildInputs ++ [
45 nixos.nixos-generate-config
74 #pkgs.rxvt_unicode.terminfo
92 #enableParallelBuilding = true;
94 echo >&2 "nix: running shellHook"
96 ${modules.nix-shell.shellHook}
99 export NIX_PATH="nixpkgs=${nixpkgs}"
100 NIX_PATH+=":nixpkgs-overlays="$PWD"/overlays"
104 PATH_NIX=$(dirname $(readlink -e ~/.nix-profile/bin/nix))
105 PATH_NIXOS=/run/wrappers/bin
106 PATH_FHS="$PWD"/.lib/nix/fhs-bin
107 PATH_FHS_VBOX="$PWD"/.lib/fhs-vbox-bin
108 export PATH="$PATH_NIXOS:$PATH_FHS_VBOX:$PATH_FHS:$PATH:$PATH_NIX"
110 # NOTE: sudo needs to be own by root with the setuid bit,
111 # but this won't be the case for the sudo provided by Nix outside NixOS,
112 # hence the addition of $PATH_FHS in shellHook
113 # to provide the host system's sudo.
114 # WARNING: beware that sudo may reset the environment,
115 # and especially PATH, to some system's default.
118 export LANG=fr_FR.UTF-8
119 export LC_CTYPE=fr_FR.UTF-8
122 export PASSWORD_STORE_DIR="$PWD"/../sec/pass
126 test ! -f "$gitdir" || while IFS=" :" read -r hdr gitdir; do [ "$hdr" != gitdir ] || break; done <"$gitdir"
128 "$PWD"/.lib/git/hooks/prepare-commit-msg--longuest-common-prefix \
129 "$gitdir"/hooks/prepare-commit-msg
132 #export NIXOPS_DEPLOYMENT="staging"
133 export NIXOPS_STATE="$PWD"/.sec/nixops/state.nixops
134 # Extend the Nix interpreter
135 # to enable builtins.extraBuiltins,
136 # which provides an unsafe exec useful to get secrets
137 # from the local password-store.
138 NIXOPS_OPTS+=" --show-trace"
139 NIXOPS_OPTS+=" --option plugin-files ${pkgs.nix-plugins}/lib/nix/plugins/libnix-extra-builtins.so"
140 NIXOPS_OPTS+=" --option extra-builtins-file ${modules.nix-plugins.extra-builtins}"
144 #export DISNIXOS_USE_NIXOPS=1
145 #export DISNIX_CLIENT_INTERFACE=disnix-nixops-client
146 #export DISNIX_PROFILE=default
147 #export DISNIX_TARGET_PROPERTY=hostname
148 #export DYSNOMIA_STATEDIR="$PWD"/.sec/dysnomia