blob: c55ee007f8c76d6fc5cdb48af1af5999bb0047fa [file] [log] [blame]
Serge Bazanskic97461e2021-02-17 20:29:48 +01001# Shell for being able to use bazel on NixOS (or on any operating system with Nix installed).
2
3let
4
5 hscloud = import ./default.nix {};
6
Bartosz Stebel56ff18c2021-08-30 23:28:45 +02007in with hscloud.pkgs; let
Serge Bazanskic97461e2021-02-17 20:29:48 +01008
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +02009 fontconfig = pkgs.writeText "fc-00-nixos-cache.conf" ''
10 <?xml version="1.0" encoding="UTF-8"?>
11 <!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
12 <fontconfig>
13 <include>/etc/fonts/fonts.conf</include>
14 <dir>${pkgs.roboto}</dir>
15 </fontconfig>
16 '';
17
Serge Bazanskic97461e2021-02-17 20:29:48 +010018 wrapper = pkgs.writeScript "wrapper.sh"
19 ''
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020020 export NIX_SSL_CERT_FILE="${cacert}/etc/ssl/certs/ca-bundle.crt"
21 export SSL_CERT_FILE="${cacert}/etc/ssl/certs/ca-bundle.crt"
22 export FONTCONFIG_FILE="${fontconfig}"
23
Serge Bazanskic97461e2021-02-17 20:29:48 +010024 source ${toString ./.}/env.sh
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020025
26 # FIXME: //tools:install runs in a different PATH which thrashes our cache
27 # and causes massive rebuilds on every launch... This next line is the only
28 # important part off tools/install.sh
29 # bazel run //tools:install
30 bazel build //tools/... //cluster/tools/...
Serge Bazanskic97461e2021-02-17 20:29:48 +010031
Serge Bazanski69ff6032021-09-11 01:14:13 +020032 # Fancy colorful PS1 to make people notice easily they're in hscloud.
33 PS1='\[\033]0;\u/hscloud:\w\007\]'
34 if type -P dircolors >/dev/null ; then
35 PS1+='\[\033[01;35m\]\u/hscloud\[\033[01;34m\] \w \$\[\033[00m\] '
36 fi
37 export PS1
38
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020039 exec bash --noprofile --norc "$@"
Serge Bazanskic97461e2021-02-17 20:29:48 +010040 '';
41
42in (pkgs.buildFHSUserEnv {
43 name = "hscloud-build";
44 targetPkgs = pkgs: with pkgs; [
45 bazel
46 postgresql
47 python38
48 openjdk11
49 openldap.dev cyrus_sasl.dev # for python-ldap
50 wkhtmltopdf
Serge Bazanskidce10ba2021-03-11 23:16:10 +000051 gcc binutils
Serge Bazanski43b0e092021-06-06 12:50:54 +000052 pwgen
53 tmate
Mateusz Lenik51f6c102021-07-18 16:33:03 +020054 git
Piotr Dobrowolskicb9cbb32021-09-14 18:37:10 +020055 which
Piotr Dobrowolski0c59cb32021-09-14 19:57:03 +020056 gnupg
Piotr Dobrowolskicb9cbb32021-09-14 18:37:10 +020057 nettools
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020058 file
59 curl
60 netcat
61 nix
Serge Bazanskic97461e2021-02-17 20:29:48 +010062 ];
63 multiPkgs = pkgs: [
64 (pkgs.runCommand "protocols" {}
65 ''
66 mkdir -p $out/etc
67 ln -s ${pkgs.iana-etc}/etc/protocols $out/etc/protocols
68 '')
69 ];
70 runScript = wrapper;
71}).env