Add nginx public share stuff - should probably move some stuff to ansible?
This commit is contained in:
parent
5acb13e483
commit
4527c3c87c
13 changed files with 240 additions and 78 deletions
|
@ -8,52 +8,55 @@ export CURDIR
|
|||
dfp="$(realpath "$(dirname "$0")"/../..)"
|
||||
|
||||
detect_os() {
|
||||
# NixOS
|
||||
if head /etc/os-release --lines 1 | grep 'NixOS$' >/dev/null 2>&1; then
|
||||
ln -s "$dfp/os/linux/nix" "$ENV_PATH/os-linux-nix" >/dev/null 2>&1
|
||||
return
|
||||
fi
|
||||
# NixOS
|
||||
if head /etc/os-release --lines 1 | grep 'NixOS$' > /dev/null 2>&1; then
|
||||
ln -s "$dfp/os/linux/nix" "$ENV_PATH/os-linux-nix" > /dev/null 2>&1
|
||||
return
|
||||
fi
|
||||
|
||||
# Arch Linux
|
||||
if head /etc/os-release --lines 1 | grep 'Arch Linux' >/dev/null 2>&1; then
|
||||
ln -s "$dfp/os/linux/arch" "$ENV_PATH/os-linux-arch" >/dev/null 2>&1
|
||||
return
|
||||
fi
|
||||
# Arch Linux
|
||||
if head /etc/os-release --lines 1 | grep 'Arch Linux' > /dev/null 2>&1; then
|
||||
ln -s "$dfp/os/linux/arch" "$ENV_PATH/os-linux-arch" > /dev/null 2>&1
|
||||
return
|
||||
fi
|
||||
|
||||
# Pacman-based
|
||||
if command -v pacman; then
|
||||
ln -s "$dfp/os/linux/arch" "$ENV_PATH/os-linux-arch" >/dev/null 2>&1
|
||||
return
|
||||
fi
|
||||
# Pacman-based
|
||||
if command -v pacman; then
|
||||
ln -s "$dfp/os/linux/arch" "$ENV_PATH/os-linux-arch" > /dev/null 2>&1
|
||||
return
|
||||
fi
|
||||
|
||||
# TODO: Debian
|
||||
# TODO: Debian
|
||||
|
||||
echo "Failed to auto-detect your OS! Please setup your environments and run this script again."
|
||||
exit 3
|
||||
echo "Failed to auto-detect your OS! Please setup your environments and run this script again."
|
||||
exit 3
|
||||
}
|
||||
|
||||
if command -v git >/dev/null 2>&1; then
|
||||
if [ -f "$dfp/common/envs" ]; then
|
||||
# TODO: more shared init stuff?
|
||||
mkdir -p $ENV_PATH
|
||||
detect_os
|
||||
ls -la -R $ENV_PATH/*
|
||||
find "$ENV_PATH" | while read -r s; do
|
||||
f="$s/dotfiles-init.d.sh"
|
||||
if [ -f "$f" ]; then
|
||||
CURDIR="$s"
|
||||
. "$f"
|
||||
fi
|
||||
done
|
||||
$dfp/common/bin/dotfiles-setup
|
||||
else
|
||||
git clone "https://git.lyte.dev/lytedev/dotfiles.git" "$XDG_CONFIG_HOME/lytedev-dotfiles"
|
||||
cd "$XDG_CONFIG_HOME/lytedev-dotfiles" || { echo "Could not cd to dotfiles dir"; exit 2; }
|
||||
. ./common/bin/dotfiles-init
|
||||
fi
|
||||
if command -v git > /dev/null 2>&1; then
|
||||
if [ -f "$dfp/common/envs" ]; then
|
||||
# TODO: more shared init stuff?
|
||||
mkdir -p "$ENV_PATH"
|
||||
detect_os
|
||||
ls -la -R "$ENV_PATH/*"
|
||||
find "$ENV_PATH" | while read -r s; do
|
||||
f="$s/dotfiles-init.d.sh"
|
||||
if [ -f "$f" ]; then
|
||||
CURDIR="$s"
|
||||
. "$f"
|
||||
fi
|
||||
done
|
||||
$dfp/common/bin/dotfiles-setup
|
||||
else
|
||||
git clone "https://git.lyte.dev/lytedev/dotfiles.git" "$XDG_CONFIG_HOME/lytedev-dotfiles"
|
||||
cd "$XDG_CONFIG_HOME/lytedev-dotfiles" || {
|
||||
echo "Could not cd to dotfiles dir"
|
||||
exit 2
|
||||
}
|
||||
. ./common/bin/dotfiles-init
|
||||
fi
|
||||
else
|
||||
echo "git not installed"
|
||||
exit 1
|
||||
echo "git not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# TODO: run provision script
|
||||
|
|
|
@ -22,3 +22,4 @@ host/laptop/postmates-macbook
|
|||
host/laptop/uber-macbook
|
||||
host/laptop/val-macbook
|
||||
host/layer/personal
|
||||
host/layer/nginx-user-public
|
||||
|
|
|
@ -142,7 +142,7 @@ alias cdltl "cd (ltld)"
|
|||
|
||||
alias p "ping 8.8.8.8"
|
||||
function pp --description "Keeps trying to ping 8.8.8.8 forever"
|
||||
while not ping -n 1 -t 5 8.8.8.8
|
||||
while not ping -n 1 -w 5 8.8.8.8
|
||||
sleep 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,4 +25,6 @@ else if command --search --quiet vi
|
|||
set --export --universal VISUAL vi
|
||||
end
|
||||
|
||||
set --export --universal SOPS_AGE_KEY_FILE "$XDG_CONFIG_HOME/sops/age/keys.txt"
|
||||
|
||||
# has_command fd && set -Ux FZF_DEFAULT_COMMAND 'fd --type f --hidden --follow --exclude .git'
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
htop_version=3.1.2
|
||||
config_reader_min_version=2
|
||||
fields=0 48 17 18 38 39 40 2 46 47 49 1
|
||||
sort_key=47
|
||||
sort_key=46
|
||||
sort_direction=-1
|
||||
tree_sort_key=0
|
||||
tree_sort_direction=1
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"coc.preferences.formatOnSaveFiletypes": ["elixir", "ex", "exs", "typescript", "css", "markdown"],
|
||||
"coc.preferences.formatOnSaveFiletypes": ["elixir", "ex", "exs", "typescript", "css", "markdown", "sh", "bash"],
|
||||
"languageserver": {
|
||||
"nim": {
|
||||
"command": "nimlsp",
|
||||
|
@ -17,9 +17,55 @@
|
|||
},
|
||||
"elixir.pathToElixirLS": "~/.elixir-ls/release/language_server.sh",
|
||||
"rust-analyzer.checkOnSave.command": "clippy",
|
||||
"diagnostic-languageserver.filetypes": {
|
||||
"elixir": ["mix_credo", "mix_credo_compile"],
|
||||
"eelixir": ["mix_credo", "mix_credo_compile"]
|
||||
"diagnostic-languageserver": {
|
||||
"enable": true,
|
||||
"mergeConfig": true,
|
||||
"linters": {
|
||||
"shellcheck": {
|
||||
"command": "shellcheck",
|
||||
"debounce": 100,
|
||||
"args": [
|
||||
"-x",
|
||||
"--format",
|
||||
"json1",
|
||||
"-"
|
||||
],
|
||||
"sourceName": "shellcheck",
|
||||
"parseJson": {
|
||||
"errorsRoot": "comments",
|
||||
"line": "line",
|
||||
"column": "column",
|
||||
"endLine": "endLine",
|
||||
"endColumn": "endColumn",
|
||||
"message": "${message} [${code}]",
|
||||
"security": "level"
|
||||
},
|
||||
"securities": {
|
||||
"error": "error",
|
||||
"warning": "warning",
|
||||
"info": "info",
|
||||
"style": "hint"
|
||||
}
|
||||
}
|
||||
},
|
||||
"filetypes": {
|
||||
"elixir": ["mix_credo", "mix_credo_compile"],
|
||||
"eelixir": ["mix_credo", "mix_credo_compile"],
|
||||
"sh": "shellcheck",
|
||||
"bash": "shellcheck"
|
||||
},
|
||||
"formatters": {
|
||||
"shfmt": {
|
||||
"command": "shfmt",
|
||||
"args": ["-i", "2", "-bn", "-ci", "-sr", "-kp"]
|
||||
}
|
||||
},
|
||||
"formatFiletypes": {
|
||||
"elixir": "mix_format",
|
||||
"eelixir": "mix_format",
|
||||
"sh": "shfmt",
|
||||
"bash": "shfmt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,26 +1,28 @@
|
|||
unbind C-b
|
||||
set -g prefix C-s
|
||||
bind-key s send-prefix
|
||||
bind s send-prefix
|
||||
|
||||
bind-key v split-window -h
|
||||
bind-key b split-window
|
||||
bind-key T source-file "$HOME/.tmux.conf" \; display-message "Reloaded $HOME/.tmux.conf"
|
||||
bind-key O display-message "#(tmux-save-buffer '#S')"
|
||||
bind-key H set -s status
|
||||
bind-key -n C-l select-pane -R
|
||||
bind-key -n C-k select-pane -U
|
||||
bind-key -n C-j select-pane -D
|
||||
bind-key -n C-h select-pane -L
|
||||
bind-key -n C-t new-window
|
||||
bind-key Tab next-window
|
||||
bind-key -n C-Tab next-window
|
||||
bind-key -n C-S-Tab previous-window
|
||||
bind v split-window -h
|
||||
bind b split-window
|
||||
bind T source-file "$HOME/.tmux.conf" \; display-message "Reloaded $HOME/.tmux.conf"
|
||||
bind O display-message "#(tmux-save-buffer '#S')"
|
||||
bind D attach-session -t . -c '#{pane_current_path}' \; display-message "Set session path to #{pane_current_path}"
|
||||
bind H set -s status
|
||||
bind -n C-l select-pane -R
|
||||
bind -n C-k select-pane -U
|
||||
bind -n C-j select-pane -D
|
||||
bind -n C-h select-pane -L
|
||||
bind -n C-t new-window
|
||||
bind Tab next-window
|
||||
bind -n C-Tab next-window
|
||||
bind -n C-S-Tab previous-window
|
||||
bind s run "tmux split-window -l 12 'tmuxswitcher'"
|
||||
|
||||
bind M-l source-file "$XDG_CONFIG_HOME/tmux/layouts/dev.tmux"
|
||||
|
||||
set -g update-environment "WAYLAND_DISPLAY DISPLAY"
|
||||
|
||||
# TODO: check if kitty is installed?
|
||||
set -g default-terminal "kitty"
|
||||
set -g mouse on
|
||||
set -g escape-time 0
|
||||
|
@ -42,7 +44,11 @@ set -g window-status-separator ""
|
|||
set -g window-status-current-format " #W"
|
||||
set -g status-left "#h:#S #W"
|
||||
set -g status-right-length 280
|
||||
set -g status-right "#(kubeline && printf ' ')#{pane_current_path} #(cd '#{pane_current_path}' && git rev-parse --abbrev-ref --sq HEAD | tr -d \"'\")#{pane_current_command}"
|
||||
set -g status-right "#(kubeline && printf ' ')"
|
||||
set -ag status-right "#(pwd | $XDG_CONFIG_HOME/lytedev-dotfiles/common/bin/glancepath) "
|
||||
set -ag status-right "#(cd '#{pane_current_path}' && git rev-parse --abbrev-ref --sq HEAD | tr -d \"'\")"
|
||||
set -ag status-right "#{pane_current_command}"
|
||||
|
||||
set -g message-style "fg=colour7 bg=colour18"
|
||||
set -g pane-active-border-style bg=black,fg=blue
|
||||
set -g pane-border-style bg=black,fg=colour18
|
||||
|
@ -54,29 +60,27 @@ set -g window-status-current-format ""
|
|||
|
||||
# present a menu of urls to open from the visible pane
|
||||
# TODO: fzf-ify this
|
||||
bind-key u capture-pane \;\
|
||||
save-buffer /tmp/tmux-buffer \;\
|
||||
split-window -l 10 "urlscan /tmp/tmux-buffer"
|
||||
# bind u capture-pane \;\
|
||||
# save-buffer /tmp/tmux-buffer \;\
|
||||
# split-window -l 10 "urlscan /tmp/tmux-buffer"
|
||||
|
||||
bind-key -T copy-mode-vi "y" send-keys -X copy-pipe-and-cancel 'wl-copy'
|
||||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'wl-copy'; \
|
||||
bind -T copy-mode-vi "y" send-keys -X copy-pipe-no-clear 'wl-copy' \; display-message 'Copied to clipboard!'
|
||||
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear 'wl-copy' \; display-message 'Copied to clipboard!'
|
||||
|
||||
bind-key K kill-pane
|
||||
bind-key C-S-k kill-window
|
||||
bind K kill-pane
|
||||
bind C-S-k kill-window
|
||||
|
||||
# TODO: handle tmux nesting by being able to toggle the prefix (and indicate in status bar?)
|
||||
|
||||
# bind -T root F12 \
|
||||
# set prefix None \;\
|
||||
# set key-table off \;\
|
||||
# set status off \
|
||||
# if -F "#{pane_in_mode}" "send-keys -X cancel" \;\
|
||||
# refresh-client -S \;\
|
||||
# TODO: styles after `set -u key-table`
|
||||
#if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
|
||||
bind -T root F12 set -g prefix None \; set -g key-table off \; display-message "Keys OFF" \; refresh-client -S
|
||||
|
||||
# bind -T off F12 \
|
||||
# set -u prefix \;\
|
||||
# set -u key-table \;\
|
||||
# set status on \;\
|
||||
# refresh-client -S
|
||||
# TODO: styles after `set -u key-table`
|
||||
bind -T off F12 \
|
||||
set -g -u prefix \;\
|
||||
set -g -u key-table \;\
|
||||
display-message "Keys ON" \;\
|
||||
refresh-client -S
|
||||
|
||||
source-file "$ENV_PATH/*/tmux.d.conf"
|
||||
|
|
1
host/layer/nginx-user-public/.nginx-autoindex-after.html
Normal file
1
host/layer/nginx-user-public/.nginx-autoindex-after.html
Normal file
|
@ -0,0 +1 @@
|
|||
</body>
|
60
host/layer/nginx-user-public/.nginx-autoindex-before.html
Normal file
60
host/layer/nginx-user-public/.nginx-autoindex-before.html
Normal file
|
@ -0,0 +1,60 @@
|
|||
<!doctype html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<style>
|
||||
*, *::before, *::after {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'IosevkaLyte';
|
||||
font-display: swap;
|
||||
font-weight: 400;
|
||||
font-stretch: normal;
|
||||
font-style: normal;
|
||||
src: url('https://files.lyte.dev/iosevkalyte/woff2/iosevkalyte-regular.woff2') format('woff2'), url('https://files.lyte.dev/iosevkalyte/ttf/iosevkalyte-regular.ttf') format('truetype');
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
html {
|
||||
color: #fff;
|
||||
background-color: #111;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0af;
|
||||
}
|
||||
|
||||
a:visited {
|
||||
color: #faf;
|
||||
}
|
||||
}
|
||||
|
||||
html {
|
||||
font-family: IosevkaLyte;
|
||||
}
|
||||
|
||||
pre, code {
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
a {
|
||||
display: inline-block;
|
||||
padding: 0.15em 0;
|
||||
}
|
||||
|
||||
hr {
|
||||
display: none;
|
||||
}
|
||||
|
||||
h1, pre {
|
||||
display: block;
|
||||
max-width: 800px;
|
||||
margin: 0.5em auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
11
host/layer/nginx-user-public/dotfiles-setup.d.fish
Normal file
11
host/layer/nginx-user-public/dotfiles-setup.d.fish
Normal file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env fish
|
||||
set me (status -f)
|
||||
set dfp $argv[1]
|
||||
set h $argv[2]
|
||||
set c $argv[3]
|
||||
|
||||
pushd (dirname $me)
|
||||
sudo ln -s (pwd)/user-public-http.conf /etc/nginx/user-public-http.conf
|
||||
sudo ln -s (pwd)/user-public-server.conf /etc/nginx/user-public-server.conf
|
||||
sudo ln -s (pwd)/.nginx-autoindex-before.html /usr/share/nginx/html/.nginx-autoindex-before.html
|
||||
sudo ln -s (pwd)/.nginx-autoindex-after.html /usr/share/nginx/html/.nginx-autoindex-after.html
|
13
host/layer/nginx-user-public/user-public-http.conf
Normal file
13
host/layer/nginx-user-public/user-public-http.conf
Normal file
|
@ -0,0 +1,13 @@
|
|||
disable_symlinks off;
|
||||
|
||||
# for wasm games
|
||||
types {
|
||||
application/octet-stream clr;
|
||||
application/octet-stream pdb;
|
||||
}
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 10240;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/json application/xml application/wasm;
|
||||
gzip_disable msie6;
|
13
host/layer/nginx-user-public/user-public-server.conf
Normal file
13
host/layer/nginx-user-public/user-public-server.conf
Normal file
|
@ -0,0 +1,13 @@
|
|||
# need CORS?
|
||||
# location ~* \.(eot|ttf|woff|woff2)$ {
|
||||
# add_header Access-Control-Allow-Origin *;
|
||||
# }
|
||||
|
||||
location ~ ^/~(.+?)(/.*)?$ {
|
||||
disable_symlinks off;
|
||||
alias /home/$1/public$2;
|
||||
index index.html index.htm;
|
||||
autoindex on;
|
||||
add_before_body "/.nginx-autoindex-before.html";
|
||||
add_after_body "/.nginx-autoindex-after.html";
|
||||
}
|
8
host/layer/personal/dotfiles-setup.d.fish
Normal file
8
host/layer/personal/dotfiles-setup.d.fish
Normal file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env fish
|
||||
set me (status -f)
|
||||
set dfp $argv[1]
|
||||
set h $argv[2]
|
||||
set c $argv[3]
|
||||
|
||||
pushd (dirname $me)
|
||||
# l app $c/app
|
Reference in a new issue