From e0c4b694b53da86e520dfd5755b484a9b60c2878 Mon Sep 17 00:00:00 2001 From: edef Date: Sun, 12 Jun 2022 09:33:18 +0000 Subject: ripple/shell.nix: provide a wrapper for SUID fusermount(1) fusermount(1) gets shadowed by pkgs.fuse, but we actually need the SUID-root one in the system PATH. This adds a wrapper script that hunts down a SUID-root binary from PATH. Change-Id: Icc5c6789d7b74bf8f6e3c50529333eb6b894527f --- ripple/shell.nix | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'ripple') diff --git a/ripple/shell.nix b/ripple/shell.nix index cc9c44e..ce621fa 100644 --- a/ripple/shell.nix +++ b/ripple/shell.nix @@ -4,7 +4,21 @@ with import ./nix; -let inherit (gcc) cc; in +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 = [ @@ -31,4 +45,8 @@ mkShell { PROTOC = "protoc"; MINITRACE_CC1 = "${cc}/libexec/gcc/x86_64-unknown-linux-gnu/${cc.version}/cc1"; + + shellHook = '' + export PATH=${fusermount}/bin:$PATH + ''; } -- cgit 1.4.1