Page MenuHomePhabricator

D3274.id10564.diff
No OneTemporary

D3274.id10564.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/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,31 @@
+{
+ 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
+ inherit overlays 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;
+ # unfortunately, nix flake check will error unless you have an explicit `final: prev:`
+ overlay = final: prev: (nixpkgs.lib.composeManyExtensions overlays) final prev;
+ };
+}
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 { };
+}

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 6:30 AM (19 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2574305
Default Alt Text
D3274.id10564.diff (4 KB)

Event Timeline