blob: ea96061a9906dc2cfc6ed353f11e4194df7cbff1 [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}"
Piotr Dobrowolskiebae0162024-02-25 18:42:48 +010023 export SHELL="${pkgs.bash}/bin/bash"
Serge Bazanskif4313b72023-10-13 13:42:53 +020024 export HSCLOUD_NIX=yes
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020025
Serge Bazanskic97461e2021-02-17 20:29:48 +010026 source ${toString ./.}/env.sh
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020027
28 # FIXME: //tools:install runs in a different PATH which thrashes our cache
29 # and causes massive rebuilds on every launch... This next line is the only
30 # important part off tools/install.sh
31 # bazel run //tools:install
Serge Bazanski97b5cd72023-07-28 17:14:50 +000032 #bazel build //tools/... //cluster/tools/...
Serge Bazanskic97461e2021-02-17 20:29:48 +010033
Serge Bazanski69ff6032021-09-11 01:14:13 +020034 # Fancy colorful PS1 to make people notice easily they're in hscloud.
35 PS1='\[\033]0;\u/hscloud:\w\007\]'
36 if type -P dircolors >/dev/null ; then
37 PS1+='\[\033[01;35m\]\u/hscloud\[\033[01;34m\] \w \$\[\033[00m\] '
38 fi
39 export PS1
40
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020041 exec bash --noprofile --norc "$@"
Serge Bazanskic97461e2021-02-17 20:29:48 +010042 '';
43
44in (pkgs.buildFHSUserEnv {
45 name = "hscloud-build";
46 targetPkgs = pkgs: with pkgs; [
Patryk Jakuszew28742b82022-11-26 21:33:38 +010047 bazel_5
Serge Bazanskic97461e2021-02-17 20:29:48 +010048 postgresql
Serge Bazanski97b5cd72023-07-28 17:14:50 +000049 python310
Serge Bazanskic97461e2021-02-17 20:29:48 +010050 openjdk11
51 openldap.dev cyrus_sasl.dev # for python-ldap
Serge Bazanski97b5cd72023-07-28 17:14:50 +000052 # No wkhtmltopdf as it got yoten from the hydra build set, and building it
53 # takes ages. Run locally in docker container instead.
54 #wkhtmltopdf
55 gcc binutils clang
56 libxcrypt-legacy
Serge Bazanski43b0e092021-06-06 12:50:54 +000057 pwgen
58 tmate
Mateusz Lenik51f6c102021-07-18 16:33:03 +020059 git
Piotr Dobrowolskicb9cbb32021-09-14 18:37:10 +020060 which
Piotr Dobrowolski0c59cb32021-09-14 19:57:03 +020061 gnupg
Piotr Dobrowolskicb9cbb32021-09-14 18:37:10 +020062 nettools
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020063 file
64 curl
65 netcat
66 nix
Serge Bazanski8e439ed2022-06-11 12:16:12 +000067 vim
68 openssh
Serge Bazanskie35199a2023-03-02 10:32:46 +010069 libxcrypt
Serge Bazanskid9567b32023-10-08 12:28:06 +000070 zlib
Piotr Dobrowolskiff8a50c2024-02-01 23:28:14 +010071
72 colmena
Serge Bazanskic97461e2021-02-17 20:29:48 +010073 ];
74 multiPkgs = pkgs: [
75 (pkgs.runCommand "protocols" {}
76 ''
77 mkdir -p $out/etc
78 ln -s ${pkgs.iana-etc}/etc/protocols $out/etc/protocols
79 '')
80 ];
81 runScript = wrapper;
82}).env