From 1e404025d930667285059e0e547d3c109738ac27 Mon Sep 17 00:00:00 2001 From: embr Date: Fri, 3 Sep 2021 12:32:57 +0200 Subject: [PATCH] add nix-shell for local development --- default.nix | 3 +-- shell.nix | 24 ++++++++++++++++++++++++ source.nix | 4 ++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 shell.nix create mode 100644 source.nix diff --git a/default.nix b/default.nix index 076881624..e13afcdb3 100644 --- a/default.nix +++ b/default.nix @@ -1,7 +1,6 @@ { pkgs ? import { } }: let - f = (path: type: ! builtins.elem (baseNameOf path) [ ".git" "node_modules" "result" ]); - src = builtins.filterSource f ./.; + src = import ./source.nix; in pkgs.mastodon.override { pname = "mastodon-queer-af"; diff --git a/shell.nix b/shell.nix new file mode 100644 index 000000000..e806251eb --- /dev/null +++ b/shell.nix @@ -0,0 +1,24 @@ +{ pkgs ? import { } }: +let + src = import ./source.nix; + gems = pkgs.bundlerEnv { + name = "mastodon-gems"; + gemdir = ./.; + }; + yarns = pkgs.mkYarnPackage { + pname = "mastodon-yarns"; + yarnNix = ./yarn.nix; + packageJSON = ./package.json; + version = "0.0.0"; + inherit src; + }; +in +pkgs.mkShell { + packages = [ gems gems.wrappedRuby pkgs.yarn pkgs.nodejs pkgs.foreman ]; + + RAILS_ENV = "development"; + + # The rails bits default to this, but the node bits don't, which cause weird + # errors trying to run the streaming component without sourcing a .envrc. + DB_HOST = "/var/run/postgresql"; +} diff --git a/source.nix b/source.nix new file mode 100644 index 000000000..973aad486 --- /dev/null +++ b/source.nix @@ -0,0 +1,4 @@ +let + f = (path: type: ! builtins.elem (baseNameOf path) [ ".git" "node_modules" "result" ]); +in +builtins.filterSource f ./.