2 nixpkgs = import .config/nixpkgs-channel/nixos-19.09-small.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, ...}: {
15 auto-optimise-store = true
23 gnupgHome = toString ../sec/gnupg;
24 keys = import shell/openpgp.nix;
28 opensslHome = toString ../sec/openssl;
29 certificates = import shell/x509.nix;
32 # WARNING: nixops uses its own ssh, not this one.
35 Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr
39 ControlPath ${builtins.toString ../sec/ssh}/ssh-%h-%p-%r.socket
41 #SSAPIAuthentication no
43 StrictHostKeyChecking yes
44 UserKnownHostsFile ${builtins.toString ../sec/ssh/known_hosts}
49 # Using modules enables to separate specific configurations
50 # from reusable code in shell/modules.nix and shell/modules/
51 # which may find its way in another git repository one day.
53 (import shell/modules.nix {
55 modules = [ configuration ];
58 pkgs.stdenv.mkDerivation {
59 name = "sourcephile-nix";
61 #preferLocalBuild = true;
62 #allowSubstitutes = false;
63 buildInputs = modules.nix-shell.buildInputs ++ [
65 nixos.nixos-generate-config
97 #pkgs.rxvt_unicode.terminfo
116 #enableParallelBuilding = true;
118 echo >&2 "nix: running shellHook"
120 # Cleanup "../sec/tmp/"
121 # This is done when exiting the nix-shell
122 # (or when… entering the directory with direnv
123 # which spawns a nix-shell just to get the env).
124 trap "cd '$PWD' && find ../sec/tmp -type f -exec shred -fu {} +" EXIT
126 ${modules.nix-shell.shellHook}
129 export NIX_PATH="nixpkgs=${nixpkgs}"
130 NIX_PATH+=":nixpkgs-overlays="$PWD"/overlays"
134 PATH_NIX="$(dirname "$(PATH="${builtins.getEnv "PATH"}"; which nix)")"
135 PATH_NIXOS=/run/wrappers/bin
136 PATH_FHS="$PWD"/.config/nix/fhs-bin
137 PATH_FHS_VBOX="$PWD"/.config/fhs-vbox-bin
138 export PATH="$PATH_NIXOS:$PATH_FHS_VBOX:$PATH_FHS:$PATH:$PATH_NIX"
140 # NOTE: sudo needs to be own by root with the setuid bit,
141 # but this won't be the case for the sudo provided by Nix outside NixOS,
142 # hence the addition of $PATH_FHS in shellHook
143 # to provide the host system's sudo.
144 # WARNING: beware that sudo may reset the environment,
145 # and especially PATH, to some system's default.
148 export LANG=fr_FR.UTF-8
149 export LC_CTYPE=fr_FR.UTF-8
152 export PASSWORD_STORE_DIR="$PWD"/../sec/pass
156 test ! -f "$gitdir" || while IFS=" :" read -r hdr gitdir; do [ "$hdr" != gitdir ] || break; done <"$gitdir"
158 "$PWD"/.lib/git/hooks/prepare-commit-msg--longuest-common-prefix \
159 "$gitdir"/hooks/prepare-commit-msg
162 #export NIXOPS_DEPLOYMENT="staging"
163 export NIXOPS_STATE="$PWD"/../sec/nixops/state.nixops
164 NIXOPS_OPTS+=" --show-trace"
168 #export DISNIXOS_USE_NIXOPS=1
169 #export DISNIX_CLIENT_INTERFACE=disnix-nixops-client
170 #export DISNIX_PROFILE=default
171 #export DISNIX_TARGET_PROPERTY=hostname
172 #export DYSNOMIA_STATEDIR="$PWD"/../sec/dysnomia