2   nixpkgs_channel = builtins.getEnv "nixpkgs_channel";
 
   3   originNixpkgs = import (.config/nixpkgs-channel + ("/" + nixpkgs_channel + ".nix"));
 
   4   originPkgs = import originNixpkgs {
 
   5     config   = {}; # Make the config pure, ignoring user's config.
 
  10     { meta.description = "nsd : use types.lines where appropriate";
 
  11       url = "https://github.com/NixOS/nixpkgs/pull/78968.diff";
 
  12       sha256 = "11bqq1g1ax6i7xghihyhklmqpsq3njalardp6nvzphkjgxrypb47";
 
  14     { meta.description = "shorewall: init at 5.2.3.3";
 
  15       url = "https://github.com/NixOS/nixpkgs/pull/46131.diff";
 
  16       sha256 = "0mfzlcr23ni5spnwksmmls50sw10alqbr5j6hjrwp9i30z0419yx";
 
  19     { meta.description = "Dovecot plugin for Full Text Search (FTS) with Xapian";
 
  20       url = "https://github.com/NixOS/nixpkgs/pull/78780.diff";
 
  21       sha256 = "053md69ryybj27cp0xdfrza48zyzpblk6wvb2m2dbs9hm0gmcwc4";
 
  23     /* Disabled because it triggers the local build of too many reverse-dependencies
 
  24     { meta.description = "openldap: enable sha2 and pbkdf2 modules";
 
  25       url = "https://github.com/NixOS/nixpkgs/pull/79286.diff";
 
  26       sha256 = "0y255x74qksqy7fm4bdwlknhm3s55vgfgbv4dd7580p4lcavya0m";
 
  30     { meta.description = "Replace simp-le with lego and support DNS-01 challenge";
 
  31       url = "https://github.com/NixOS/nixpkgs/pull/77578.diff";
 
  32       sha256 = "15zs2146zh54jg1gywrcwyqxpx7izc35vlakk3cvrlqwwsvlr2rf";
 
  35     { meta.description = "dstat: fix pluginpath";
 
  36       url = "https://github.com/NixOS/nixpkgs/pull/80151.diff";
 
  37       sha256 = "0jjw2gvp7b7v2n2m2d6yj0gw711j6p9lyjf5ywp2y9ql6905qf4b";
 
  39     { meta.description = "shorewall: fix warnings due to types.loaOf being deprecated";
 
  40       url = "https://github.com/NixOS/nixpkgs/pull/80154.diff";
 
  41       sha256 = "0b216m1rib3jl6s3r5cbkd5h1bfhppikg4cz9ayr1fspsflr3bci";
 
  44   localNixpkgsPatches = [
 
  46   nixpkgs = originPkgs.stdenv.mkDerivation {
 
  47     name = "nixpkgs-patched";
 
  49     phases = [ "unpackPhase" "patchPhase" ];
 
  50     patches = map originPkgs.fetchpatch nixpkgsPatches ++ localNixpkgsPatches;
 
  52       patch=$(printf '%s\n' ${builtins.concatStringsSep " " (map (p: p.sha256) nixpkgsPatches)} |
 
  53         sort | sha256sum | cut -c -7)
 
  55       echo "+patch-$patch" >$out/.version-suffix
 
  58   pkgs = import nixpkgs {
 
  59     config = {}; # Make the config pure, ignoring user's config.
 
  60     overlays = import ./overlays.nix;
 
  65   nixos = pkgs.nixos {};
 
  66   # Configuration of shell/modules/
 
  67   configuration = {config, ...}: {
 
  72         auto-optimise-store = true
 
  80       gnupgHome = toString ../sec/gnupg;
 
  81       keys = import shell/openpgp.nix;
 
  83         trusted-key 0xB2450D97085B7B8C
 
  88       opensslHome = toString ../sec/openssl;
 
  89       certificates = import shell/x509.nix;
 
  92       # WARNING: nixops uses its own ssh, not this one.
 
  95         Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr
 
  99         ControlPath ${builtins.toString ../sec/ssh}/ssh-%h-%p-%r.socket
 
 101         #SSAPIAuthentication no
 
 103         StrictHostKeyChecking yes
 
 104         UserKnownHostsFile ${builtins.toString ../sec/ssh/known_hosts}
 
 112   # Using modules enables to separate specific configurations
 
 113   # from reusable code in shell/modules.nix and shell/modules/
 
 114   # which may find its way in another git repository one day.
 
 116     (import shell/modules.nix {
 
 118       modules = [ configuration ];
 
 122   name = "sourcephile-nix";
 
 124   #preferLocalBuild = true;
 
 125   #allowSubstitutes = false;
 
 126   buildInputs = modules.nix-shell.buildInputs ++ [
 
 127     nixos.nixos-generate-config
 
 161     #pkgs.rxvt_unicode.terminfo
 
 180   #enableParallelBuilding = true;
 
 182     echo >&2 "nix: running shellHook"
 
 183     # WARNING: beware that sudo may reset the environment,
 
 184     # and especially PATH, to some system's default.
 
 187     unset __ETC_PROFILE_SOURCED
 
 188     unset __NIXOS_SET_ENVIRONMENT_DONE
 
 189     test ! -e /etc/profile || . /etc/profile
 
 190     test ! -e ~/.profile || . ~/.profile
 
 193     test ! -e ~/.nix-profile/etc/profile.d/nix.sh ||
 
 194     . ~/.nix-profile/etc/profile.d/nix.sh
 
 197     unset __HM_SESS_VARS_SOURCED
 
 198     test ! -e ~/.nix-profile/etc/profile.d/hm-session-vars.sh ||
 
 199     . ~/.nix-profile/etc/profile.d/hm-session-vars.sh
 
 201     PATH=$NIX_SHELL_PATH:$PATH
 
 202     export NIX_PATH="nixpkgs=${toString pkgs.path}:nixpkgs-overlays="$PWD"/overlays"
 
 203     export nixpkgs_channel=${nixpkgs_channel}
 
 205     # Cleanup "../sec/tmp/"
 
 206     # This is done when entering the nix-shell
 
 207     # because direnv already hooks trap EXIT.
 
 208     (cd "$PWD" && find ../sec/tmp -type f -exec shred -fu {} +)
 
 210     ${modules.nix-shell.shellHook}
 
 213     export LANG=fr_FR.UTF-8
 
 214     export LC_CTYPE=fr_FR.UTF-8
 
 217     export PASSWORD_STORE_DIR="$PWD"/../sec/pass
 
 220     export GPG_TTY=$(tty)
 
 221     gpg-connect-agent updatestartuptty /bye >/dev/null
 
 225     test ! -f "$gitdir" || while IFS=" :" read -r hdr gitdir; do [ "$hdr" != gitdir ] || break; done <"$gitdir"
 
 227      "$PWD"/.lib/git/hooks/prepare-commit-msg--longuest-common-prefix \
 
 228      "$gitdir"/hooks/prepare-commit-msg
 
 231     #export NIXOPS_DEPLOYMENT="staging"
 
 232     export NIXOPS_STATE="$PWD"/../sec/nixops/state.nixops
 
 233     NIXOPS_OPTS+=" --show-trace"
 
 237     #export DISNIXOS_USE_NIXOPS=1
 
 238     #export DISNIX_CLIENT_INTERFACE=disnix-nixops-client
 
 239     #export DISNIX_PROFILE=default
 
 240     #export DISNIX_TARGET_PROPERTY=hostname
 
 241     #export DYSNOMIA_STATEDIR="$PWD"/../sec/dysnomia