blob: 1ef930102295ce8d27f8dc1a6bdb112fbfee7708 [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}"
Serge Bazanskif4313b72023-10-13 13:42:53 +020023 export HSCLOUD_NIX=yes
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020024
Serge Bazanskic97461e2021-02-17 20:29:48 +010025 source ${toString ./.}/env.sh
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020026
27 # FIXME: //tools:install runs in a different PATH which thrashes our cache
28 # and causes massive rebuilds on every launch... This next line is the only
29 # important part off tools/install.sh
30 # bazel run //tools:install
Serge Bazanski97b5cd72023-07-28 17:14:50 +000031 #bazel build //tools/... //cluster/tools/...
Serge Bazanskic97461e2021-02-17 20:29:48 +010032
Serge Bazanski69ff6032021-09-11 01:14:13 +020033 # Fancy colorful PS1 to make people notice easily they're in hscloud.
34 PS1='\[\033]0;\u/hscloud:\w\007\]'
35 if type -P dircolors >/dev/null ; then
36 PS1+='\[\033[01;35m\]\u/hscloud\[\033[01;34m\] \w \$\[\033[00m\] '
37 fi
38 export PS1
39
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020040 exec bash --noprofile --norc "$@"
Serge Bazanskic97461e2021-02-17 20:29:48 +010041 '';
42
43in (pkgs.buildFHSUserEnv {
44 name = "hscloud-build";
45 targetPkgs = pkgs: with pkgs; [
Patryk Jakuszew28742b82022-11-26 21:33:38 +010046 bazel_5
Serge Bazanskic97461e2021-02-17 20:29:48 +010047 postgresql
Serge Bazanski97b5cd72023-07-28 17:14:50 +000048 python310
Serge Bazanskic97461e2021-02-17 20:29:48 +010049 openjdk11
50 openldap.dev cyrus_sasl.dev # for python-ldap
Serge Bazanski97b5cd72023-07-28 17:14:50 +000051 # No wkhtmltopdf as it got yoten from the hydra build set, and building it
52 # takes ages. Run locally in docker container instead.
53 #wkhtmltopdf
54 gcc binutils clang
55 libxcrypt-legacy
Serge Bazanski43b0e092021-06-06 12:50:54 +000056 pwgen
57 tmate
Mateusz Lenik51f6c102021-07-18 16:33:03 +020058 git
Piotr Dobrowolskicb9cbb32021-09-14 18:37:10 +020059 which
Piotr Dobrowolski0c59cb32021-09-14 19:57:03 +020060 gnupg
Piotr Dobrowolskicb9cbb32021-09-14 18:37:10 +020061 nettools
Piotr Dobrowolski45e4fec2022-04-26 23:09:43 +020062 file
63 curl
64 netcat
65 nix
Serge Bazanski8e439ed2022-06-11 12:16:12 +000066 vim
67 openssh
Serge Bazanskie35199a2023-03-02 10:32:46 +010068 libxcrypt
Serge Bazanskid9567b32023-10-08 12:28:06 +000069 zlib
Serge Bazanskic97461e2021-02-17 20:29:48 +010070 ];
71 multiPkgs = pkgs: [
72 (pkgs.runCommand "protocols" {}
73 ''
74 mkdir -p $out/etc
75 ln -s ${pkgs.iana-etc}/etc/protocols $out/etc/protocols
76 '')
77 ];
78 runScript = wrapper;
79}).env