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