]> Git — Sourcephile - sourcephile-nix.git/blob - shell.nix
ssh: StrictHostKeyChecking=yes
[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 ./overlays.nix;
6 };
7 nixos = pkgs.nixos {};
8
9 # Configuration of shell/modules/
10 configuration = {config, ...}: {
11 imports = [
12 ];
13 nix = {
14 nixConf = ''
15 auto-optimise-store = true
16 '';
17 };
18 nix-plugins = {
19 enable = true;
20 };
21 gnupg = {
22 enable = true;
23 gnupgHome = toString ../sec/gnupg;
24 keys = import shell/gnupg/keys.nix;
25 };
26 openssh = {
27 enable = true;
28 sshConf = ''
29 HashKnownHosts no
30 StrictHostKeyChecking yes
31 UserKnownHostsFile ${builtins.toString .ssh/known_hosts}
32 '';
33 };
34 };
35
36 # Using modules enables to separate specific configurations
37 # from reusable code in shell/modules.nix and shell/modules/
38 # which may find its way in another git repository one day.
39 modules =
40 (import shell/modules.nix {
41 inherit pkgs;
42 inherit (pkgs) lib;
43 modules = [ configuration ];
44 }).config;
45 in
46 pkgs.stdenv.mkDerivation {
47 name = "sourcephile-nix";
48 src = null;
49 #preferLocalBuild = true;
50 #allowSubstitutes = false;
51 buildInputs = modules.nix-shell.buildInputs ++ [
52 nixpkgs
53 nixos.nixos-generate-config
54 nixos.nixos-install
55 nixos.nixos-enter
56 #pkgs.binutils
57 pkgs.coreutils
58 pkgs.cryptsetup
59 pkgs.curl
60 #pkgs.direnv
61 #pkgs.dnsutils
62 #pkgs.dropbear
63 pkgs.e2fsprogs
64 pkgs.git
65 pkgs.glibcLocales
66 pkgs.gnumake
67 pkgs.gnupg
68 pkgs.htop
69 #pkgs.inetutils
70 pkgs.less
71 pkgs.libfaketime
72 #pkgs.mailutils
73 pkgs.man
74 pkgs.mdadm
75 pkgs.gptfdisk
76 pkgs.ncdu
77 pkgs.ncurses
78 pkgs.nixops
79 #pkgs.openssl
80 pkgs.pass
81 pkgs.procps
82 #pkgs.rxvt_unicode.terminfo
83 #pkgs.sqlite
84 pkgs.sqlite
85 pkgs.sudo
86 pkgs.tig
87 pkgs.time
88 #pkgs.tmux
89 pkgs.tree
90 pkgs.utillinux
91 pkgs.vim
92 #pkgs.virtualbox
93 pkgs.which
94 pkgs.xdg_utils
95 pkgs.zfs
96 pkgs.fio
97 pkgs.strace
98 #pkgs.zfstools
99 ];
100 #enableParallelBuilding = true;
101 shellHook = ''
102 echo >&2 "nix: running shellHook"
103
104 ${modules.nix-shell.shellHook}
105
106 # nix
107 export NIX_PATH="nixpkgs=${nixpkgs}"
108 NIX_PATH+=":nixpkgs-overlays="$PWD"/overlays"
109 #NIX_PATH+=""
110
111 # executables
112 PATH_NIX=$(dirname $(readlink -e ~/.nix-profile/bin/nix))
113 PATH_NIXOS=/run/wrappers/bin
114 PATH_FHS="$PWD"/.lib/nix/fhs-bin
115 PATH_FHS_VBOX="$PWD"/.lib/fhs-vbox-bin
116 export PATH="$PATH_NIXOS:$PATH_FHS_VBOX:$PATH_FHS:$PATH:$PATH_NIX"
117
118 # NOTE: sudo needs to be own by root with the setuid bit,
119 # but this won't be the case for the sudo provided by Nix outside NixOS,
120 # hence the addition of $PATH_FHS in shellHook
121 # to provide the host system's sudo.
122 # WARNING: beware that sudo may reset the environment,
123 # and especially PATH, to some system's default.
124
125 # locales
126 export LANG=fr_FR.UTF-8
127 export LC_CTYPE=fr_FR.UTF-8
128
129 # password-store
130 export PASSWORD_STORE_DIR="$PWD"/../sec/pass
131
132 # git
133 gitdir="$PWD"/.git
134 test ! -f "$gitdir" || while IFS=" :" read -r hdr gitdir; do [ "$hdr" != gitdir ] || break; done <"$gitdir"
135 ln -fnsr \
136 "$PWD"/.lib/git/hooks/prepare-commit-msg--longuest-common-prefix \
137 "$gitdir"/hooks/prepare-commit-msg
138
139 # nixops
140 #export NIXOPS_DEPLOYMENT="staging"
141 export NIXOPS_STATE="$PWD"/.sec/nixops/state.nixops
142 NIXOPS_OPTS+=" --show-trace"
143 export NIXOPS_OPTS
144
145 # disnix
146 #export DISNIXOS_USE_NIXOPS=1
147 #export DISNIX_CLIENT_INTERFACE=disnix-nixops-client
148 #export DISNIX_PROFILE=default
149 #export DISNIX_TARGET_PROPERTY=hostname
150 #export DYSNOMIA_STATEDIR="$PWD"/.sec/dysnomia
151 '';
152 }