Serge Bazanski | b1de757 | 2020-10-29 00:43:43 +0100 | [diff] [blame] | 1 | { hscloud, pkgs, ... }: |
| 2 | |
| 3 | # This supports building laserproxy in nix, which is used for deploying it to customs. |
| 4 | # This is mildly hacky and should be reworked to function for any hscloud bazel target |
| 5 | # in a more generic fashion. |
| 6 | # |
| 7 | # To build: |
| 8 | # ~/hscloud $ nix-build -A hswaw.laserproxy |
| 9 | |
| 10 | pkgs.buildBazelPackage rec { |
| 11 | name = "laserproxy"; |
| 12 | src = hscloud.root; |
| 13 | bazelTarget = "//hswaw/laserproxy"; |
| 14 | nativeBuildInputs = with pkgs; [ |
| 15 | git python3 postgresql go |
| 16 | ]; |
| 17 | patches = [ |
| 18 | ./nix-disable-uwsgi.patch |
| 19 | ./nix-use-system-go.patch |
| 20 | ./nix-disable-workspace-status.patch |
| 21 | ]; |
| 22 | |
| 23 | removeRulesCC = false; |
| 24 | fetchConfigured = true; |
| 25 | fetchAttrs = { |
| 26 | inherit patches; |
| 27 | # Nicked from nixpkgs usages of buildBazelPackage. |
| 28 | preInstall = '' |
| 29 | rm -rf $bazelOut/external/{go_sdk,\@go_sdk.marker} |
| 30 | sed -e '/^FILE:@go_sdk.*/d' -i $bazelOut/external/\@*.marker |
| 31 | |
| 32 | chmod -R 755 $bazelOut/external/{bazel_gazelle_go_repository_cache,@\bazel_gazelle_go_repository_cache.marker} |
| 33 | rm -rf $bazelOut/external/{bazel_gazelle_go_repository_cache,@\bazel_gazelle_go_repository_cache.marker} |
| 34 | |
| 35 | rm -rf $bazelOut/external/{bazel_gazelle_go_repository_tools,\@bazel_gazelle_go_repository_tools.marker} |
| 36 | sed -e '/^FILE:@bazel_gazelle_go_repository_tools.*/d' -i $bazelOut/external/\@*.marker |
| 37 | ''; |
| 38 | sha256 = "0d0vlls1i0nmlqiszfhwb0cn1kwll3ffxd3sn30pk7drhfrbvqhf"; |
| 39 | }; |
| 40 | buildAttrs = { |
| 41 | inherit patches; |
| 42 | installPhase = '' |
| 43 | install -Dm755 bazel-bin/hswaw/laserproxy/*/laserproxy $out/bin/laserproxy |
| 44 | ''; |
| 45 | }; |
| 46 | } |