blob: 6be64bdf77aee02fd864f2161bd47fb671317476 [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
Serge Bazanski97b5cd72023-07-28 17:14:50 +000030 #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; [
Patryk Jakuszew28742b82022-11-26 21:33:38 +010045 bazel_5
Serge Bazanskic97461e2021-02-17 20:29:48 +010046 postgresql
Serge Bazanski97b5cd72023-07-28 17:14:50 +000047 python310
Serge Bazanskic97461e2021-02-17 20:29:48 +010048 openjdk11
49 openldap.dev cyrus_sasl.dev # for python-ldap
Serge Bazanski97b5cd72023-07-28 17:14:50 +000050 # No wkhtmltopdf as it got yoten from the hydra build set, and building it
51 # takes ages. Run locally in docker container instead.
52 #wkhtmltopdf
53 gcc binutils clang
54 libxcrypt-legacy
Serge Bazanski43b0e092021-06-06 12:50:54 +000055 pwgen
56 tmate
Mateusz Lenik51f6c102021-07-18 16:33:03 +020057 git
Piotr Dobrowolskicb9cbb32021-09-14 18:37:10 +020058 which
Piotr Dobrowolski0c59cb32021-09-14 19:57:03 +020059 gnupg
Piotr Dobrowolskicb9cbb32021-09-14 18:37:10 +020060 nettools
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020061 file
62 curl
63 netcat
64 nix
Serge Bazanski8e439ed2022-06-11 12:16:12 +000065 vim
66 openssh
Serge Bazanskie35199a2023-03-02 10:32:46 +010067 libxcrypt
Serge Bazanskic97461e2021-02-17 20:29:48 +010068 ];
69 multiPkgs = pkgs: [
70 (pkgs.runCommand "protocols" {}
71 ''
72 mkdir -p $out/etc
73 ln -s ${pkgs.iana-etc}/etc/protocols $out/etc/protocols
74 '')
75 ];
76 runScript = wrapper;
77}).env