summary refs log tree commit diff
path: root/ripple/shell.nix
blob: ce621fac5fcb8bfeade72c2226d11861662190d9 (plain)
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
# SPDX-FileCopyrightText: V <v@unfathomable.blue>
# SPDX-FileCopyrightText: edef <edef@unfathomable.blue>
# SPDX-License-Identifier: OSL-3.0

with import ./nix;

let
  inherit (gcc) cc;
  # workaround for fusermount(1) getting shadowed by pkgs.fuse
  # fusermount needs to be SUID-root to work, so nothing we can supply will suffice
  # we have to pull it from the system environment instead
  # NOTE: this has to go *before* pkgs.fuse in PATH
  fusermount = writeShellScriptBin "fusermount" ''
    IFS=:
    for p in $PATH; do
      [ -u "$p/fusermount" ] && exec "$p/fusermount" "$@"
    done
    echo cannot find SUID fusermount >&2
    exit 1
  '';
in

mkShell {
  packages = [
    cargo
    cargo-watch
    clippy

    # needed by rust-analyzer
    rustc  # core crate code
    rustfmt  # format-on-save

    # needed by prost-build
    protobuf

    # needed by fuser
    pkgconfig
    fuse

    # needed by git2
    openssl
  ];

  # needed by prost-build
  PROTOC = "protoc";

  MINITRACE_CC1 = "${cc}/libexec/gcc/x86_64-unknown-linux-gnu/${cc.version}/cc1";

  shellHook = ''
    export PATH=${fusermount}/bin:$PATH
  '';
}