Page MenuHomePhabricator

D3274.id12019.diff
No OneTemporary

D3274.id12019.diff

diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -14,3 +14,6 @@
.eslintcache
.vscode
!.vscode/extensions.json
+
+# Nix
+result*
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,36 @@
+{
+ description = "Comm flake";
+
+ inputs = {
+ utils.url = "github:numtide/flake-utils";
+ nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
+ };
+
+ outputs = { self, nixpkgs, utils, ... }:
+ let
+ # Overlays allow for extending a package set, in this case, we are extending nixpkgs
+ # with our devShell
+ localOverlay = import ./nix/overlay.nix;
+ overlays = [
+ localOverlay
+ ];
+
+ # Since we build for many systems (e.g. m1 mac, x86_64-linux), we create
+ # a helper function to help facilitate instantiation of the related package set
+ pkgsForSystem = system: import nixpkgs {
+ inherit overlays system;
+ };
+
+ # utils.lib.eachSystem helps create a result set of expected flake outputs
+ # of the form <output>.<system>
+ # 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;
+ }) // {
+ # these outputs will lack the system suffix (e.g. devShell.aarch64-darwin), thus should
+ # be system agnostic such as overlays or utility functions.
+ overlays = { inherit localOverlay; };
+ overlay = localOverlay;
+ };
+}
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,33 @@
+{ mkShell
+, stdenv
+, lib
+, arcanist
+, darwin
+, nodejs-16_x
+, protobuf3_15
+, yarn
+}:
+
+mkShell {
+
+ # programs which are meant to be executed should go here
+ nativeBuildInputs = [
+ arcanist
+ nodejs-16_x
+ protobuf3_15
+ yarn
+ ];
+
+ # include any libraries buildInputs
+ buildInputs = [
+ protobuf3_15 # exposes both a library and a command, thus should appear in both inputs
+ ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+ CoreFoundation
+ Security
+ ]);
+
+ # 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,15 @@
+# An overlay allows for a package set to be extended with new or modified packages
+
+# `final` refers to the package set with all overlays applied.
+# This allows for added or modified packages to be referenced with
+# all relevant changes
+final:
+
+# `prev` refers to the previous package set before this current overlay is applied.
+# This is cheaper for nix to evaluate, thus should be prefered over final when possible.
+prev:
+
+{
+ # add packages meant for just this repository
+ devShell = final.callPackage ./dev-shell.nix { };
+}

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 10:41 AM (12 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2590216
Default Alt Text
D3274.id12019.diff (4 KB)

Event Timeline