Serge Bazanski | c97461e | 2021-02-17 20:29:48 +0100 | [diff] [blame] | 1 | # Shell for being able to use bazel on NixOS (or on any operating system with Nix installed). |
| 2 | |
| 3 | let |
| 4 | |
| 5 | hscloud = import ./default.nix {}; |
| 6 | |
Bartosz Stebel | 56ff18c | 2021-08-30 23:28:45 +0200 | [diff] [blame] | 7 | in with hscloud.pkgs; let |
Serge Bazanski | c97461e | 2021-02-17 20:29:48 +0100 | [diff] [blame] | 8 | |
Piotr Dobrowolski | 45e4fec | 2022-04-26 23:09:43 +0200 | [diff] [blame] | 9 | 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 Bazanski | c97461e | 2021-02-17 20:29:48 +0100 | [diff] [blame] | 18 | wrapper = pkgs.writeScript "wrapper.sh" |
| 19 | '' |
Piotr Dobrowolski | 45e4fec | 2022-04-26 23:09:43 +0200 | [diff] [blame] | 20 | 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 Dobrowolski | ebae016 | 2024-02-25 18:42:48 +0100 | [diff] [blame] | 23 | export SHELL="${pkgs.bash}/bin/bash" |
Serge Bazanski | f4313b7 | 2023-10-13 13:42:53 +0200 | [diff] [blame] | 24 | export HSCLOUD_NIX=yes |
Piotr Dobrowolski | 45e4fec | 2022-04-26 23:09:43 +0200 | [diff] [blame] | 25 | |
Serge Bazanski | c97461e | 2021-02-17 20:29:48 +0100 | [diff] [blame] | 26 | source ${toString ./.}/env.sh |
Piotr Dobrowolski | 45e4fec | 2022-04-26 23:09:43 +0200 | [diff] [blame] | 27 | |
| 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 Bazanski | 97b5cd7 | 2023-07-28 17:14:50 +0000 | [diff] [blame] | 32 | #bazel build //tools/... //cluster/tools/... |
Serge Bazanski | c97461e | 2021-02-17 20:29:48 +0100 | [diff] [blame] | 33 | |
Serge Bazanski | 69ff603 | 2021-09-11 01:14:13 +0200 | [diff] [blame] | 34 | # 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 Dobrowolski | 45e4fec | 2022-04-26 23:09:43 +0200 | [diff] [blame] | 41 | exec bash --noprofile --norc "$@" |
Serge Bazanski | c97461e | 2021-02-17 20:29:48 +0100 | [diff] [blame] | 42 | ''; |
| 43 | |
| 44 | in (pkgs.buildFHSUserEnv { |
| 45 | name = "hscloud-build"; |
| 46 | targetPkgs = pkgs: with pkgs; [ |
Patryk Jakuszew | 28742b8 | 2022-11-26 21:33:38 +0100 | [diff] [blame] | 47 | bazel_5 |
Serge Bazanski | c97461e | 2021-02-17 20:29:48 +0100 | [diff] [blame] | 48 | postgresql |
Serge Bazanski | 97b5cd7 | 2023-07-28 17:14:50 +0000 | [diff] [blame] | 49 | python310 |
Serge Bazanski | c97461e | 2021-02-17 20:29:48 +0100 | [diff] [blame] | 50 | openjdk11 |
| 51 | openldap.dev cyrus_sasl.dev # for python-ldap |
Serge Bazanski | 97b5cd7 | 2023-07-28 17:14:50 +0000 | [diff] [blame] | 52 | # 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 Bazanski | 43b0e09 | 2021-06-06 12:50:54 +0000 | [diff] [blame] | 57 | pwgen |
| 58 | tmate |
Mateusz Lenik | 51f6c10 | 2021-07-18 16:33:03 +0200 | [diff] [blame] | 59 | git |
Piotr Dobrowolski | cb9cbb3 | 2021-09-14 18:37:10 +0200 | [diff] [blame] | 60 | which |
Piotr Dobrowolski | 0c59cb3 | 2021-09-14 19:57:03 +0200 | [diff] [blame] | 61 | gnupg |
Piotr Dobrowolski | cb9cbb3 | 2021-09-14 18:37:10 +0200 | [diff] [blame] | 62 | nettools |
Piotr Dobrowolski | 45e4fec | 2022-04-26 23:09:43 +0200 | [diff] [blame] | 63 | file |
| 64 | curl |
| 65 | netcat |
| 66 | nix |
Serge Bazanski | 8e439ed | 2022-06-11 12:16:12 +0000 | [diff] [blame] | 67 | vim |
| 68 | openssh |
Serge Bazanski | e35199a | 2023-03-02 10:32:46 +0100 | [diff] [blame] | 69 | libxcrypt |
Serge Bazanski | d9567b3 | 2023-10-08 12:28:06 +0000 | [diff] [blame] | 70 | zlib |
Piotr Dobrowolski | ff8a50c | 2024-02-01 23:28:14 +0100 | [diff] [blame] | 71 | |
| 72 | colmena |
Serge Bazanski | c97461e | 2021-02-17 20:29:48 +0100 | [diff] [blame] | 73 | ]; |
| 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 |