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