Page MenuHomePhabricator

D3274.id9872.diff
No OneTemporary

D3274.id9872.diff

diff --git a/.envrc b/.envrc
new file mode 100644
--- /dev/null
+++ b/.envrc
@@ -0,0 +1,11 @@
+# reload when these files change
+watch_file flake.nix
+watch_file flake.lock
+
+{
+ # shell gc root dir, to avoid nix cleaning up nix packages
+ mkdir -p "$(direnv_layout_dir)"
+
+ # load nix development environment
+ eval "$(nix print-dev-env --profile $(direnv_layout_dir)/flake-profile)"
+} || use nix
diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,10 @@
server/facts
.eslintcache
.vscode
+
+# Nix
+result
+result-*
+
+# Direnv
+.direnv
diff --git a/docs/dev_environment.md b/docs/dev_environment.md
--- a/docs/dev_environment.md
+++ b/docs/dev_environment.md
@@ -2,6 +2,8 @@
Please note that our dev environment currently only works on macOS and Linux.
+For quickly setting up a dev environment using nix, please go to [nix development environment](./nix_dev_env.md).
+
For the Linux instructions [head to the Linux configuration steps](linux_dev_environment.md).
<details>
diff --git a/flake.lock b/flake.lock
new file mode 100644
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,43 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1641404362,
+ "narHash": "sha256-8j21rw0xwwuiz8uOybm6gbeQIfAga/cwovzr3z1xzOg=",
+ "owner": "nixos",
+ "repo": "nixpkgs",
+ "rev": "defafc9a220440180a34f923be9772d9c89a8197",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nixos",
+ "ref": "nixpkgs-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs",
+ "utils": "utils"
+ }
+ },
+ "utils": {
+ "locked": {
+ "lastModified": 1638122382,
+ "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,33 @@
+{
+ description = "Comm flake";
+
+ inputs = {
+ utils.url = "github:numtide/flake-utils";
+ nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
+ };
+
+ outputs = { self, nixpkgs, utils, ... }:
+ let
+ # put devShell and any other required packages into local overlay
+ localOverlay = import ./nix/overlay.nix;
+ overlays = [
+ localOverlay
+ ];
+
+ pkgsForSystem = system: import nixpkgs {
+ # if you have additional overlays, you may add them here
+ overlays = [
+ localOverlay # this should expose devShell
+ ];
+ inherit system;
+ config.android_sdk.accept_license = true;
+ };
+ # https://github.com/numtide/flake-utils#usage for more examples
+ in utils.lib.eachSystem [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ] (system: rec {
+ legacyPackages = pkgsForSystem system;
+ inherit (legacyPackages) devShell;
+ }) // {
+ inherit overlays;
+ overlay = nixpkgs.lib.composeManyExtensions overlays;
+ };
+}
diff --git a/native/android/app/bash/build_openssl.sh b/native/android/app/bash/build_openssl.sh
--- a/native/android/app/bash/build_openssl.sh
+++ b/native/android/app/bash/build_openssl.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# OpenSSL library building automation script for
# the Gradle build process integration.
#
diff --git a/native/android/app/bash/detect_abis.sh b/native/android/app/bash/detect_abis.sh
--- a/native/android/app/bash/detect_abis.sh
+++ b/native/android/app/bash/detect_abis.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/native/scripts/mark-generated.sh b/native/scripts/mark-generated.sh
--- a/native/scripts/mark-generated.sh
+++ b/native/scripts/mark-generated.sh
@@ -1,3 +1,3 @@
-#!/bin/bash
+#!/usr/bin/env bash
sed -i '' 's/\/\/ Generated by /\/\/ @generated by /g' cpp/CommonCpp/grpc/_generated/*
\ No newline at end of file
diff --git a/nix/android-dev-env.nix b/nix/android-dev-env.nix
new file mode 100644
--- /dev/null
+++ b/nix/android-dev-env.nix
@@ -0,0 +1,22 @@
+{ androidenv }:
+
+androidenv.composeAndroidPackages {
+ toolsVersion = "26.1.1";
+ platformToolsVersion = "31.0.3";
+ buildToolsVersions = [ "31.0.0" ];
+ includeEmulator = false;
+ emulatorVersion = "30.9.0";
+ platformVersions = [ "30" ];
+ includeSources = false;
+ includeSystemImages = false;
+ systemImageTypes = [ "google_apis_playstore" ];
+ abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
+ cmakeVersions = [ "3.10.2" ];
+ includeNDK = true;
+ ndkVersions = ["22.0.7026061"];
+ useGoogleAPIs = false;
+ useGoogleTVAddOns = false;
+ includeExtras = [
+ "extras;google;gcm"
+ ];
+}
diff --git a/nix/dev-shell.nix b/nix/dev-shell.nix
new file mode 100644
--- /dev/null
+++ b/nix/dev-shell.nix
@@ -0,0 +1,45 @@
+{ mkShell
+, stdenv
+, lib
+, androidDevEnv
+, arcanist
+, darwin
+, flow
+, nodejs-16_x
+, openjdk11
+, protobuf3_15
+, yarn
+}:
+
+mkShell rec {
+
+ # programs which are meant to be executed should go here
+ nativeBuildInputs = [
+ arcanist
+ flow
+ nodejs-16_x
+ protobuf3_15
+ yarn
+ ] ++ lib.optionals stdenv.isx86_64 [
+ # aarch64-darwin tarballs are not available
+ androidDevEnv.androidsdk
+ ];
+
+ # include any libraries or programs in buildInputs
+ buildInputs = [
+ protobuf3_15
+ ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+ CoreFoundation
+ Security
+ ]);
+
+ # if a package exposes many commands, libraries, shellhooks, etc. Add here
+ inputsFrom = [
+ openjdk11
+ ];
+
+ # shell commands to be ran upon entering shell
+ shellHook = ''
+ echo "Welcome to Comm dev environment! :)"
+ '';
+}
diff --git a/nix/overlay.nix b/nix/overlay.nix
new file mode 100644
--- /dev/null
+++ b/nix/overlay.nix
@@ -0,0 +1,6 @@
+prev: final: {
+ # add packages meant for just this repository
+ androidDevEnv = prev.callPackage ./android-dev-env.nix { };
+
+ devShell = final.callPackage ./dev-shell.nix { };
+}
diff --git a/server/bash/backup_phabricator.sh b/server/bash/backup_phabricator.sh
--- a/server/bash/backup_phabricator.sh
+++ b/server/bash/backup_phabricator.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# run as: ssh user on root wheel
# run from: wherever
diff --git a/server/bash/deploy.sh b/server/bash/deploy.sh
--- a/server/bash/deploy.sh
+++ b/server/bash/deploy.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# run as: ssh user on root wheel
# run from: wherever
diff --git a/server/bash/run-prod.sh b/server/bash/run-prod.sh
--- a/server/bash/run-prod.sh
+++ b/server/bash/run-prod.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# run as: node user
# run from: server dir
diff --git a/server/bash/setup.sh b/server/bash/setup.sh
--- a/server/bash/setup.sh
+++ b/server/bash/setup.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# run as: node user
# run from: root of repo
diff --git a/server/bash/source-nvm.sh b/server/bash/source-nvm.sh
--- a/server/bash/source-nvm.sh
+++ b/server/bash/source-nvm.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
# source as: logged in user
# source from: package.json (via npm/yarn scripts)
diff --git a/services/backup/docker-base/contents/install_aws_sdk.sh b/services/backup/docker-base/contents/install_aws_sdk.sh
--- a/services/backup/docker-base/contents/install_aws_sdk.sh
+++ b/services/backup/docker-base/contents/install_aws_sdk.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/backup/docker-server/contents/build_server.sh b/services/backup/docker-server/contents/build_server.sh
--- a/services/backup/docker-server/contents/build_server.sh
+++ b/services/backup/docker-server/contents/build_server.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/backup/docker-server/contents/run_server.sh b/services/backup/docker-server/contents/run_server.sh
--- a/services/backup/docker-server/contents/run_server.sh
+++ b/services/backup/docker-server/contents/run_server.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/backup/docker-server/contents/run_tests.sh b/services/backup/docker-server/contents/run_tests.sh
--- a/services/backup/docker-server/contents/run_tests.sh
+++ b/services/backup/docker-server/contents/run_tests.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/backup/docker-server/contents/server/build.sh b/services/backup/docker-server/contents/server/build.sh
--- a/services/backup/docker-server/contents/server/build.sh
+++ b/services/backup/docker-server/contents/server/build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/backup/docker-server/contents/server/generate.sh b/services/backup/docker-server/contents/server/generate.sh
--- a/services/backup/docker-server/contents/server/generate.sh
+++ b/services/backup/docker-server/contents/server/generate.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/base-image/contents/install_grpc.sh b/services/base-image/contents/install_grpc.sh
--- a/services/base-image/contents/install_grpc.sh
+++ b/services/base-image/contents/install_grpc.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/scripts/build_base_image.sh b/services/scripts/build_base_image.sh
--- a/services/scripts/build_base_image.sh
+++ b/services/scripts/build_base_image.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/scripts/list_services.sh b/services/scripts/list_services.sh
--- a/services/scripts/list_services.sh
+++ b/services/scripts/list_services.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/scripts/run_all_services.sh b/services/scripts/run_all_services.sh
--- a/services/scripts/run_all_services.sh
+++ b/services/scripts/run_all_services.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/scripts/run_server_image.sh b/services/scripts/run_server_image.sh
--- a/services/scripts/run_server_image.sh
+++ b/services/scripts/run_server_image.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/scripts/services_config.sh b/services/scripts/services_config.sh
--- a/services/scripts/services_config.sh
+++ b/services/scripts/services_config.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/scripts/test_all_services.sh b/services/scripts/test_all_services.sh
--- a/services/scripts/test_all_services.sh
+++ b/services/scripts/test_all_services.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/scripts/test_service.sh b/services/scripts/test_service.sh
--- a/services/scripts/test_service.sh
+++ b/services/scripts/test_service.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/tunnelbroker/docker-base/contents/install_folly.sh b/services/tunnelbroker/docker-base/contents/install_folly.sh
--- a/services/tunnelbroker/docker-base/contents/install_folly.sh
+++ b/services/tunnelbroker/docker-base/contents/install_folly.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/tunnelbroker/docker-server/contents/build_server.sh b/services/tunnelbroker/docker-server/contents/build_server.sh
--- a/services/tunnelbroker/docker-server/contents/build_server.sh
+++ b/services/tunnelbroker/docker-server/contents/build_server.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/tunnelbroker/docker-server/contents/run_server.sh b/services/tunnelbroker/docker-server/contents/run_server.sh
--- a/services/tunnelbroker/docker-server/contents/run_server.sh
+++ b/services/tunnelbroker/docker-server/contents/run_server.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/tunnelbroker/docker-server/contents/run_tests.sh b/services/tunnelbroker/docker-server/contents/run_tests.sh
--- a/services/tunnelbroker/docker-server/contents/run_tests.sh
+++ b/services/tunnelbroker/docker-server/contents/run_tests.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/tunnelbroker/docker-server/contents/server/build.sh b/services/tunnelbroker/docker-server/contents/server/build.sh
--- a/services/tunnelbroker/docker-server/contents/server/build.sh
+++ b/services/tunnelbroker/docker-server/contents/server/build.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
diff --git a/services/tunnelbroker/docker-server/contents/server/generate.sh b/services/tunnelbroker/docker-server/contents/server/generate.sh
--- a/services/tunnelbroker/docker-server/contents/server/generate.sh
+++ b/services/tunnelbroker/docker-server/contents/server/generate.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 8:00 AM (18 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574645
Default Alt Text
D3274.id9872.diff (12 KB)

Event Timeline