]> Git — Sourcephile - sourcephile-nix.git/blob - shell.nix
postfix: fix LDAP SASL
[sourcephile-nix.git] / shell.nix
1 let
2 nixpkgs = import .lib/nix/nixpkgs.nix;
3 pkgs = import nixpkgs {
4 config = {}; # Make the config pure, ignoring user's config.
5 overlays = import .lib/nixpkgs-commonsoft/build/overlays.nix;
6 };
7 commonsoft-nix-build-modules =
8 (import .lib/nixpkgs-commonsoft/build/modules.nix {
9 inherit pkgs;
10 inherit (pkgs) lib;
11 modules = [ ( import build/modules.nix ) ];
12 }).config;
13 /*
14 commonsoft-nix-build =
15 pkgs.stdenv.mkDerivation {
16 name = "commonsoft-nix-build";
17 preferLocalBuild = true;
18 allowSubstitutes = false;
19 inherit (pkgs) coreutils;
20 builder = pkgs.writeText "builder.sh" commonsoft-nix-build-modules.init.builder;
21 };
22 */
23 commonsoft-nix-build =
24 pkgs.buildEnv {
25 name = "commonsoft-nix-build";
26 pathsToLink = [ "/bin" ];
27 paths = with commonsoft-nix-build-modules; [
28 gnupg.init
29 #gnupg.gpg-fingerprint
30 #nix-plugins.nix-with-extra-builtins
31 ];
32 };
33 in
34 pkgs.stdenv.mkDerivation {
35 name = "commonsoft-nix";
36 src = null;
37 #preferLocalBuild = true;
38 #allowSubstitutes = false;
39 buildInputs = [
40 commonsoft-nix-build
41 nixpkgs
42 #pkgs.binutils
43 pkgs.coreutils
44 pkgs.cryptsetup
45 pkgs.curl
46 pkgs.direnv
47 #pkgs.dnsutils
48 pkgs.git
49 (pkgs.glibcLocales.override {
50 allLocales = false;
51 locales = [
52 "en_US.UTF-8/UTF-8"
53 "fr_FR.UTF-8/UTF-8"
54 ];
55 })
56 pkgs.gnumake
57 pkgs.gnupg
58 pkgs.htop
59 #pkgs.inetutils
60 pkgs.less
61 pkgs.libfaketime
62 #pkgs.mailutils
63 pkgs.man
64 pkgs.ncdu
65 pkgs.ncurses
66 pkgs.nixops
67 #pkgs.openssl
68 pkgs.pass
69 pkgs.procps
70 #pkgs.rxvt_unicode.terminfo
71 #pkgs.sqlite
72 pkgs.sqlite
73 pkgs.sudo
74 pkgs.tig
75 pkgs.time
76 #pkgs.tmux
77 pkgs.tree
78 pkgs.utillinux
79 pkgs.vim
80 #pkgs.virtualbox
81 pkgs.which
82 pkgs.xdg_utils
83 ];
84 #enableParallelBuilding = true;
85 shellHook = ''
86 # nix
87 export NIX_PATH="nixpkgs=${nixpkgs}:nixpkgs-commonsoft=$PWD/lib/nixpkgs-commonsoft"
88 #NIX_PATH+=":nixpkgs-overlays="$PWD"/install/overlays.nix"
89 #NIX_PATH+=""
90
91 # executables
92 PATH_NIX=$(dirname $(readlink -e ~/.nix-profile/bin/nix))
93 PATH_NIXOS=/run/wrappers/bin
94 PATH_FHS="$PWD"/.lib/nix/fhs-bin
95 PATH_FHS_VBOX="$PWD"/.lib/fhs-vbox-bin
96 export PATH="$PATH_NIXOS:$PATH_FHS_VBOX:$PATH_FHS:$PATH:$PATH_NIX"
97 ln -sfn ${commonsoft-nix-build}/bin "$PWD"/.bin
98
99 # NOTE: sudo needs to be own by root with the setuid bit,
100 # but this won't be the case for the sudo provided by Nix outside NixOS,
101 # hence the addition of $PATH_FHS in shellHook
102 # to provide the host system's sudo.
103 # WARNING: beware that sudo may reset the environment,
104 # and especially PATH, to some system's default.
105
106 # locales
107 export LANG=fr_FR.UTF-8
108 export LC_CTYPE=fr_FR.UTF-8
109
110 # gpg
111 gpgconf --launch gpg-agent
112 export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
113 export GPG_TTY=$(tty)
114 export GNUPGHOME="$PWD"/../sec/gnupg
115 install -dm700 "$GNUPGHOME"
116
117 # password-store
118 export PASSWORD_STORE_DIR="$PWD"/../sec/pass
119
120 # git
121 ln -fnsr \
122 "$PWD"/.lib/git/hooks/prepare-commit-msg--longuest-common-prefix \
123 "$PWD"/.git/hooks/prepare-commit-msg
124
125 # nixops
126 export NIXOPS_DEPLOYMENT="virtualbox"
127 export NIXOPS_STATE="$PWD"/.var/nixops/state.nixops
128 # Extend the Nix interpreter
129 # to enable builtins.extraBuiltins,
130 # which provides an unsafe exec useful to get secrets
131 # from the local password-store.
132 NIXOPS_OPTS+=" --show-trace"
133 NIXOPS_OPTS+=" --option plugin-files ${pkgs.nix-plugins}/lib/nix/plugins/libnix-extra-builtins.so"
134 NIXOPS_OPTS+=" --option extra-builtins-file ${commonsoft-nix-build-modules.nix-plugins.extra-builtins}"
135 export NIXOPS_OPTS
136
137 # disnix
138 #export DISNIXOS_USE_NIXOPS=1
139 #export DISNIX_CLIENT_INTERFACE=disnix-nixops-client
140 #export DISNIX_PROFILE=default
141 #export DISNIX_TARGET_PROPERTY=hostname
142 #export DYSNOMIA_STATEDIR=var/dysnomia
143 '';
144 }