diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2019-02-16 21:33:17 +0100 |
|---|---|---|
| committer | Daiderd Jordan <daiderd@gmail.com> | 2019-02-16 21:33:17 +0100 |
| commit | 0a8785c61bc893816276d00b9947c130ef33a521 (patch) | |
| tree | 4baee51e7ae9788dd6ae32fddd40771b31ca2934 /modules/examples/lnl.nix | |
| parent | 58a2956870af6110d4298ca979dfaaf4941eacc2 (diff) | |
lnl: start tmux panes in a sandbox by default
Diffstat (limited to 'modules/examples/lnl.nix')
| -rw-r--r-- | modules/examples/lnl.nix | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/modules/examples/lnl.nix b/modules/examples/lnl.nix index ebfbafb..cafb675 100644 --- a/modules/examples/lnl.nix +++ b/modules/examples/lnl.nix @@ -90,7 +90,7 @@ nix.package = pkgs.nixUnstable; nix.useSandbox = true; - nix.sandboxPaths = [ "/System/Library/Frameworks" "/System/Library/PrivateFrameworks" "/usr/lib" "/private/tmp" "/private/var/tmp" "/dev" "/bin/sh" "/usr/bin/env" ]; + nix.sandboxPaths = [ "/System/Library/Frameworks" "/System/Library/PrivateFrameworks" "/usr/lib" "/private/tmp" "/private/var/tmp" "/usr/bin/env" ]; programs.nix-index.enable = true; @@ -120,6 +120,13 @@ set -g status-right '#[fg=white]#(id -un)@#(hostname) #(cat /run/current-system/darwin-version)' ''; + programs.tmux.defaultCommand = "IN_NIX_SANDBOX=1 /usr/bin/sandbox-exec -f /etc/nix/sandbox.sb ${config.environment.loginShell}"; + environment.etc."nix/sandbox.sb".text = '' + (version 1) + (allow default) + (deny file-write* (subpath "/nix")) + ''; + # programs.vim.enable = true; # programs.vim.enableSensible = true; programs.vim.package = pkgs.vim_configurable.customize { @@ -181,6 +188,10 @@ PS1='%F{red}%B%(?..%? )%b%f%# ' RPS1='$(_prompt_nix)%F{green}%~%f' + + if [ -z "$IN_NIX_SANDBOX" ]; then + PS1+='%F{red}[no-sandbox]%f ' + fi ''; programs.zsh.loginShellInit = '' @@ -323,6 +334,10 @@ host=$(hostname -s | awk -F'-' '{print tolower($NF)}') exec tmux new-session -A -s "$host" "$@" } + + no-sandbox() { + tmux split-window -c '#{pane_current_path}' -p 25 $SHELL -l + } ''; programs.zsh.interactiveShellInit = '' |
