forked from sourcegraph/sourcegraph-public-snapshot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
shell.nix
102 lines (86 loc) · 2.84 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Experimental support for developing in nix. Please reach out to @keegan or @noah if
# you encounter any issues.
#
# Things it does differently:
#
# - Runs postgres under ~/.sourcegraph with a unix socket. No need to manage a
# service. Must remember to run "pg_ctl stop" if you want to stop it.
#
# Status: everything works on linux. Go1.17 is currently broken on
# darwin. https://github.com/NixOS/nixpkgs/commit/9675a865c9c3eeec36c06361f7215e109925654c
{ pkgs }:
let
# pkgs.universal-ctags installs the binary as "ctags", not "universal-ctags"
# like zoekt expects.
universal-ctags = pkgs.writeScriptBin "universal-ctags" ''
#!${pkgs.stdenv.shell}
exec ${pkgs.universal-ctags}/bin/ctags "$@"
'';
# We let bazelisk manage the bazel version since we actually need to run two
# different versions thanks to aspect. Additionally bazelisk allows us to do
# things like "bazel configure". So we just install a script called bazel
# which calls bazelisk.
#
# Additionally bazel seems to break when CC and CXX is set to a nix managed
# compiler on darwin. So the script unsets those.
bazelisk = pkgs.writeScriptBin "bazel" ''
#!${pkgs.stdenv.shell}
unset CC CXX
exec ${pkgs.bazelisk}/bin/bazelisk "$@"
'';
in
pkgs.mkShell {
name = "sourcegraph-dev";
# The packages in the `buildInputs` list will be added to the PATH in our shell
nativeBuildInputs = with pkgs; [
rnix-lsp
# Our core DB.
postgresql_13
# Cache and some store data
redis
# Used by symbols and zoekt-git-index to extract symbols from
# sourcecode.
universal-ctags
# Build our backend.
go_1_20
# Lots of our tooling and go tests rely on git et al.
git
git-lfs
parallel
nssTools
# CI lint tools you need locally
shfmt
shellcheck
golangci-lint
# Web tools. Need node 16.7 so we use unstable. Yarn should also be built
# against it.
nodejs-16_x
(nodejs-16_x.pkgs.pnpm.override {
version = "7.28.0";
src = fetchurl {
url = "https://registry.npmjs.org/pnpm/-/pnpm-7.28.0.tgz";
sha512 = "sha512-nbuY07S2519jEjaV9KLjSFmOwh0b6KIViIdc/RCJkgco8SZa2+ikQQe4N3CfNn5By5BH0dKVbZ8Ox1Mw8wItSA==";
};
})
nodePackages.typescript
# Rust utils for syntax-highlighter service,
# currently not pinned to the same versions.
cargo
rustc
rustfmt
libiconv
clippy
bazelisk
];
# Startup postgres
shellHook = ''
. ./dev/nix/shell-hook.sh
'';
# Fix for using Delve https://github.com/sourcegraph/sourcegraph/pull/35885
hardeningDisable = [ "fortify" ];
# By explicitly setting this environment variable we avoid starting up
# universal-ctags via docker.
CTAGS_COMMAND = "${universal-ctags}/bin/universal-ctags";
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
DEV_WEB_BUILDER = "esbuild";
}