# Pastebin uAprf9SZ (defun nix-find-sandbox-file (path file) "Find the given FILE by walking to / starting from PATH" (let ((found (locate-dominating-file path (lambda (dir) (file-exists-p (concat dir (f-path-separator) file) ))))) (and found (concat (expand-file-name found) file)))) (defun nix-find-sandbox (path) "Find the closest nix-shell, prefer shell.nix but if none is found settle with default.nix" (and (file-exists-p path) (or (nix-find-sandbox-file path "shell.nix") (nix-find-sandbox-file path "default.nix"))))