diff --git a/nvim/.config/nvim/.luarc.json b/nvim/.config/nvim/.luarc.json new file mode 100755 index 0000000..aad784f --- /dev/null +++ b/nvim/.config/nvim/.luarc.json @@ -0,0 +1,11 @@ +{ + "diagnostics.globals": [ + "vim", + " false", + " " + ], + "runtime.unicodeName": true, + "diagnostics.disable": [ + "undefined-doc-name" + ] +} \ No newline at end of file diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua new file mode 100755 index 0000000..0d71afa --- /dev/null +++ b/nvim/.config/nvim/init.lua @@ -0,0 +1,32 @@ +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +require("vim-options") +require("lazy").setup("plugins") +require("lualine").setup({ + sections = { + lualine_x = { + { + require("noice").api.statusline.mode.get, + cond = require("noice").api.statusline.mode.has, + color = { fg = "#ff9e64" }, + } + }, + }, +}) +require("lazy").setup({ + { + 'tzachar/cmp-tabnine', + build = './install.sh', + dependencies = 'hrsh7th/nvim-cmp', + }}) diff --git a/nvim/.config/nvim/init.lua.bak b/nvim/.config/nvim/init.lua.bak new file mode 100755 index 0000000..0b45ed4 --- /dev/null +++ b/nvim/.config/nvim/init.lua.bak @@ -0,0 +1,35 @@ +vim.cmd("set expandtab") +vim.cmd("set tabstop=2") +vim.cmd("set softtabstop=2") +vim.cmd("set shiftwidth=2") +vim.g.mapleader = " " + +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("vim-options") +require("lazy").setup("plugins") + + + diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json new file mode 100755 index 0000000..2d11858 --- /dev/null +++ b/nvim/.config/nvim/lazy-lock.json @@ -0,0 +1,33 @@ +{ + "LuaSnip": { "branch": "master", "commit": "c9b9a22904c97d0eb69ccb9bab76037838326817" }, + "alpha-nvim": { "branch": "main", "commit": "de72250e054e5e691b9736ee30db72c65d560771" }, + "catppuccin": { "branch": "main", "commit": "f67b886d65a029f12ffa298701fb8f1efd89295d" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp-tabnine": { "branch": "main", "commit": "c0167cdc86c15e782c5461ee62aebee89231c2ed" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "gitsigns.nvim": { "branch": "main", "commit": "abcd00a7d5bc1a9470cb21b023c575acade3e4db" }, + "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, + "lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "e942edf5c85b6a2ab74059ea566cac5b3e1514a4" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "neo-tree.nvim": { "branch": "v3.x", "commit": "e6645ecfcba3e064446a6def1c10d788c9873f51" }, + "noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" }, + "none-ls.nvim": { "branch": "main", "commit": "eec6019d95353f1706bff07ab4698354d09fe062" }, + "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, + "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, + "nvim-lspconfig": { "branch": "master", "commit": "339ccc81e08793c3af9b83882a6ebd90c9cc0d3b" }, + "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, + "nvim-treesitter": { "branch": "master", "commit": "984214ef8e4ca18d77639663319aabdfba89632f" }, + "nvim-web-devicons": { "branch": "master", "commit": "5740b7382429d20b6ed0bbdb0694185af9507d44" }, + "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, + "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, + "telescope.nvim": { "branch": "master", "commit": "d90956833d7c27e73c621a61f20b29fdb7122709" }, + "vim-fugitive": { "branch": "master", "commit": "174230d6a7f2df94705a7ffd8d5413e27ec10a80" }, + "vim-test": { "branch": "master", "commit": "ade33384bd8ca8555853cf5d7dd26a293fcb332e" }, + "vimux": { "branch": "master", "commit": "7db6b2f79d432ee3820668b1d4625311dbe1d0ad" }, + "yazi.nvim": { "branch": "main", "commit": "0e33396749c6f49c2ac23ef546a11a5ab639d504" } +} diff --git a/nvim/.config/nvim/lua/plugins.inactive/oil.lua b/nvim/.config/nvim/lua/plugins.inactive/oil.lua new file mode 100755 index 0000000..4acbe58 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.inactive/oil.lua @@ -0,0 +1,8 @@ +-- return { +-- "stevearc/oil.nvim", +-- config = function() +-- local oil = require("oil") +-- oil.setup() +-- vim.keymap.set("n", "-", oil.toggle_float, {}) +-- end, +--} diff --git a/nvim/.config/nvim/lua/plugins.inactive/swagger-preview.lua b/nvim/.config/nvim/lua/plugins.inactive/swagger-preview.lua new file mode 100755 index 0000000..513df78 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.inactive/swagger-preview.lua @@ -0,0 +1,5 @@ +return { + "vinnymeller/swagger-preview.nvim", + build = "npm install -g swagger-ui-watcher", + config = true, +} diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua new file mode 100755 index 0000000..a564707 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.lua @@ -0,0 +1 @@ +return {} diff --git a/nvim/.config/nvim/lua/plugins/alpha.lua b/nvim/.config/nvim/lua/plugins/alpha.lua new file mode 100755 index 0000000..d6638ae --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/alpha.lua @@ -0,0 +1,31 @@ +return { + "goolord/alpha-nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + + config = function() + local alpha = require("alpha") + local dashboard = require("alpha.themes.startify") + + dashboard.section.header.val = { + [[ ]], + [[ ]], + [[ ]], + [[ ]], + [[  ]], + [[ ████ ██████ █████ ██ ]], + [[ ███████████ █████  ]], + [[ █████████ ███████████████████ ███ ███████████ ]], + [[ █████████ ███ █████████████ █████ ██████████████ ]], + [[ █████████ ██████████ █████████ █████ █████ ████ █████ ]], + [[ ███████████ ███ ███ █████████ █████ █████ ████ █████ ]], + [[ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]], + [[ ]], + [[ ]], + [[ ]], + } + + alpha.setup(dashboard.opts) + end, +} diff --git a/nvim/.config/nvim/lua/plugins/catppuccin.lua b/nvim/.config/nvim/lua/plugins/catppuccin.lua new file mode 100755 index 0000000..988b00f --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/catppuccin.lua @@ -0,0 +1,11 @@ +return { + { + "catppuccin/nvim", + lazy = false, + name = "catppuccin", + priority = 1000, + config = function() + vim.cmd.colorscheme "catppuccin-mocha" + end + } +} diff --git a/nvim/.config/nvim/lua/plugins/cmp.lua b/nvim/.config/nvim/lua/plugins/cmp.lua new file mode 100755 index 0000000..4fcd5cc --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,9 @@ +return { + { + "hrsh7th/cmp-path", -- file and folders + "hrsh7th/cmp-buffer", -- words from the current buffer + "hrsh7th/cmp-nvim-lsp", -- LSP-based autocompletions + "hrsh7th/cmp-cmdline", -- Command-line autocompletions + "tzachar/cmp-tabnine", build = "./install.sh", + }, +} diff --git a/nvim/.config/nvim/lua/plugins/completions.lua b/nvim/.config/nvim/lua/plugins/completions.lua new file mode 100755 index 0000000..f60b34e --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/completions.lua @@ -0,0 +1,46 @@ +return { + { + "hrsh7th/cmp-nvim-lsp", + }, + { + "L3MON4D3/LuaSnip", + dependencies = { + "saadparwaiz1/cmp_luasnip", + "rafamadriz/friendly-snippets", + }, + }, + { + "hrsh7th/nvim-cmp", + config = function() + local cmp = require("cmp") + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.scroll_docs(4), + [""] = cmp.mapping.complete(), + [""] = cmp.mapping.abort(), + [""] = cmp.mapping.confirm({ select = true }), + }), + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, -- For luasnip users. + { name = "buffer" }, + { name = "path" }, + { name = "cmp_tabnine" }, -- ai powerde suggestions + }), + }) + end, + }, +} + diff --git a/nvim/.config/nvim/lua/plugins/git-stuff.lua b/nvim/.config/nvim/lua/plugins/git-stuff.lua new file mode 100755 index 0000000..ac4588d --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/git-stuff.lua @@ -0,0 +1,14 @@ +return { + { + "tpope/vim-fugitive" + }, + { + "lewis6991/gitsigns.nvim", + config = function() + require("gitsigns").setup() + + vim.keymap.set("n", "gp", ":Gitsigns preview_hunk", {}) + vim.keymap.set("n", "gt", ":Gitsigns toggle_current_line_blame", {}) + end + } +} diff --git a/nvim/.config/nvim/lua/plugins/gitsigns.lua b/nvim/.config/nvim/lua/plugins/gitsigns.lua new file mode 100755 index 0000000..687fd25 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,11 @@ +return { + { + "tpope/vim-fugitive", + }, + { + "lewis6991/gitsigns.nvim", + config = function() + require("gitsigns").setup() + end, + } +} diff --git a/nvim/.config/nvim/lua/plugins/lsp-config.lua b/nvim/.config/nvim/lua/plugins/lsp-config.lua new file mode 100755 index 0000000..d434a8c --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lsp-config.lua @@ -0,0 +1,46 @@ +return { + { + "williamboman/mason.nvim", + lazy = false, + config = function() + require("mason").setup() + end, + }, + { + "williamboman/mason-lspconfig.nvim", + lazy = false, + opts = { + auto_install = true, + }, + }, + { + "neovim/nvim-lspconfig", + lazy = false, + config = function() + local capabilities = require('cmp_nvim_lsp').default_capabilities() + + local lspconfig = require("lspconfig") + lspconfig.ts_ls.setup({ + capabilities = capabilities + }) + lspconfig.solargraph.setup({ + capabilities = capabilities + }) + lspconfig.html.setup({ + capabilities = capabilities + }) + lspconfig.lua_ls.setup({ + capabilities = capabilities + }) + lspconfig.pyright.setup({ + capabilities = capabilities + }) + + vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) + vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) + vim.keymap.set("n", "gr", vim.lsp.buf.references, {}) + vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {}) + end, + }, +} + diff --git a/nvim/.config/nvim/lua/plugins/lualine.lua b/nvim/.config/nvim/lua/plugins/lualine.lua new file mode 100755 index 0000000..ad3617a --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/lualine.lua @@ -0,0 +1,10 @@ +return { + "nvim-lualine/lualine.nvim", + config = function () + require('lualine').setup({ + options = { + theme = 'dracula' + } + }) + end +} diff --git a/nvim/.config/nvim/lua/plugins/neo-tree.lua b/nvim/.config/nvim/lua/plugins/neo-tree.lua new file mode 100755 index 0000000..3acf6dd --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/neo-tree.lua @@ -0,0 +1,13 @@ +return { + "nvim-neo-tree/neo-tree.nvim", + branch = "v3.x", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-tree/nvim-web-devicons", + "MunifTanjim/nui.nvim", + }, + config = function() + vim.keymap.set("n", "ee", ":Neotree filesystem reveal left", {}) + vim.keymap.set("n", "bf", ":Neotree buffers reveal float", {}) + end, +} diff --git a/nvim/.config/nvim/lua/plugins/noice.lua b/nvim/.config/nvim/lua/plugins/noice.lua new file mode 100755 index 0000000..057ddd9 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/noice.lua @@ -0,0 +1,17 @@ +return { -- lazy.nvim + { + "folke/noice.nvim", + event = "VeryLazy", + opts = { + -- add any options here + }, + dependencies = { + -- if you lazy-load any plugin below, make sure to add proper `module="..."` entries + "MunifTanjim/nui.nvim", + -- OPTIONAL: + -- `nvim-notify` is only needed, if you want to use the notification view. + -- If not available, we use `mini` as the fallback + -- "rcarriga/nvim-notify", + }, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/none-ls.lua b/nvim/.config/nvim/lua/plugins/none-ls.lua new file mode 100755 index 0000000..d28120e --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/none-ls.lua @@ -0,0 +1,21 @@ +return { + "nvimtools/none-ls.nvim", + config = function() + local null_ls = require("null-ls") + null_ls.setup({ + sources = { + null_ls.builtins.formatting.stylua, + null_ls.builtins.formatting.prettier, + -- null_ls.builtins.diagnostics.eslint_d, + null_ls.builtins.diagnostics.rubocop, + null_ls.builtins.formatting.rubocop, + null_ls.builtins.formatting.black, + null_ls.builtins.formatting.isort, + null_ls.builtins.diagnostics.pylint, + }, + }) + + vim.keymap.set("n", "gf", vim.lsp.buf.format, {}) + end, +} + diff --git a/nvim/.config/nvim/lua/plugins/nvim-tmux-navigation.lua b/nvim/.config/nvim/lua/plugins/nvim-tmux-navigation.lua new file mode 100755 index 0000000..867d0e8 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/nvim-tmux-navigation.lua @@ -0,0 +1,10 @@ +return { + "alexghergh/nvim-tmux-navigation", + config = function() + require('nvim-tmux-navigation').setup({}) + vim.keymap.set("n", "", "NvimTmuxNavigateLeft", {}) + vim.keymap.set("n", "", "NvimTmuxNavigateDown", {}) + vim.keymap.set("n", "", "NvimTmuxNavigateUp", {}) + vim.keymap.set("n", "", "NvimTmuxNavigateRight", {}) + end, +} diff --git a/nvim/.config/nvim/lua/plugins/telescope.lua b/nvim/.config/nvim/lua/plugins/telescope.lua new file mode 100755 index 0000000..ddb60ab --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,26 @@ +return { + { + "nvim-telescope/telescope-ui-select.nvim", + }, + { + "nvim-telescope/telescope.nvim", + tag = "0.1.5", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("telescope").setup({ + extensions = { + ["ui-select"] = { + require("telescope.themes").get_dropdown({}), + }, + }, + }) + local builtin = require("telescope.builtin") + vim.keymap.set("n", "", builtin.find_files, {}) + vim.keymap.set("n", "fg", builtin.live_grep, {}) + vim.keymap.set("n", "", builtin.oldfiles, {}) + + require("telescope").load_extension("ui-select") + require("telescope").load_extension("noice") + end, + }, +} diff --git a/nvim/.config/nvim/lua/plugins/treesitter.lua b/nvim/.config/nvim/lua/plugins/treesitter.lua new file mode 100755 index 0000000..6312070 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,14 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local config = require("nvim-treesitter.configs") + config.setup({ + auto_install = true, + highlight = { enable = true }, + indent = { enable = true }, + }) + end + } +} diff --git a/nvim/.config/nvim/lua/plugins/vim-test.lua b/nvim/.config/nvim/lua/plugins/vim-test.lua new file mode 100755 index 0000000..500e95c --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/vim-test.lua @@ -0,0 +1,14 @@ +return { + "vim-test/vim-test", + dependencies = { + "preservim/vimux" + }, + config = function() + vim.keymap.set("n", "t", ":TestNearest", {}) + vim.keymap.set("n", "T", ":TestFile", {}) + vim.keymap.set("n", "a", ":TestSuite", {}) + vim.keymap.set("n", "l", ":TestLast", {}) + vim.keymap.set("n", "g", ":TestVisit", {}) + vim.cmd("let test#strategy = 'vimux'") + end, +} diff --git a/nvim/.config/nvim/lua/plugins/yazi-nvim.lua b/nvim/.config/nvim/lua/plugins/yazi-nvim.lua new file mode 100755 index 0000000..998b9da --- /dev/null +++ b/nvim/.config/nvim/lua/plugins/yazi-nvim.lua @@ -0,0 +1,35 @@ +return { + { + "mikavilpas/yazi.nvim", + event = "VeryLazy", + keys = { + -- 👇 in this section, choose your own keymappings! + { + "-", + "Yazi", + desc = "Open yazi at the current file", + }, + { + -- Open in the current working directory + "cw", + "Yazi cwd", + desc = "Open the file manager in nvim's working directory", + }, + { + -- NOTE: this requires a version of yazi that includes + -- https://github.com/sxyazi/yazi/pull/1305 from 2024-07-18 + "", + "Yazi toggle", + desc = "Resume the last yazi session", + }, + }, + ---@type YaziConfig + opts = { + -- if you want to open yazi instead of netrw, see below for more info + open_for_directories = false, + keymaps = { + show_help = "", + }, + }, + }, +} diff --git a/nvim/.config/nvim/lua/vim-options.lua b/nvim/.config/nvim/lua/vim-options.lua new file mode 100755 index 0000000..a94a27b --- /dev/null +++ b/nvim/.config/nvim/lua/vim-options.lua @@ -0,0 +1,18 @@ +vim.cmd("set expandtab") +vim.cmd("set tabstop=2") +vim.cmd("set softtabstop=2") +vim.cmd("set shiftwidth=2") +vim.g.mapleader = " " +vim.g.background = "light" + +vim.opt.swapfile = false + +-- Navigate vim panes better +vim.keymap.set('n', '', ':wincmd k') +vim.keymap.set('n', '', ':wincmd j') +vim.keymap.set('n', '', ':wincmd h') +vim.keymap.set('n', '', ':wincmd l') + +vim.keymap.set('n', 'h', ':nohlsearch') +vim.wo.number = true + diff --git a/ohmyposh/zen.toml b/ohmyposh/zen.toml new file mode 100755 index 0000000..7428c6e --- /dev/null +++ b/ohmyposh/zen.toml @@ -0,0 +1,80 @@ +console_title_template = '{{ .Shell }} in {{ .Folder }}' +version = 3 +final_space = true + +[secondary_prompt] + template = '❯❯ ' + foreground = 'magenta' + background = 'transparent' + +[transient_prompt] + template = '❯ ' + background = 'transparent' + foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}'] + +[[blocks]] + type = 'prompt' + alignment = 'left' + newline = true + + [[blocks.segments]] + template = 'servarr {{ .Path }}' + foreground = 'blue' + background = 'transparent' + type = 'path' + style = 'plain' + + [blocks.segments.properties] + cache_duration = 'none' + style = 'full' + + [[blocks.segments]] + template = ' {{ .HEAD }}{{ if or (.Working.Changed) (.Staging.Changed) }}*{{ end }} {{ if gt .Behind 0 }}⇣{{ end }}{{ if gt .Ahead 0 }}⇡{{ end }}' + foreground = 'yellow' + background = 'transparent' + type = 'git' + style = 'plain' + + [blocks.segments.properties] + branch_icon = '' + cache_duration = 'none' + commit_icon = '@' + fetch_status = true + +[[blocks]] + type = 'rprompt' + overflow = 'hidden' + + [[blocks.segments]] + template = '{{ .FormattedMs }}' + foreground = 'yellow' + background = 'transparent' + type = 'executiontime' + style = 'plain' + + [blocks.segments.properties] + cache_duration = 'none' + threshold = 5000 + + [[blocks.segments]] + type = "python" + style = "powerline" + powerline_symbol = "" + foreground = "cyan" + background = "transparent" + template = "  {{ .Full }} " + +[[blocks]] + type = 'prompt' + alignment = 'left' + newline = true + + [[blocks.segments]] + template = '❯' + background = 'transparent' + type = 'text' + style = 'plain' + foreground_templates = ['{{if gt .Code 0}}red{{end}}', '{{if eq .Code 0}}magenta{{end}}'] + + [blocks.segments.properties] + cache_duration = 'none' diff --git a/podman/ai/docker-compose.yml b/podman/ai/docker-compose.yml new file mode 100755 index 0000000..5ba97d5 --- /dev/null +++ b/podman/ai/docker-compose.yml @@ -0,0 +1,64 @@ +version: "3.8" + +services: + # Ollama (Local LLM Runner) + ollama: + image: docker.io/ollama/ollama:latest + container_name: ollama + environment: + - PUID=1000 + - PGID=1000 + volumes: + - /mnt/flash1/podman/ai/config/ollama/:/root/.ollama # Model storage + ports: + - "11434:11434" # API port + restart: unless-stopped + networks: + - ai_net + + # OpenWebUI (Chat Interface for Ollama) + openwebui: + image: ghcr.io/open-webui/open-webui:main + container_name: openwebui + depends_on: + - ollama + environment: + - OLLAMA_API_BASE_URL=http://ollama:11434 # Connect to Ollama + volumes: + - /mnt/flash1/podman/ai/config/openwebui:/app/backend/data + ports: + - "3010:8080" # Web UI + restart: unless-stopped + + extra_hosts: + - "host.docker.internal:host-gateway" + networks: + - ai_net + + n8n: + image: docker.io/n8nio/n8n:latest + container_name: n8n + environment: + - N8N_RUNNERS_ENABLED=true + - WEBHOOK_URL=https://n8n.liphlink.xyz/ + - N8N_HOST=n8n.liphlink.xyz +# - WEBHOOK_TUNNEL_URL=https://n8n.liphlink.xyz + - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true + - GENERIC_TIMEZONE=Europe/Berlin + - N8N_SECURE_COOKIE=false + - N8N_PROTOCOL=https + - PUID=1000 + - PGID=1000 + ports: + - "5678:5678" + volumes: + - /mnt/flash1/podman/ai/config/n8n_data:/home/node/.n8n:z + restart: unless-stopped + +networks: + ai_net: + +volumes: + ollama_data: + openwebui_data: + n8n_data: diff --git a/podman/base/.env b/podman/base/.env new file mode 100755 index 0000000..771cbf7 --- /dev/null +++ b/podman/base/.env @@ -0,0 +1,91 @@ +# Baserow Environment Configuration +# Copy this file to .env and customize the values + +# ============================================ +# REQUIRED: SECURITY SETTINGS +# ============================================ +# IMPORTANT: Change these before starting Baserow! + +# Database password +DATABASE_PASSWORD=1ChageposT + +# Redis password +REDIS_PASSWORD=1ChagerediS + +# Secret key (MUST be at least 50 characters) +# Generate with: openssl rand -base64 64 +SECRET_KEY=mWDO0stOYZxSzHDtqCpOIi78pJBoeIIs+tH2rcNPOf8= + +# ============================================ +# BASEROW PUBLIC URL +# ============================================ +# The URL where Baserow will be accessible +# Examples: +# - Local: http://localhost +# - Local network: http://192.168.1.100 +# - Domain: https://baserow.yourdomain.com +BASEROW_PUBLIC_URL=https://baserow.liphlink.xyz +BASEROW_ENABLE_SECURE_PROXY_SSL_HEADER=True + + +# ============================================ +# EMAIL CONFIGURATION (Optional) +# ============================================ +## Enable SMTP for user invitations and notifications +#EMAIL_SMTP=False +# +## If EMAIL_SMTP=True, configure these: +#EMAIL_SMTP_HOST=smtp.gmail.com +#EMAIL_SMTP_PORT=587 +#EMAIL_SMTP_USER=your-email@gmail.com +#EMAIL_SMTP_PASSWORD=your-app-password +#EMAIL_SMTP_USE_TLS=True +#FROM_EMAIL=noreply@yourdomain.com + +# ============================================ +# S3/MINIO STORAGE (Optional) +# ============================================ +# Uncomment and configure if using MinIO or AWS S3 for file storage + +# For MinIO (if you uncomment the MinIO service in docker-compose.yml): +# AWS_ACCESS_KEY_ID=minioadmin +# AWS_SECRET_ACCESS_KEY=changeme_minio_password +# AWS_STORAGE_BUCKET_NAME=baserow +# AWS_S3_ENDPOINT_URL=http://minio:9000 + +# For AWS S3: +# AWS_ACCESS_KEY_ID=your_aws_access_key +# AWS_SECRET_ACCESS_KEY=your_aws_secret_key +# AWS_STORAGE_BUCKET_NAME=your-bucket-name +# AWS_S3_REGION_NAME=us-east-1 + +# ============================================ +## MINIO CONFIGURATION (if using MinIO) +## ============================================ +#MINIO_ROOT_USER=minioadmin +#MINIO_ROOT_PASSWORD=changeme_secure_minio_password + +# ============================================ +# PERFORMANCE TUNING (Optional) +# ============================================ +# Number of worker processes (adjust based on CPU cores) +BASEROW_AMOUNT_OF_WORKERS=1 + +# Backend debug mode (set to False in production) +BASEROW_BACKEND_DEBUG=False + +# Enable if behind a reverse proxy with SSL +BASEROW_ENABLE_SECURE_PROXY_SSL_HEADER=False + +# ============================================ +# WEBHOOK CONFIGURATION (Optional) +# ============================================ +BASEROW_WEBHOOKS_MAX_CONSECUTIVE_TRIGGER_FAILURES=8 +BASEROW_WEBHOOKS_MAX_RETRIES_PER_CALL=8 +BASEROW_WEBHOOKS_REQUEST_TIMEOUT_SECONDS=5 + +# ============================================ +# FEATURE FLAGS (Optional) +# ============================================ +# Sync templates after migration +BASEROW_TRIGGER_SYNC_TEMPLATES_AFTER_MIGRATION=True diff --git a/podman/base/docker-compose.yml b/podman/base/docker-compose.yml new file mode 100755 index 0000000..710f1d4 --- /dev/null +++ b/podman/base/docker-compose.yml @@ -0,0 +1,149 @@ +version: '3.8' + +services: + # PostgreSQL Database + db: + image: docker.io/postgres:15-alpine + container_name: baserow-postgres + restart: unless-stopped + environment: + POSTGRES_DB: baserow + POSTGRES_USER: baserow + POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-changeme_secure_postgres_password} + volumes: + - /mnt/flash1/podman/base/data/postgres:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready -U baserow"] + interval: 10s + timeout: 5s + retries: 5 + networks: + - baserow-network + + # Redis Cache + redis: + image: docker.io/redis:7-alpine + container_name: baserow-redis + restart: unless-stopped + command: redis-server --requirepass ${REDIS_PASSWORD:-changeme_secure_redis_password} + volumes: + - /mnt/flash1/podman/base/data/redis:/data + healthcheck: + test: ["CMD", "redis-cli", "--no-auth-warning", "-a", "${REDIS_PASSWORD:-changeme_secure_redis_password}", "ping"] + interval: 10s + timeout: 5s + retries: 5 + networks: + - baserow-network + + # Baserow Application (All-in-One) + baserow: + image: docker.io/baserow/baserow:latest + container_name: baserow + restart: unless-stopped + depends_on: + db: + condition: service_healthy + redis: + condition: service_healthy + ports: + - "8079:80" # HTTP + environment: + # Database Configuration + DATABASE_HOST: db + DATABASE_NAME: baserow + DATABASE_USER: baserow + DATABASE_PASSWORD: ${DATABASE_PASSWORD:-changeme_secure_postgres_password} + DATABASE_PORT: 5432 + + # Redis Configuration + REDIS_HOST: redis + REDIS_PASSWORD: ${REDIS_PASSWORD:-changeme_secure_redis_password} + REDIS_PORT: 6379 + REDIS_PROTOCOL: redis + + # Baserow Configuration + BASEROW_PUBLIC_URL: ${BASEROW_PUBLIC_URL:-http://localhost} + SECRET_KEY: ${SECRET_KEY:-changeme_secret_key_minimum_50_characters_long} + +# # Email Configuration (optional - for invitations and notifications) +# EMAIL_SMTP: ${EMAIL_SMTP:-False} +# EMAIL_SMTP_HOST: ${EMAIL_SMTP_HOST:-} +# EMAIL_SMTP_PORT: ${EMAIL_SMTP_PORT:-587} +# EMAIL_SMTP_USER: ${EMAIL_SMTP_USER:-} +# EMAIL_SMTP_PASSWORD: ${EMAIL_SMTP_PASSWORD:-} +# EMAIL_SMTP_USE_TLS: ${EMAIL_SMTP_USE_TLS:-True} +# FROM_EMAIL: ${FROM_EMAIL:-noreply@baserow.io} + + # File Upload Configuration + # Use S3-compatible storage (optional - MinIO, AWS S3, etc.) + # AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID:-} + # AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY:-} + # AWS_STORAGE_BUCKET_NAME: ${AWS_STORAGE_BUCKET_NAME:-baserow} + # AWS_S3_REGION_NAME: ${AWS_S3_REGION_NAME:-us-east-1} + # AWS_S3_ENDPOINT_URL: ${AWS_S3_ENDPOINT_URL:-} # For MinIO: http://minio:9000 + + # Advanced Configuration + BASEROW_AMOUNT_OF_WORKERS: ${BASEROW_AMOUNT_OF_WORKERS:-1} + BASEROW_CELERY_BEAT_DEBUG_LEVEL: ${BASEROW_CELERY_BEAT_DEBUG_LEVEL:-INFO} + BASEROW_BACKEND_DEBUG: ${BASEROW_BACKEND_DEBUG:-False} + + # Feature Flags + BASEROW_ENABLE_SECURE_PROXY_SSL_HEADER: ${BASEROW_ENABLE_SECURE_PROXY_SSL_HEADER:-False} + BASEROW_TRIGGER_SYNC_TEMPLATES_AFTER_MIGRATION: ${BASEROW_TRIGGER_SYNC_TEMPLATES_AFTER_MIGRATION:-True} + + # Webhooks and API + BASEROW_WEBHOOKS_MAX_CONSECUTIVE_TRIGGER_FAILURES: ${BASEROW_WEBHOOKS_MAX_CONSECUTIVE_TRIGGER_FAILURES:-8} + BASEROW_WEBHOOKS_MAX_RETRIES_PER_CALL: ${BASEROW_WEBHOOKS_MAX_RETRIES_PER_CALL:-8} + BASEROW_WEBHOOKS_REQUEST_TIMEOUT_SECONDS: ${BASEROW_WEBHOOKS_REQUEST_TIMEOUT_SECONDS:-5} + + # Performance Tuning + BASEROW_MAX_ROW_REPORT_ERROR_COUNT: ${BASEROW_MAX_ROW_REPORT_ERROR_COUNT:-30} + BASEROW_INITIAL_TABLE_DATA_LIMIT: ${BASEROW_INITIAL_TABLE_DATA_LIMIT:-} + + volumes: + - /mnt/flash1/podman/base/data/baserow:/baserow/data + networks: + - baserow-network + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost/api/health/"] + interval: 30s + timeout: 10s + retries: 3 + + # MinIO S3-compatible storage (optional but recommended for production) + # Uncomment this section if you want to use MinIO for file storage + # minio: + # image: minio/minio:latest + # container_name: baserow-minio + # restart: unless-stopped + # command: server /data --console-address ":9001" + # environment: + # MINIO_ROOT_USER: ${MINIO_ROOT_USER:-minioadmin} + # MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD:-changeme_minio_password} + # volumes: + # - minio_data:/data + # ports: + # - "9000:9000" # S3 API + # - "9001:9001" # MinIO Console + # healthcheck: + # test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + # interval: 30s + # timeout: 20s + # retries: 3 + # networks: + # - baserow-network + +volumes: + postgres_data: + driver: local + redis_data: + driver: local + baserow_data: + driver: local + # minio_data: + # driver: local + +networks: + baserow-network: + driver: bridge diff --git a/podman/browser/docker-compose.yml b/podman/browser/docker-compose.yml new file mode 100755 index 0000000..2b8acf2 --- /dev/null +++ b/podman/browser/docker-compose.yml @@ -0,0 +1,118 @@ +version: "3.8" + +services: +# --- PhotoPrism (Photo Management) --- + photoprism: + image: docker.io/photoprism/photoprism:latest + container_name: photoprism + environment: + - PHOTOPRISM_UPLOAD_NSFW=true + - PHOTOPRISM_ADMIN_PASSWORD=1ChagephotO # Change this! + volumes: + - /mnt/flash1/podman/browser/config/photoprism:/photoprism/storage + - /mnt/tank/photos/:/photoprism/originals # Photo storage + ports: + - "2342:2342" # Web UI + restart: unless-stopped + + audiobookshelf: + image: ghcr.io/advplyr/audiobookshelf:latest + container_name: audiobookshelf + ports: + - 13378:80 + volumes: + - /mnt/tank/audio/audiobooks:/audiobooks + - /mnt/tank/audio/podcasts:/podcasts + - /mnt/flash1/podman/browser/config/audiobookshelf:/config + - /mnt/flash1/podman/browser/data/audiobookshelf:/metadata + environment: + - TZ=Europe/Berlin + +# Music Server (Navidrome) +# navidrome: +# image: docker.io/deluan/navidrome:latest +# container_name: navidrome +# restart: unless-stopped +# ports: +# - "4533:4533" # Web UI port +# volumes: +# - /mnt/flash1/podman/browser/config/navidrome/data/:/data # Config & DB +# - /mnt/tank/music/:/music:ro # Music library (read-only) +# - /mnt/tank/audio/:/tutorials:ro +# environment: +# - ND_SCANSCHEDULE=1h # Auto-scan every hour +# - ND_LOGLEVEL=info + + navidrome-music: + image: docker.io/deluan/navidrome:latest + container_name: navidrome-music + ports: + - "4535:4533" + environment: + - ND_SCANSCHEDULE=1h + - ND_LOGLEVEL=info + - ND_SESSIONTIMEOUT=24h + volumes: + - /mnt/flash1/podman/browser/data/navidrome-music/:/data:Z + - /mnt/tank/music:/music:Z + restart: unless-stopped + + navidrome-meditation: + image: docker.io/deluan/navidrome:latest + container_name: navidrome-meditation + ports: + - "4536:4533" + environment: + - ND_SCANSCHEDULE=1h + - ND_LOGLEVEL=info + - ND_SESSIONTIMEOUT=24h + volumes: + - /mnt/flash1/podman/browser/data/navidrome-meditation:/data:Z + - /mnt/tank/audio/healing:/music:Z + restart: unless-stopped + + calibre-web: + image: ghcr.io/linuxserver/calibre-web + container_name: calibre-web + environment: + - PUID=1000 + - PGID=1000 + - TZ=Europe/Berlin +# - DOCKER_MODS=linuxserver/calibre-web:calibre + volumes: + - /mnt/flash1/podman/browser/config/calibre:/config + - /mnt/tank/ebooks_phil:/books + ports: + - 8083:8083 + restart: unless-stopped + + mealie: + image: ghcr.io/mealie-recipes/mealie:nightly + container_name: mealie + restart: always + ports: + - "9925:9000" # + deploy: + resources: + limits: + memory: 1000M # + volumes: + - /mnt/flash1/podman/browser/config/mealie/:/app/data/ + environment: + # Set Backend ENV Variables Here + ALLOW_SIGNUP: "false" + PUID: 1000 + PGID: 1000 + TZ: Europe/Berlin + BASE_URL: https://demo.mealie.io/g/liph + + kavita: + image: lscr.io/linuxserver/kavita:latest + container_name: kavita + volumes: + - /mnt/flash1/podman/browser/config/kavita/:/kavita/config # Config + - /mnt/tank/ebooks_phil:/books:z # Library + ports: + - "5000:5000" + restart: unless-stopped + diff --git a/podman/essential/.env b/podman/essential/.env new file mode 100755 index 0000000..85fe8ca --- /dev/null +++ b/podman/essential/.env @@ -0,0 +1,4 @@ +PUID=1000 +PGID=33 +TZ=Europe/Berlin + diff --git a/podman/essential/docker-compose.yml b/podman/essential/docker-compose.yml new file mode 100755 index 0000000..e146d9f --- /dev/null +++ b/podman/essential/docker-compose.yml @@ -0,0 +1,86 @@ +version: "3.8" + +services: +# Homarr (Dashboard) + homarr: + image: ghcr.io/ajnart/homarr:latest + container_name: homarr + environment: + - PUID=${PUID} + - PGID=${PGID} + - TZ=${TZ} + - DISABLE_UPGRADE_MODAL=true + volumes: + - /mnt/flash1/podman/essential/config/homarr:/app/data/configs + ports: + - "7575:7575" + restart: unless-stopped + +# Portainer (Container Management - Fixed Socket Path) + portainer: + image: docker.io/portainer/portainer-ce:latest + container_name: portainer + restart: unless-stopped + ports: +# - "9443:9443" + - "9000:9000" + volumes: + - /mnt/flash1/podman/essential/config/portainer-data:/data + - /var/run/docker.sock:/var/run/docker.sock:ro + security_opt: + - no-new-privileges:true + environment: + - PUID=${PUID} + - PGID=${PGID} + - TZ=${TZ} + + watchtower: + image: docker.io/containrrr/watchtower:latest + container_name: watchtower + volumes: + - /var/run/docker.sock:/var/run/docker.sock + environment: + - PUID=${PUID} + - PGID=${PGID} + - TZ=${TZ} + + fail2ban: + image: lscr.io/linuxserver/fail2ban:latest + container_name: fail2ban + cap_add: + - NET_ADMIN + - NET_RAW + network_mode: host + environment: + - PUID=${PUID} + - PGID=${PGID} + - TZ=${TZ} + - VERBOSITY=-vv #optional + volumes: + - /mnt/flash1/podman/essential/config/fail2ban:/config + - /var/log:/var/log:ro + - /mnt/tank/podman/homeassistant/home_assistant/config/home-assistant.log:/remotelogs/homeassistant:ro #optional +# - /path/to/nextcloud/log:/remotelogs/nextcloud:ro #optional +# - /path/to/nginx/log:/remotelogs/nginx:ro #optional +# - /path/to/overseerr/log:/remotelogs/overseerr:ro #optional +# - /path/to/prowlarr/log:/remotelogs/prowlarr:ro #optional +# - /path/to/radarr/log:/remotelogs/radarr:ro #optional +# - /path/to/sonarr/log:/remotelogs/sonarr:ro #optional +# - /path/to/vaultwarden/log:/remotelogs/vaultwarden:ro #optional + restart: unless-stopped + + vaultwarden: + image: docker.io/vaultwarden/server:latest + container_name: vaultwarden + restart: unless-stopped + ports: + - "9445:80" # Expose port 80 internally (no need to publish) + volumes: + - /mnt/flash1/podman/essential/config/vw_data:/data + environment: + - WEBSOCKET_ENABLED=true # Enable WebSocket for real-time sync + - ADMIN_TOKEN=a4dJaEqGjx1q76PoAG0FOw9AURubpMht5cZSVyAvGrX2hnyhlUBc/WbImuZedhTQ +# +#networks: +# npm_network: +# external: true # Use NPM's existing network diff --git a/podman/homeassistant/docker-compose.yml b/podman/homeassistant/docker-compose.yml new file mode 100755 index 0000000..83a5692 --- /dev/null +++ b/podman/homeassistant/docker-compose.yml @@ -0,0 +1,54 @@ +version: '3' +services: + homeassistant: + image: ghcr.io/home-assistant/home-assistant:stable + container_name: homeassistant + restart: unless-stopped + volumes: + - /mnt/flash1/podman/homeassistant/home_assistant/config/:/config + - /etc/localtime:/etc/localtime:ro + environment: + - TZ=${TZ} # Change to your timezone + network_mode: host +# devices: +# - /dev/ttyACM0:/dev/ttyACM0 # Only if using USB devices (e.g., Z-Wave sticks) +# - /dev/ttyUSB0:/dev/ttyUSB0:Z + privileged: true # Required for some hardware access + + zigbee2mqtt: + image: docker.io/koenkk/zigbee2mqtt:latest + server: mqtt://liph:1ChagemqtTd@mosquitto:1883 # "mosquitto" = container name + container_name: zigbee2mqtt + restart: unless-stopped + volumes: + - /mnt/flash1/podman/homeassistant/zigbee2mqtt/data/:/app/data + - /dev/ttyUSB0:/dev/ttyUSB0:z +# devices: +# - /dev/serial/by-id/usb-Itead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_V2_7a09c139e72bef11884a5a88dfbc56eb-if00-port0:/dev/ttyACM0 + environment: + - TZ=${TZ} + network_mode: host # Required for discovery + + mosquitto: + image: docker.io/eclipse-mosquitto:latest + container_name: mosquitto + restart: unless-stopped + volumes: + - /mnt/flash1/podman/homeassistant/mosquitto/config:/mosquitto/config + - /mnt/flash1/podman/homeassistant/mosquitto/data:/mosquitto/data + - /mnt/flash1/podman/homeassistant/mosquitto/log:/mosquitto/log + ports: + - "1883:1883" # MQTT + - "9001:9001" # Websocket (for Lovelace) + + nodered: + image: docker.io/nodered/node-red:latest + container_name: nodered + restart: unless-stopped + volumes: + - /mnt/flash1/podman/homeassistant/nodered/data/:/data + ports: + - "1880:1880" + environment: + - TZ=${TZ} + diff --git a/podman/immich/.env b/podman/immich/.env new file mode 100755 index 0000000..f13f1bf --- /dev/null +++ b/podman/immich/.env @@ -0,0 +1,22 @@ +# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables + +# The location where your uploaded files are stored +UPLOAD_LOCATION=/mnt/flash1/podman/immich/config/immich/ + +# The location where your database files are stored. Network shares are not supported for the database +DB_DATA_LOCATION=/mnt/flash1/podman/immich/config/postgres/ + +# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List +TZ=Etc/UTC + +# The Immich version to use. You can pin this to a specific version like "v1.71.0" +IMMICH_VERSION=release + +# Connection secret for postgres. You should change it to a random password +# Please use only the characters `A-Za-z0-9`, without special characters or spaces +DB_PASSWORD=1ChageposT + +# The values below this line do not need to be changed +################################################################################### +DB_USERNAME=postgres +DB_DATABASE_NAME=immich diff --git a/podman/immich/docker-compose.yml b/podman/immich/docker-compose.yml new file mode 100755 index 0000000..614b9cc --- /dev/null +++ b/podman/immich/docker-compose.yml @@ -0,0 +1,75 @@ +# +# WARNING: To install Immich, follow our guide: https://immich.app/docs/install/docker-compose +# +# Make sure to use the docker-compose.yml of the current release: +# +# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml +# +# The compose file on main may not be compatible with the latest release. + +name: immich + +services: + immich-server: + container_name: immich_server + image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} + # extends: + # file: hwaccel.transcoding.yml + # service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding + volumes: + # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file + - ${UPLOAD_LOCATION}:/data + - /etc/localtime:/etc/localtime:ro + - /mnt/tank/photos:/photos:z + env_file: + - .env + ports: + - '2283:2283' +# depends_on: +# - redis +# - database + restart: always + healthcheck: + disable: false + + immich-machine-learning: + container_name: immich_machine_learning + # For hardware acceleration, add one of -[armnn, cuda, rocm, openvino, rknn] to the image tag. + # Example tag: ${IMMICH_VERSION:-release}-cuda + image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release} + # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration + # file: hwaccel.ml.yml + # service: cpu # set to one of [armnn, cuda, rocm, openvino, openvino-wsl, rknn] for accelerated inference - use the `-wsl` version for WSL2 where applicable + volumes: + - model-cache:/cache + env_file: + - .env + restart: always + healthcheck: + disable: false + + redis: + container_name: immich_redis + image: docker.io/valkey/valkey:8-bookworm@sha256:facc1d2c3462975c34e10fccb167bfa92b0e0dbd992fc282c29a61c3243afb11 + healthcheck: + test: redis-cli ping || exit 1 + restart: always + + database: + container_name: immich_postgres + image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:32324a2f41df5de9efe1af166b7008c3f55646f8d0e00d9550c16c9822366b4a + environment: + POSTGRES_PASSWORD: ${DB_PASSWORD} + POSTGRES_USER: ${DB_USERNAME} + POSTGRES_DB: ${DB_DATABASE_NAME} + POSTGRES_INITDB_ARGS: '--data-checksums' + # Uncomment the DB_STORAGE_TYPE: 'HDD' var if your database isn't stored on SSDs + # DB_STORAGE_TYPE: 'HDD' + volumes: + # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file + - ${DB_DATA_LOCATION}:/var/lib/postgresql/data + shm_size: 128mb + restart: always + +volumes: + model-cache: diff --git a/podman/media/.env b/podman/media/.env new file mode 100755 index 0000000..ec727d7 --- /dev/null +++ b/podman/media/.env @@ -0,0 +1,3 @@ +PUID=1000 +PGID=33 +TZ=Berlin/Europe diff --git a/podman/media/docker-compose.yml b/podman/media/docker-compose.yml new file mode 100755 index 0000000..518018f --- /dev/null +++ b/podman/media/docker-compose.yml @@ -0,0 +1,60 @@ +services: + jellyfin: + image: lscr.io/linuxserver/jellyfin:latest + container_name: jellyfin + environment: + - PUID=${PUID} + - PGID=${PGID} + - TZ=${TZ} +# - JELLYFIN_PublishedServerUrl=http://10.0.0.101 #optional + volumes: + - /mnt/flash1/podman/media/config/:/config + - /mnt/tank/:/data + ports: + - 8096:8096 + - 7359:7359/udp #Service Discovery + - 1901:1900/udp #Client Discovery + restart: unless-stopped + + jellyseerr: + container_name: jellyseerr + image: docker.io/fallenbagel/jellyseerr:latest + environment: + - PUID=${PUID} + - PGID=${PGID} + - TZ=${TZ} + volumes: + - /mnt/flash1/podman/media/config/jellyseerr:/app/config + ports: + - 5055:5055 + restart: unless-stopped + + jellystat-db: + image: docker.io/postgres:latest + container_name: jellystat-db + restart: unless-stopped + environment: + POSTGRES_USER: liph + POSTGRES_PASSWORD: 1ChageposT + volumes: + - ./jellystat/postgres:/var/lib/postgresql/data + + jellystat: + image: docker.io/cyfershepard/jellystat:latest + container_name: jellystat + restart: unless-stopped + environment: + POSTGRES_USER: liph + POSTGRES_PASSWORD: 1ChageposT + POSTGRES_IP: jellystat-db + POSTGRES_PORT: 5432 + JWT_SECRET: "/N1k7UPV2K5I47aARWEbD6lFtD8igZeImIpt64Fhf/Q=" + TZ: ${TZ} + volumes: + - ./jellystat/backup-data:/app/backend/backup-data + ports: + - "3002:3000" + depends_on: + - jellystat-db + +# Want more!? https://github.com/awesome-jellyfin/awesome-jellyfin diff --git a/podman/monitoring/docker-compose.yml b/podman/monitoring/docker-compose.yml new file mode 100755 index 0000000..b82900d --- /dev/null +++ b/podman/monitoring/docker-compose.yml @@ -0,0 +1,223 @@ +#volumes: +# netdataconfig: +# netdatalib: +# netdatacache: + +version: "3" + +services: + beszel: + image: docker.io/henrygd/beszel:latest + container_name: beszel + restart: unless-stopped + ports: + - 8090:8090 + volumes: + - /mnt/flash1/podman/monitoring/beszel/data:/beszel_data + - ./beszel_socket:/beszel_socket + + beszel-agent: + image: docker.io/henrygd/beszel-agent + container_name: beszel-agent + restart: unless-stopped + network_mode: host + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + - /mnt/flash1/podman/monitoring/beszel_agent/data:/var/lib/beszel-agent + # monitor other disks / partitions by mounting a folder in /extra-filesystems + # - /mnt/disk/.beszel:/extra-filesystems/sda1:ro + environment: + LISTEN: 45876 + KEY: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAUf2dTtQj9WJesH11kFD7/qzMIubcHzuZwN92XnHpfB' + TOKEN: 1ac0ad26-9c32-4c45-b02b-c4aa2f8eb40c + HUB_URL: https://beszel.liphlink.xyz + + dozzle: + image: docker.io/amir20/dozzle:latest + container_name: dozzle + volumes: + - /run/podman/podman.sock:/var/run/docker.sock:ro + ports: + - "8078:8080" + environment: + - DOZZLE_LEVEL=info + - DOZZLE_TAILSIZE=300 + restart: unless-stopped + + pulse: + image: docker.io/rcourtman/pulse:latest + container_name: pulse + restart: unless-stopped + ports: + - "${PULSE_PORT:-7655}:7655" + volumes: + - pulse-data:/data + # Secure temperature monitoring via host-side proxy (requires setup - see docs) + # Uncomment after installing pulse-sensor-proxy on host with --standalone flag + # Mount is read-only (:ro) for security - proxy uses SO_PEERCRED for access control + # - /run/pulse-sensor-proxy:/run/pulse-sensor-proxy:ro + environment: + - TZ=${TZ:-UTC} + healthcheck: + test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:7655/api/health"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 10s + + netdata: + container_name: netdata + image: docker.io/netdata/netdata:latest + ports: + - '19999:19999' + volumes: + - /mnt/flash1/podman/monitoring/netdata/data:/etc/netdata + - /mnt/flash1/podman/monitoring/netdata/lib:/var/lib/netdata + - /mnt/flash1/podman/monitoring/netdata/cache:/var/cache/netdata + - '/etc/passwd:/host/etc/passwd:ro' + - '/etc/group:/host/etc/group:ro' + - '/proc:/host/proc:ro' + - '/sys:/host/sys:ro' + - '/etc/os-release:/host/etc/os-release:ro' + - '/etc/localtime:/etc/localtime:ro' + - '/var/log:/host/var/log:ro' + - '/var/run/docker.sock:/var/run/docker.sock:ro' + - '/run/dbus:/run/dbus:ro' + restart: unless-stopped + cap_add: + - SYS_PTRACE + - SYS_ADMIN + security_opt: + - apparmor=unconfined + #networks: ["nginx_nginx_network"] #optional + + uptime-kuma: + image: docker.io/louislam/uptime-kuma:latest + container_name: uptime-kuma + volumes: + - ./data/uptime-kuma:/app/data + ports: + - "3001:3001" # : + restart: always + +volumes: + uptime-kuma: + netdataconfig: + netdatalib: + netdatacache: + pulse-data: +# +# loki: +# container_name: loki +# image: docker.io/grafana/loki:main +# networks: +# - grafana-monitoring +# volumes: +# - ./data/loki/:/etc/loki +# ports: +# - "3100:3100" +# restart: unless-stopped +# command: -config.file=./config/loki/loki-config.yml +# +# promtail: +# container_name: promtail +# image: docker.io/grafana/promtail:main +# networks: +# - grafana-monitoring +# volumes: +# - /var/log:/var/log +# - ./data/promtail/:/etc/promtail +# ports: +# - "1514:1514" # this is only needed if you are going to send syslogs +# restart: unless-stopped +# command: -config.file=./config/promtail/promtail-config.yml +# +# grafana: +# container_name: grafana +# image: docker.io/grafana/grafana-oss:main-ubuntu +# user: "0" +# networks: +# - grafana-monitoring +# - proxy +# volumes: +# - ./data/grafana/:/var/lib/grafana +# restart: unless-stopped +# ports: +# - 3000:3000 +# labels: +# - "traefik.enable=true" +# - "traefik.http.routers.grafana.entrypoints=http" +# - "traefik.http.routers.grafana.rule=Host(`grafana.jimsgarage.co.uk`)" +# - "traefik.http.routers.grafana.middlewares=default-whitelist@file" +# - "traefik.http.middlewares.grafana-https-redirect.redirectscheme.scheme=https" +# - "traefik.http.routers.grafana.middlewares=grafana-https-redirect" +# - "traefik.http.routers.grafana-secure.entrypoints=https" +# - "traefik.http.routers.grafana-secure.rule=Host(`grafana.jimsgarage.co.uk`)" +# - "traefik.http.routers.grafana-secure.tls=true" +# - "traefik.http.routers.grafana-secure.service=grafana" +# - "traefik.http.services.grafana.loadbalancer.server.port=3000" +# - "traefik.docker.network=proxy" +# +# influxdb: +# container_name: influxdb +# image: docker.io/influxdb:latest +# restart: unless-stopped +# ports: +# - 8086:8086 +# - 8089:8089/udp +# networks: +# - grafana-monitoring +# volumes: +# - ./data/influxdb/:/var/lib/influxdb2 +# +# telegraf: +# container_name: docker.io/telegraf +# restart: unless-stopped +# user: 1000:1000 #you need to find the GID of Docker if not added to Sudo group changed from 995 to 1000 +# networks: +# - grafana-monitoring +# volumes: +# - /run/user/1000/podman/podman.sock:/run/podman/podman.sock +# - './config/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro' +# - './data/telegraf/mibs/:/usr/share/snmp/mibs' +# environment: +# - HOST_ETC=/hostfs/etc +# - HOST_PROC=/hostfs/proc +# - HOST_SYS=/hostfs/sys +# - HOST_VAR=/hostfs/var +# - HOST_RUN=/hostfs/run +# - HOST_MOUNT_PREFIX=/hostfs +# image: docker.io/telegraf +# +# graphite: +# image: docker.io/graphiteapp/graphite-statsd +# container_name: graphite +# restart: unless-stopped +# ports: +# - 8050:80 # nginx +# - 2003-2004 # carbon receiver - plaintext & pickle +# - 2023-2024 # carbon aggregator - plaintext & pickle +# - 8125:8125/udp # statsd +# - 8126:8126 # statsd admin +# volumes: +# - ./config/graphite/configs/:/opt/graphite/conf +# - ./data/graphite/data/:/opt/graphite/storage +# - ./config/graphite/statsd_config/:/opt/statsd/config +# networks: +# - grafana-monitoring +# +# prometheus: +# image: docker.io/prom/prometheus +# container_name: prometheus +# restart: unless-stopped +# ports: +# - 9090:9090 +# volumes: +# - ./config/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml +# networks: +# - grafana-monitoring +# +#networks: +# grafana-monitoring: +# proxy: +# # external: true diff --git a/podman/network/docker-compose.yml b/podman/network/docker-compose.yml new file mode 100755 index 0000000..9198e62 --- /dev/null +++ b/podman/network/docker-compose.yml @@ -0,0 +1,43 @@ +services: + app: + image: 'docker.io/jc21/nginx-proxy-manager:latest' + container_name: npm + restart: unless-stopped + ports: + # These ports are in format : + - '80:80' # Public HTTP Port + - '443:443' # Public HTTPS Port + - '81:81' # Admin Web Port + # Add any other Stream port you want to expose + # - '21:21' # FTP + + #environment: + # Uncomment this if you want to change the location of + # the SQLite DB file within the container + # DB_SQLITE_FILE: "/data/database.sqlite" + + # Uncomment this if IPv6 is not enabled on your host + # DISABLE_IPV6: 'true' + + volumes: + - /mnt/flash1/podman/network/data:/data + - /mnt/flash1/podman/network/letsencrypt:/etc/letsencrypt + + + syncthing: + image: lscr.io/linuxserver/syncthing:latest + container_name: syncthing + hostname: syncthing + environment: + - PUID=1000 + - PGID=1000 + - TZ=Europe/Zurich # Change to your timezone + volumes: + - /mnt/flash1/podman/network/config:/config + - /mnt/flash1/podman/nextcloud/config/obsidian/Phil:/data/obsidian:z + ports: + - 8384:8384 + - 22000:22000/tcp + - 22000:22000/udp + - 21027:21027/udp + restart: unless-stopped diff --git a/podman/nextcloud/.env b/podman/nextcloud/.env new file mode 100755 index 0000000..60610f7 --- /dev/null +++ b/podman/nextcloud/.env @@ -0,0 +1,8 @@ +DB_PASSWORD=1ChageposT +DB_USERNAME=next-db +DB_DATABASE_NAME=next +DB_HOST=next-db + +PUID=33 +PGID=1000 + diff --git a/podman/nextcloud/config.php b/podman/nextcloud/config.php new file mode 100755 index 0000000..aa55e15 --- /dev/null +++ b/podman/nextcloud/config.php @@ -0,0 +1,48 @@ + '/', + 'memcache.local' => '\\OC\\Memcache\\APCu', + 'apps_paths' => + array ( + 0 => + array ( + 'path' => '/var/www/html/apps', + 'url' => '/apps', + 'writable' => false, + ), + 1 => + array ( + 'path' => '/var/www/html/custom_apps', + 'url' => '/custom_apps', + 'writable' => true, + ), + ), + 'upgrade.disable-web' => true, + 'passwordsalt' => '6lps3G6LfFcAhOlPzVU+e1vi9pmLZa', + 'secret' => '/sp6y5Wdq1x085Oow0nrkHcFtaehnL88g5cPH31gvrpWfV8S', + 'trusted_domains' => + array ( + 0 => 'localhost', + 1 => 'next.liphlink.xyz', + ), + 'datadirectory' => '/var/www/html/data', + 'dbtype' => 'pgsql', + 'version' => '31.0.8.1', + 'overwrite.cli.url' => 'http://localhost', + 'dbname' => 'next', + 'dbhost' => 'next-db', + 'dbport' => '', + 'dbtableprefix' => 'oc_', + 'dbuser' => 'next-db', + 'dbpassword' => '1ChageposT', + 'installed' => true, + 'instanceid' => 'ocyyoad5slj1', + 'app_install_overwrite' => + array ( + 0 => 'diary', + 1 => 'inventory', + 2 => 'files_reader', + ), + 'loglevel' => 2, + 'maintenance' => false, +); diff --git a/podman/nextcloud/docker-compose.yml b/podman/nextcloud/docker-compose.yml new file mode 100755 index 0000000..8e52436 --- /dev/null +++ b/podman/nextcloud/docker-compose.yml @@ -0,0 +1,157 @@ +version: '3.8' + +services: + # Database (PostgreSQL) + next-db: + image: docker.io/postgres:18 + container_name: next-db + environment: + - POSTGRES_DB=${DB_DATABASE_NAME} + - POSTGRES_USER=${DB_USERNAME} + - POSTGRES_PASSWORD=${DB_PASSWORD} + volumes: + - /mnt/flash1/podman/nextcloud/config/db:/var/lib/postgresql + restart: unless-stopped + networks: + - nextcloud_network + +# # Redis Cache +# next_redis: +# image: docker.io/redis:latest +# container_name: next-redis +# command: redis-server --save 60 1 --loglevel warning +# volumes: +# - ./data/redis:/data +# restart: unless-stopped +# networks: +# - nextcloud_network + + # Nextcloud Main Application + next: + image: docker.io/nextcloud:latest + container_name: next + depends_on: + - next-db + ports: + - "8808:80" + environment: + - POSTGRES_DB=${DB_DATABASE_NAME} + - POSTGRES_USER=${DB_USERNAME} + - POSTGRES_PASSWORD=${DB_PASSWORD} + - POSTGRES_HOST=${DB_HOST} + - NEXTCLOUD_TRUSTED_DOMAINS=next.liphlink.xyz + - NEXTCLOUD_ADMIN_USER=liph + - NEXTCLOUD_ADMIN_PASSWORD=1ChagenexT + volumes: + - /mnt/flash1/podman/nextcloud/config/nextcloud/data:/var/www/html + - /mnt/flash1/podman/nextcloud/config/nextcloud/config:/var/www/html/config:Z + - /mnt/flash1/podman/nextcloud/config/nextcloud/apps:/var/www/html/custom_apps + - /mnt/tank/ebooks_phil:/ebooks_phil:z + - /mnt/tank/cloud_phil:/cloud_phil:z + - /mnt/tank/ebooks_miri:/ebooks_miri:z + - /mnt/tank/cloud_miri:/cloud_miri:z + restart: unless-stopped + networks: + - nextcloud_network + +# # Collabora Online Office +# collabora: +# image: collabora/code:latest +# container_name: collabora +# ports: +# - 9980:9980 +# environment: +# - domain=liphlink.xyz +# - username=liph +# - password=1ChagecolL +# - extra_params=--o:ssl.enable=false +# restart: unless-stopped +# networks: +# - nextcloud_network + + # OnlyOffice (alternative to Collabora) + onlyoffice: + image: docker.io/onlyoffice/documentserver:latest + container_name: onlyoffice + ports: + - 8000:80 + environment: + - JWT_SECRET= 'joJVOvGpHYCahLnEeAShgm78r58VJl4C' + volumes: + - /mnt/flash1/podman/nextcloud/config/onlyoffice:/var/www/onlyoffice/Data + restart: unless-stopped + networks: + - nextcloud_network + + obsidian: + image: lscr.io/linuxserver/obsidian:latest + container_name: obsidian + security_opt: + - seccomp:unconfined #optional + environment: + - PUID=1000 + - PGID=1000 + - TZ=Etc/UTC + volumes: + - /mnt/flash1/podman/nextcloud/config/obsidian:/config:z + - /mnt/flash1/podman/nextcloud/config/vaults:/vault:z + ports: + - 3004:3000 + - 3003:3001 + shm_size: "1gb" + restart: unless-stopped +# # Talk (Video Conferencing) +# talk: +# image: jvillafa/turn:latest +# container_name: nextcloud_talk +# ports: +# - 3478:3478/udp +# - 3478:3478/tcp +# - 65000-65535:65000-65535/udp +# environment: +# - TURN_SECRET=yourturnsecret +# - NEXTCLOUD_TALK_IP=your_server_ip +# restart: unless-stopped +# networks: +# - nextcloud_network + +# # Full-Text Search (optional) +# fulltextsearch: +# image: nextcloud/fulltextsearch:latest +# container_name: nextcloud_fulltext +# depends_on: +# - nextcloud +# environment: +# - NEXTCLOUD_URL=http://nextcloud +# volumes: +# - nextcloud_data:/var/www/html +# restart: unless-stopped +# networks: +# - nextcloud_network + +# # Cron for background jobs +# cron: +# image: nextcloud:latest +# container_name: nextcloud_cron +# depends_on: +# - nextcloud +# volumes: +# - nextcloud_data:/var/www/html +# - nextcloud_config:/var/www/html/config +# - nextcloud_apps:/var/www/html/custom_apps +# entrypoint: /cron.sh +# restart: unless-stopped +# networks: +# - nextcloud_network + +volumes: + pg_data: + redis_data: + nextcloud_data: + nextcloud_config: + nextcloud_apps: + onlyoffice_data: + +networks: + nextcloud_network: + name: nextcloud_network diff --git a/podman/nextcloud/nextcloud_backup.sql b/podman/nextcloud/nextcloud_backup.sql new file mode 100755 index 0000000..e69de29 diff --git a/podman/nocodb/.env b/podman/nocodb/.env new file mode 100755 index 0000000..7c540dc --- /dev/null +++ b/podman/nocodb/.env @@ -0,0 +1,7 @@ +# .env file +NC_DB=pg://postgres:5432?u=nocodb&p=LFeVBxYxjlk959sXXNKK6jx4hZmELdZDLQU3sN+m+04=&d=nocodb +NC_AUTH_JWT_SECRET=9D3V0TFT6YWHT8s3csTHm6KQuf3o74m4bJ3UQfI/e1w= +NC_PUBLIC_URL=http://100.111.222.33:8066 +POSTGRES_USER=postgres +POSTGRES_PASSWORD=LFeVBxYxjlk959sXXNKK6jx4hZmELdZDLQU3sN+m+04= +POSTGRES_DB=nocodb diff --git a/podman/nocodb/docker-compose.yml b/podman/nocodb/docker-compose.yml new file mode 100755 index 0000000..3d3688f --- /dev/null +++ b/podman/nocodb/docker-compose.yml @@ -0,0 +1,40 @@ +version: '3.8' + +services: + # --- NocoDB + Postgres + Redis --- + nocodb: + image: docker.io/nocodb/nocodb:latest + restart: unless-stopped + container_name: nocodb + depends_on: + - nocodb-db + - nocodb-redis + environment: + # Point NocoDB at Postgres. Change passwords before using in prod. + NC_DB: pg://nocodb-db:5432?u=noco&p=noco_pass&d=nocodb + # Required for auth sessions/tokens — use a long random string. + NC_AUTH_JWT_SECRET: "change-me-super-random" + ports: + - "8077:8080" + volumes: + - /mnt/flash1/podman/nocodb/data/nocodb:/usr/app/data + + nocodb-db: + image: docker.io/postgres:15 + restart: unless-stopped + container_name: nocodb-post + environment: + POSTGRES_USER: noco + POSTGRES_PASSWORD: noco_pass + POSTGRES_DB: nocodb + volumes: + - /mnt/flash1/podman/nocodb/data/db:/var/lib/postgresql/data + + nocodb-redis: + image: docker.io/redis:7 + restart: unless-stopped + container_name: nocodb-redis + +#volumes: +# nocodb_data: +# nocodb_db: diff --git a/podman/programming/docker-compose.yml b/podman/programming/docker-compose.yml new file mode 100755 index 0000000..7de255d --- /dev/null +++ b/podman/programming/docker-compose.yml @@ -0,0 +1,23 @@ +version: "3" + +networks: + gitea: + external: false + +services: + gitea: + image: docker.io/gitea/gitea:latest + container_name: gitea + environment: + - USER_UID=1000 + - USER_GID=1000 + restart: always + networks: + - gitea + volumes: + - /mnt/flash1/podman/programming/config/gitea:/data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro + ports: + - "3000:3000" + - "222:22" diff --git a/podman/servarr/.env b/podman/servarr/.env new file mode 100755 index 0000000..9d0a5ab --- /dev/null +++ b/podman/servarr/.env @@ -0,0 +1,24 @@ +# General UID/GIU and Timezone +TZ=Berlin/Europe +PUID=1000 +PGID=1000 + +# Input your VPN provider and type here +VPN_SERVICE_PROVIDER=protonvpn +VPN_TYPE=wireguard +#WIREGUARD_ENDPOINT_PORT=51820 +#WIREGUARD_ENDPOINT_IP=79.127.184.216 +#VPN_DNS_ADDRESS=10.2.0.1 + +# Copy all these varibles from your generated configuration file +#WIREGUARD_PUBLIC_KEY=snSASVcKZegpITPNw2scm44NBC6NPUropoTkfEGtq18= +WIREGUARD_PRIVATE_KEY=aEdH/9nZ0zcvOhAIfI7N/+RlcFqQuelV8nmN4R50hG4= +#WIREGUARD_ADDRESSES=10.2.0.2/32 +SERVER_COUNTRIES=Switzerland + +# Heath check duration +HEALTH_VPN_DURATION_INITIAL=120s + + PORT_FORWARD_ONLY=on + VPN_PORT_FORWARDING=on + VPN_PORT_FORWARDING_UP_COMMAND=/bin/sh -c 'wget -O- --retry-connrefused --post-data "json={\"listen_port\":{{PORTS}}}" http://127.0.0.1:8099/api/v2/app/setPreferences 2>&1' diff --git a/podman/servarr/docker-compose.yml b/podman/servarr/docker-compose.yml new file mode 100755 index 0000000..f4fd973 --- /dev/null +++ b/podman/servarr/docker-compose.yml @@ -0,0 +1,178 @@ +# Compose file for the *arr stack. Configuration files are stored in the +# directory you launch the compose file on. Change to bind mounts if needed. +# All containers are ran with user and group ids of the main user and +# group to aviod permissions issues of downloaded files, please refer +# the read me file for more information. + +############################################################################# +# NOTICE: We recently switched to using a .env file. PLEASE refer to the docs. +# https://github.com/TechHutTV/homelab/tree/main/media#docker-compose-and-env +############################################################################# + + +networks: + servarrnetwork: + name: servarrnetwork + ipam: + config: + - subnet: 172.39.0.0/24 + +version: '3.8' + +services: +# # airvpn recommended (referral url: https://airvpn.org/?referred_by=673908) + gluetun: + image: ghcr.io/qdm12/gluetun:latest + container_name: gluetun + cap_add: + - NET_ADMIN + devices: + - /dev/net/tun:/dev/net/tun # If running on an LXC see readme for more info. + networks: + servarrnetwork: + ipv4_address: 172.39.0.2 + ports: + - 8888:8888/tcp # HTTP proxy + - 8388:8388/tcp # Shadowsocks + - 8388:8388/udp # Shadowsocks + - 8099:8099 # qbittorrent web interface + - 6881:6881 # qbittorrent torrent port + - 6789:6789 # nzbget + - 9696:9696 # prowlarr +# - 9091:9091 #transmission +# - 51413:51413/udp #transmission +# - 51413:51413 #transmission + volumes: + - /mnt/flash1/podman/servarr/config/gluetun:/gluetun + # Make a '.env' file in the same directory. + env_file: + - .env + healthcheck: + test: ping -c 1 www.google.com || exit 1 + interval: 20s + timeout: 10s + retries: 5 + restart: unless-stopped + + qbit: + image: lscr.io/linuxserver/qbittorrent:latest + container_name: qbit + restart: unless-stopped + labels: + - deunhealth.restart.on.unhealthy=true + environment: + - PUID=${PUID} + - PGID=${PGID} + - TZ=${TZ} + - WEBUI_PORT=8099 # must match "qbittorrent web interface" port number in gluetun's service above + volumes: + - /mnt/flash1/podman/servarr/config/qbittorrent:/config + - /mnt/tank/:/data + - /mnt/tank/downloads/torrent/auto:/auto + depends_on: + gluetun: + condition: service_healthy + restart: true + network_mode: service:gluetun + healthcheck: + test: ping -c 1 www.google.com || exit 1 + interval: 60s + retries: 3 + start_period: 20s + timeout: 10s + + prowlarr: + image: lscr.io/linuxserver/prowlarr:latest + container_name: prowlarr + environment: + - PUID=${PUID} + - PGID=${PGID} + - TZ=${TZ} + volumes: + - /etc/localtime:/etc/localtime:ro + - /mnt/flash1/podman/servarr/config/prowlarr:/config + restart: unless-stopped + depends_on: +# flaresolverr: + gluetun: + condition: service_healthy + restart: true + network_mode: service:gluetun + + flaresolverr: + image: ghcr.io/flaresolverr/flaresolverr:latest + container_name: flaresolverr + environment: + - LOG_LEVEL=info # Can be changed to 'debug' for troubleshooting + - LOG_HTML=false # Set to 'true' if you need HTML logging (warning: verbose) + - CAPTCHA_SOLVER=none # Options: none, hcaptcha-solver + - TZ=${TZ} # Change to your timezone + ports: + - 8191:8191 # FlareSolverr API port + restart: unless-stopped + networks: + servarrnetwork: + ipv4_address: 172.39.0.6 + + sonarr: + image: lscr.io/linuxserver/sonarr:latest + container_name: sonarr + restart: unless-stopped + environment: + - PUID=${PUID} + - PGID=${PGID} + - TZ=${TZ} + volumes: + - /etc/localtime:/etc/localtime:ro + - /mnt/flash1/podman/servarr/config/sonarr:/config + - /mnt/tank/:/data:z + ports: + - 8989:8989 + networks: + servarrnetwork: + ipv4_address: 172.39.0.5 + + radarr: + image: lscr.io/linuxserver/radarr:latest + container_name: radarr + restart: unless-stopped + environment: + - PUID=${PUID} + - PGID=${PGID} + - TZ=${TZ} + volumes: + - /etc/localtime:/etc/localtime:ro + - /mnt/flash1/podman/servarr/config/radarr:/config + - /mnt/tank/:/data + ports: + - 7878:7878 + networks: + servarrnetwork: + ipv4_address: 172.39.0.4 + +# transmission: +# image: ghcr.io/linuxserver/transmission +# container_name: transmission +# environment: +# - PUID=${PUID} +# - PGID=${PGID} +# - TZ=${TZ} +# # ports: +# # - 9091:9091 # UI Port +# # - 51413:51413 +# # - 51413:51413/udp +# network_mode: service:gluetun +# volumes: +# - /mnt/ssd2/podman/servarr/config/transmission:/config +# - /mnt/tank/downloads/torrent:/downloads +# - /home/Downloads/Transmission_watch:/watch +# depends_on: +# gluetun: +# condition: service_healthy +# restart: true +# healthcheck: +# test: ping -c 1 www.google.com || exit 1 +# interval: 60s +# retries: 3 +# start_period: 20s +# timeout: 10s diff --git a/scripts/scripts/borg-backup.sh b/scripts/scripts/borg-backup.sh new file mode 100755 index 0000000..5f7f4d5 --- /dev/null +++ b/scripts/scripts/borg-backup.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +SOURCE_DIRS=("/home/liph/Documents" "/home/liph/Pictures" "/home/liph/Downloads") +REPO_DIR="/home/liph/borg-repo" +BORG_PASSPHRASE="1ChagearC" + +export BORG_PASSPHRASE + +for SOURCE_DIR in "${SOURCE_DIRS[@]}"; do + ARCHIVE_NAME="{hostname}-{user}-{now}" + + echo "Starting backup of ${SOURCE_DIR}..." + borg create --stats --progress \ + "${REPO_DIR}::${ARCHIVE_NAME}" \ + "${SOURCE_DIR}" + + if [ $? -eq 0 ]; then + echo "Backup of ${SOURCE_DIR} completed successfully!" + else + echo "Backup of ${SOURCE_DIR} failed!" + fi +done + +echo "Pruning old backups..." +borg prune --stats --progress \ + --keep-daily=7 \ + --keep-weekly=4 \ + --keep-monthly=6 \ + "${REPO_DIR}" + +echo "Backup and pruning completed!" + diff --git a/scripts/scripts/borg-mac.sh b/scripts/scripts/borg-mac.sh new file mode 100755 index 0000000..5175778 --- /dev/null +++ b/scripts/scripts/borg-mac.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# Setting this, so the repo does not need to be given on the commandline: +# export BORG_REPO=ssh://username@example.com:2022/~/backup/main +#export BORG_REPO=~/backup/ + +# See the section "Passphrase notes" for more infos. +#export BORG_PASSPHRASE='1ChagearC' + +export BORG_REPO="ssh://100.121.203.110:2222/./repo/borg-repo" +export BORG_PASSPHRASE="1ChagearC" # Encryption key +BACKUP_SOURCES=( + "/home/liph/Downloads/" + "/home/liph/dotfiles/" + "/home/liph/scripts" +) # What to back up +BACKUP_NAME="laptop-$(date +%Y-%m-%d)" # Dynamic backup name + +# some helpers and error handling: +info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } +trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM + +info "Starting backup" + +# Initialize Borg repo (if not exists) +borg init --encryption=repokey "$BORG_REPO" 2>/dev/null || true + +# Backup the most important directories into an archive named after +# the machine this script is currently running on: + +borg create \ + --verbose \ + --filter AME \ + --list \ + --stats \ + --show-rc \ + --progress \ + --compression lz4 \ + --exclude-caches \ + --exclude 'home/*/.cache/*' \ + --exclude 'var/tmp/*' \ + "$BORG_REPO::$BACKUP_NAME" \ + "${BACKUP_SOURCES[@]}" \ +# ::'{hostname}-{user}-{now}' \ +# /home/liph/Documents/ \ +# /home/liph/Pictures/ \ +# /home/liph/Downloads/ +# /etc \ +# /home \ +# /root \ +# /var +backup_exit=$? + +info "Pruning repository" + +# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly +# archives of THIS machine. The '{hostname}-*' matching is very important to +# limit prune's operation to this machine's archives and not apply to +# other machines' archives also: + +borg prune \ + --list \ + --glob-archives '{hostname}-*' \ + --show-rc \ + --keep-daily 7 \ + --keep-weekly 4 \ + --keep-monthly 6 + "$BORG_REPO" + +prune_exit=$? + +# actually free repo disk space by compacting segments + +info "Compacting repository" + +borg compact + +compact_exit=$? + +# use highest exit code as global exit code +global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit )) +global_exit=$(( compact_exit > global_exit ? compact_exit : global_exit )) + +if [ ${global_exit} -eq 0 ]; then + info "Backup, Prune, and Compact finished successfully" +elif [ ${global_exit} -eq 1 ]; then + info "Backup, Prune, and/or Compact finished with warnings" +else + info "Backup, Prune, and/or Compact finished with errors" +fi + +exit ${global_exit} + +# Check backup integrity +borg check "$BORG_REPO" diff --git a/scripts/scripts/borg-server.sh b/scripts/scripts/borg-server.sh new file mode 100755 index 0000000..7b623ff --- /dev/null +++ b/scripts/scripts/borg-server.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# Setting this, so the repo does not need to be given on the commandline: +# export BORG_REPO=ssh://username@example.com:2022/~/backup/main +#export BORG_REPO=~/backup/ + +# See the section "Passphrase notes" for more infos. +#export BORG_PASSPHRASE='1ChagearC' + +export BORG_REPO="ssh://100.121.203.110:2222/./repo/borg-repo" +export BORG_PASSPHRASE="1ChagearC" # Encryption key +BACKUP_SOURCES=( + "/home/liph/Documents" + "/home/liph/Pictures" + "/home/liph/scripts" +) # What to back up +BACKUP_NAME="server-$(date +%Y-%m-%d)" # Dynamic backup name + +# some helpers and error handling: +info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } +trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM + +info "Starting backup" + +# Initialize Borg repo (if not exists) +borg init --encryption=repokey "$BORG_REPO" 2>/dev/null || true + +# Backup the most important directories into an archive named after +# the machine this script is currently running on: + +borg create \ + --verbose \ + --filter AME \ + --list \ + --stats \ + --show-rc \ + --progress \ + --compression lz4 \ + --exclude-caches \ + --exclude 'home/*/.cache/*' \ + --exclude 'var/tmp/*' \ + "$BORG_REPO::$BACKUP_NAME" \ + "${BACKUP_SOURCES[@]}" \ +# ::'{hostname}-{user}-{now}' \ +# /home/liph/Documents/ \ +# /home/liph/Pictures/ \ +# /home/liph/Downloads/ +# /etc \ +# /home \ +# /root \ +# /var +backup_exit=$? + +info "Pruning repository" + +# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly +# archives of THIS machine. The '{hostname}-*' matching is very important to +# limit prune's operation to this machine's archives and not apply to +# other machines' archives also: + +borg prune \ + --list \ + --glob-archives '{hostname}-*' \ + --show-rc \ + --keep-daily 7 \ + --keep-weekly 4 \ + --keep-monthly 6 + "$BORG_REPO" + +prune_exit=$? + +# actually free repo disk space by compacting segments + +info "Compacting repository" + +borg compact + +compact_exit=$? + +# use highest exit code as global exit code +global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit )) +global_exit=$(( compact_exit > global_exit ? compact_exit : global_exit )) + +if [ ${global_exit} -eq 0 ]; then + info "Backup, Prune, and Compact finished successfully" +elif [ ${global_exit} -eq 1 ]; then + info "Backup, Prune, and/or Compact finished with warnings" +else + info "Backup, Prune, and/or Compact finished with errors" +fi + +exit ${global_exit} + +# Check backup integrity +borg check "$BORG_REPO" diff --git a/scripts/scripts/borg.sh b/scripts/scripts/borg.sh new file mode 100755 index 0000000..b6ea062 --- /dev/null +++ b/scripts/scripts/borg.sh @@ -0,0 +1,95 @@ +#!/bin/sh + +# Setting this, so the repo does not need to be given on the commandline: +# export BORG_REPO=ssh://username@example.com:2022/~/backup/main +#export BORG_REPO=~/backup/ + +# See the section "Passphrase notes" for more infos. +#export BORG_PASSPHRASE='1ChagearC' + +export BORG_REPO="ssh://100.121.203.110:2222/./repo/borg-repo" +export BORG_PASSPHRASE="1ChagearC" # Encryption key +BACKUP_SOURCES=( + "/home/liph/Documents" + "/home/liph/Pictures" + "/home/liph/scripts" +) # What to back up +BACKUP_NAME="laptop-$(date +%Y-%m-%d)" # Dynamic backup name + +# some helpers and error handling: +info() { printf "\n%s %s\n\n" "$( date )" "$*" >&2; } +trap 'echo $( date ) Backup interrupted >&2; exit 2' INT TERM + +info "Starting backup" + +# Initialize Borg repo (if not exists) +borg init --encryption=repokey "$BORG_REPO" 2>/dev/null || true + +# Backup the most important directories into an archive named after +# the machine this script is currently running on: + +borg create \ + --verbose \ + --filter AME \ + --list \ + --stats \ + --show-rc \ + --progress \ + --compression lz4 \ + --exclude-caches \ + --exclude 'home/*/.cache/*' \ + --exclude 'var/tmp/*' \ + "$BORG_REPO::$BACKUP_NAME" \ + "${BACKUP_SOURCES[@]}" \ +# ::'{hostname}-{user}-{now}' \ +# /home/liph/Documents/ \ +# /home/liph/Pictures/ \ +# /home/liph/Downloads/ +# /etc \ +# /home \ +# /root \ +# /var +backup_exit=$? + +info "Pruning repository" + +# Use the `prune` subcommand to maintain 7 daily, 4 weekly and 6 monthly +# archives of THIS machine. The '{hostname}-*' matching is very important to +# limit prune's operation to this machine's archives and not apply to +# other machines' archives also: + +borg prune \ + --list \ + --glob-archives '{hostname}-*' \ + --show-rc \ + --keep-daily 7 \ + --keep-weekly 4 \ + --keep-monthly 6 + "$BORG_REPO" + +prune_exit=$? + +# actually free repo disk space by compacting segments + +info "Compacting repository" + +borg compact + +compact_exit=$? + +# use highest exit code as global exit code +global_exit=$(( backup_exit > prune_exit ? backup_exit : prune_exit )) +global_exit=$(( compact_exit > global_exit ? compact_exit : global_exit )) + +if [ ${global_exit} -eq 0 ]; then + info "Backup, Prune, and Compact finished successfully" +elif [ ${global_exit} -eq 1 ]; then + info "Backup, Prune, and/or Compact finished with warnings" +else + info "Backup, Prune, and/or Compact finished with errors" +fi + +exit ${global_exit} + +# Check backup integrity +borg check "$BORG_REPO" diff --git a/scripts/scripts/fzf-git.sh b/scripts/scripts/fzf-git.sh new file mode 100755 index 0000000..d360751 --- /dev/null +++ b/scripts/scripts/fzf-git.sh @@ -0,0 +1,310 @@ +# Fzf with Git in the shell +# You can find this whole script from Junegunn Github repo below +# https://github.com/junegunn/fzf-git.sh + +# Script is used in .zshrc + +# shellcheck disable=SC2039 +[[ $0 = - ]] && return + +__fzf_git_color() { + if [[ -n $NO_COLOR ]]; then + echo never + elif [[ $# -gt 0 ]] && [[ -n $FZF_GIT_PREVIEW_COLOR ]]; then + echo "$FZF_GIT_PREVIEW_COLOR" + else + echo "${FZF_GIT_COLOR:-always}" + fi +} + +__fzf_git_cat() { + if [[ -n $FZF_GIT_CAT ]]; then + echo "$FZF_GIT_CAT" + return + fi + + # Sometimes bat is installed as batcat + _fzf_git_bat_options="--style='${BAT_STYLE:-full}' --color=$(__fzf_git_color .) --pager=never" + if command -v batcat > /dev/null; then + echo "batcat $_fzf_git_bat_options" + elif command -v bat > /dev/null; then + echo "bat $_fzf_git_bat_options" + else + echo cat + fi +} + +if [[ $# -eq 1 ]]; then + branches() { + git branch "$@" --sort=-committerdate --sort=-HEAD --format=$'%(HEAD) %(color:yellow)%(refname:short) %(color:green)(%(committerdate:relative))\t%(color:blue)%(subject)%(color:reset)' --color=$(__fzf_git_color) | column -ts$'\t' + } + refs() { + git for-each-ref --sort=-creatordate --sort=-HEAD --color=$(__fzf_git_color) --format=$'%(refname) %(color:green)(%(creatordate:relative))\t%(color:blue)%(subject)%(color:reset)' | + eval "$1" | + sed 's#^refs/remotes/#\x1b[95mremote-branch\t\x1b[33m#; s#^refs/heads/#\x1b[92mbranch\t\x1b[33m#; s#^refs/tags/#\x1b[96mtag\t\x1b[33m#; s#refs/stash#\x1b[91mstash\t\x1b[33mrefs/stash#' | + column -ts$'\t' + } + hashes() { + git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=$(__fzf_git_color) "$@" + } + case "$1" in + branches) + echo $'CTRL-O (open in browser) ╱ ALT-A (show all branches)\n' + branches + ;; + all-branches) + echo $'CTRL-O (open in browser)\n' + branches -a + ;; + hashes) + echo $'CTRL-O (open in browser) ╱ CTRL-D (diff)\nCTRL-S (toggle sort) ╱ ALT-A (show all hashes)\n' + hashes + ;; + all-hashes) + echo $'CTRL-O (open in browser) ╱ CTRL-D (diff)\nCTRL-S (toggle sort)\n' + hashes --all + ;; + refs) + echo $'CTRL-O (open in browser) ╱ ALT-E (examine in editor) ╱ ALT-A (show all refs)\n' + refs 'grep -v ^refs/remotes' + ;; + all-refs) + echo $'CTRL-O (open in browser) ╱ ALT-E (examine in editor)\n' + refs 'cat' + ;; + nobeep) ;; + *) exit 1 ;; + esac +elif [[ $# -gt 1 ]]; then + set -e + + branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null) + if [[ $branch = HEAD ]]; then + branch=$(git describe --exact-match --tags 2> /dev/null || git rev-parse --short HEAD) + fi + + # Only supports GitHub for now + case "$1" in + commit) + hash=$(grep -o "[a-f0-9]\{7,\}" <<< "$2") + path=/commit/$hash + ;; + branch|remote-branch) + branch=$(sed 's/^[* ]*//' <<< "$2" | cut -d' ' -f1) + remote=$(git config branch."${branch}".remote || echo 'origin') + branch=${branch#$remote/} + path=/tree/$branch + ;; + remote) + remote=$2 + path=/tree/$branch + ;; + file) path=/blob/$branch/$(git rev-parse --show-prefix)$2 ;; + tag) path=/releases/tag/$2 ;; + *) exit 1 ;; + esac + + remote=${remote:-$(git config branch."${branch}".remote || echo 'origin')} + remote_url=$(git remote get-url "$remote" 2> /dev/null || echo "$remote") + + if [[ $remote_url =~ ^git@ ]]; then + url=${remote_url%.git} + url=${url#git@} + url=https://${url/://} + elif [[ $remote_url =~ ^http ]]; then + url=${remote_url%.git} + fi + + case "$(uname -s)" in + Darwin) open "$url$path" ;; + *) xdg-open "$url$path" ;; + esac + exit 0 +fi + +if [[ $- =~ i ]]; then +# ----------------------------------------------------------------------------- + +# Redefine this function to change the options +_fzf_git_fzf() { + fzf-tmux -p80%,60% -- \ + --layout=reverse --multi --height=50% --min-height=20 --border \ + --border-label-pos=2 \ + --color='header:italic:underline,label:blue' \ + --preview-window='right,50%,border-left' \ + --bind='ctrl-/:change-preview-window(down,50%,border-top|hidden|)' "$@" +} + +_fzf_git_check() { + git rev-parse HEAD > /dev/null 2>&1 && return + + [[ -n $TMUX ]] && tmux display-message "Not in a git repository" + return 1 +} + +__fzf_git=${BASH_SOURCE[0]:-${(%):-%x}} +__fzf_git=$(readlink -f "$__fzf_git" 2> /dev/null || /usr/bin/ruby --disable-gems -e 'puts File.expand_path(ARGV.first)' "$__fzf_git" 2> /dev/null) + +_fzf_git_files() { + _fzf_git_check || return + local root query + root=$(git rev-parse --show-toplevel) + [[ $root != "$PWD" ]] && query='!../ ' + + (git -c color.status=$(__fzf_git_color) status --short --no-branch + git ls-files "$root" | grep -vxFf <(git status -s | grep '^[^?]' | cut -c4-; echo :) | sed 's/^/ /') | + _fzf_git_fzf -m --ansi --nth 2..,.. \ + --border-label '📁 Files' \ + --header $'CTRL-O (open in browser) ╱ ALT-E (open in editor)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git file {-1}" \ + --bind "alt-e:execute:${EDITOR:-vim} {-1} > /dev/tty" \ + --query "$query" \ + --preview "git diff --no-ext-diff --color=$(__fzf_git_color .) -- {-1} | sed 1,4d; $(__fzf_git_cat) {-1}" "$@" | + cut -c4- | sed 's/.* -> //' +} + +_fzf_git_branches() { + _fzf_git_check || return + bash "$__fzf_git" branches | + _fzf_git_fzf --ansi \ + --border-label '🌲 Branches' \ + --header-lines 2 \ + --tiebreak begin \ + --preview-window down,border-top,40% \ + --color hl:underline,hl+:underline \ + --no-hscroll \ + --bind 'ctrl-/:change-preview-window(down,70%|hidden|)' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git branch {}" \ + --bind "alt-a:change-border-label(🌳 All branches)+reload:bash \"$__fzf_git\" all-branches" \ + --preview "git log --oneline --graph --date=short --color=$(__fzf_git_color .) --pretty='format:%C(auto)%cd %h%d %s' \$(sed s/^..// <<< {} | cut -d' ' -f1) --" "$@" | + sed 's/^..//' | cut -d' ' -f1 +} + +_fzf_git_tags() { + _fzf_git_check || return + git tag --sort -version:refname | + _fzf_git_fzf --preview-window right,70% \ + --border-label '📛 Tags' \ + --header $'CTRL-O (open in browser)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git tag {}" \ + --preview "git show --color=$(__fzf_git_color .) {}" "$@" +} + +_fzf_git_hashes() { + _fzf_git_check || return + bash "$__fzf_git" hashes | + _fzf_git_fzf --ansi --no-sort --bind 'ctrl-s:toggle-sort' \ + --border-label '🍡 Hashes' \ + --header-lines 3 \ + --bind "ctrl-o:execute-silent:bash $__fzf_git commit {}" \ + --bind "ctrl-d:execute:grep -o '[a-f0-9]\{7,\}' <<< {} | head -n 1 | xargs git diff --color=$(__fzf_git_color) > /dev/tty" \ + --bind "alt-a:change-border-label(🍇 All hashes)+reload:bash \"$__fzf_git\" all-hashes" \ + --color hl:underline,hl+:underline \ + --preview "grep -o '[a-f0-9]\{7,\}' <<< {} | head -n 1 | xargs git show --color=$(__fzf_git_color .)" "$@" | + awk 'match($0, /[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]*/) { print substr($0, RSTART, RLENGTH) }' +} + +_fzf_git_remotes() { + _fzf_git_check || return + git remote -v | awk '{print $1 "\t" $2}' | uniq | + _fzf_git_fzf --tac \ + --border-label '📡 Remotes' \ + --header $'CTRL-O (open in browser)\n\n' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git remote {1}" \ + --preview-window right,70% \ + --preview "git log --oneline --graph --date=short --color=$(__fzf_git_color .) --pretty='format:%C(auto)%cd %h%d %s' '{1}/$(git rev-parse --abbrev-ref HEAD)' --" "$@" | + cut -d$'\t' -f1 +} + +_fzf_git_stashes() { + _fzf_git_check || return + git stash list | _fzf_git_fzf \ + --border-label '🥡 Stashes' \ + --header $'CTRL-X (drop stash)\n\n' \ + --bind 'ctrl-x:reload(git stash drop -q {1}; git stash list)' \ + -d: --preview "git show --color=$(__fzf_git_color .) {1}" "$@" | + cut -d: -f1 +} + +_fzf_git_lreflogs() { + _fzf_git_check || return + git reflog --color=$(__fzf_git_color) --format="%C(blue)%gD %C(yellow)%h%C(auto)%d %gs" | _fzf_git_fzf --ansi \ + --border-label '📒 Reflogs' \ + --preview "git show --color=$(__fzf_git_color .) {1}" "$@" | + awk '{print $1}' +} + +_fzf_git_each_ref() { + _fzf_git_check || return + bash "$__fzf_git" refs | _fzf_git_fzf --ansi \ + --nth 2,2.. \ + --tiebreak begin \ + --border-label '☘️ Each ref' \ + --header-lines 2 \ + --preview-window down,border-top,40% \ + --color hl:underline,hl+:underline \ + --no-hscroll \ + --bind 'ctrl-/:change-preview-window(down,70%|hidden|)' \ + --bind "ctrl-o:execute-silent:bash $__fzf_git {1} {2}" \ + --bind "alt-e:execute:${EDITOR:-vim} <(git show {2}) > /dev/tty" \ + --bind "alt-a:change-border-label(🍀 Every ref)+reload:bash \"$__fzf_git\" all-refs" \ + --preview "git log --oneline --graph --date=short --color=$(__fzf_git_color .) --pretty='format:%C(auto)%cd %h%d %s' {2} --" "$@" | + awk '{print $2}' +} + +_fzf_git_worktrees() { + _fzf_git_check || return + git worktree list | _fzf_git_fzf \ + --border-label '🌴 Worktrees' \ + --header $'CTRL-X (remove worktree)\n\n' \ + --bind 'ctrl-x:reload(git worktree remove {1} > /dev/null; git worktree list)' \ + --preview " + git -c color.status=$(__fzf_git_color .) -C {1} status --short --branch + echo + git log --oneline --graph --date=short --color=$(__fzf_git_color .) --pretty='format:%C(auto)%cd %h%d %s' {2} -- + " "$@" | + awk '{print $1}' +} + +if [[ -n "${BASH_VERSION:-}" ]]; then + __fzf_git_init() { + bind -m emacs-standard '"\er": redraw-current-line' + bind -m emacs-standard '"\C-z": vi-editing-mode' + bind -m vi-command '"\C-z": emacs-editing-mode' + bind -m vi-insert '"\C-z": emacs-editing-mode' + + local o c + for o in "$@"; do + c=${o:0:1} + bind -m emacs-standard '"\C-g\C-'$c'": " \C-u \C-a\C-k`_fzf_git_'$o'`\e\C-e\C-y\C-a\C-y\ey\C-h\C-e\er \C-h"' + bind -m vi-command '"\C-g\C-'$c'": "\C-z\C-g\C-'$c'\C-z"' + bind -m vi-insert '"\C-g\C-'$c'": "\C-z\C-g\C-'$c'\C-z"' + bind -m emacs-standard '"\C-g'$c'": " \C-u \C-a\C-k`_fzf_git_'$o'`\e\C-e\C-y\C-a\C-y\ey\C-h\C-e\er \C-h"' + bind -m vi-command '"\C-g'$c'": "\C-z\C-g'$c'\C-z"' + bind -m vi-insert '"\C-g'$c'": "\C-z\C-g'$c'\C-z"' + done + } +elif [[ -n "${ZSH_VERSION:-}" ]]; then + __fzf_git_join() { + local item + while read item; do + echo -n "${(q)item} " + done + } + + __fzf_git_init() { + local m o + for o in "$@"; do + eval "fzf-git-$o-widget() { local result=\$(_fzf_git_$o | __fzf_git_join); zle reset-prompt; LBUFFER+=\$result }" + eval "zle -N fzf-git-$o-widget" + for m in emacs vicmd viins; do + eval "bindkey -M $m '^g^${o[1]}' fzf-git-$o-widget" + eval "bindkey -M $m '^g${o[1]}' fzf-git-$o-widget" + done + done + } +fi +__fzf_git_init files branches tags remotes hashes stashes lreflogs each_ref worktrees + +# ----------------------------------------------------------------------------- +fi diff --git a/scripts/scripts/fzf_listoldfiles.sh b/scripts/scripts/fzf_listoldfiles.sh new file mode 100755 index 0000000..0b5ffed --- /dev/null +++ b/scripts/scripts/fzf_listoldfiles.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Script to list recent files and open nvim using fzf +# set to an alias nlof in .zshrc + +list_oldfiles() { + # Get the oldfiles list from Neovim + local oldfiles=($(nvim -u NONE --headless +'lua io.write(table.concat(vim.v.oldfiles, "\n") .. "\n")' +qa)) + # Filter invalid paths or files not found + local valid_files=() + for file in "${oldfiles[@]}"; do + if [[ -f "$file" ]]; then + valid_files+=("$file") + fi + done + # Use fzf to select from valid files + local files=($(printf "%s\n" "${valid_files[@]}" | \ + grep -v '\[.*' | \ + fzf --multi \ + --preview 'bat -n --color=always --line-range=:500 {} 2>/dev/null || echo "Error previewing file"' \ + --height=70% \ + --layout=default)) + + # Open selected files in Neovim + [[ ${#files[@]} -gt 0 ]] && nvim "${files[@]}" +} + +# Call the function +list_oldfiles "$@" diff --git a/scripts/scripts/hydroxide.sh b/scripts/scripts/hydroxide.sh new file mode 100755 index 0000000..ca485e1 --- /dev/null +++ b/scripts/scripts/hydroxide.sh @@ -0,0 +1,2 @@ +hydroxide imap & +hydroxide smtp & diff --git a/scripts/scripts/protonport.sh b/scripts/scripts/protonport.sh new file mode 100755 index 0000000..7f0d864 --- /dev/null +++ b/scripts/scripts/protonport.sh @@ -0,0 +1,89 @@ +#!/bin/bash + +# Configuration variables - change this for your setup +gluetun_container_name="gluetun" +qbittorrent_container_name="qbittorrent" +gluetun_origin="http://100.120.152.94:8888" +qb_origin="http://100.120.152.94:8099" +#################################################################### + +# Arrays for URLs +declare -A gluetun_urls=( + ["pub_ip"]="$gluetun_origin/v1/publicip/ip" + ["portforwarded"]="$gluetun_origin/v1/openvpn/portforwarded" +) + +declare -A qbittorrent_urls=( + #used for getting and setting listen_port + ["prefs"]="$qb_origin/api/v2/app/preferences" + ["setPrefs"]="$qb_origin/api/v2/app/setPreferences" +) + + +# Function to check if a Docker container is running +is_container_running() { + local container_name="$1" + docker inspect -f '{{.State.Running}}' "$container_name" 2>/dev/null + # echo "Container $container_name status: $status" +} + +get_vpn_external_ip() { + local url="$1" + curl -s "$url" | -r .'public_ip' +} + +# Function to send a GET request and extract the port from the response +get_port_from_url() { + local url="$1" + local port_key + + # Try 'port' key first + port_key=$(curl -s "$url" | jq -r '.port') + + if [ "$port_key" == "null" ]; then + # If 'port' key is null, try 'listen_port' key + port_key=$(curl -s "$url" | jq -r '.listen_port') + fi + + echo "$port_key" +} + +# Function to send a POST request with JSON data +send_post_request() { + local url="$1" + local port="$2" + curl -s -X POST -d json={\"listen_port\":$port} "$url" +} + +# Outputs container names +echo "Gluetun container name: $gluetun_container_name - Gluetun Origin URL: $gluetun_origin" +echo "qBittorrent container name: $qbittorrent_container_name - qBittorrent Origin URL: $qb_origin" + +# Check if both containers are running +if [[ $(is_container_running "$gluetun_container_name") == $(is_container_running "$qbittorrent_container_name") ]]; then + echo "Both Gluetun and qBittorrent containers are running. Continuing." + + external_ip=$(get_vpn_external_ip "${gluetun_urls["pub_ip"]}") + if [ -z "$external_ip" ]; then + echo "External IP is empty. Exiting script due to potential VPN or internet connection issue." + exit 1 + else + echo "External IP is $external_ip therefore VPN is up" + fi + + gluetun_port=$(get_port_from_url "${gluetun_urls["portforwarded"]}") + qbittorrent_port=$(get_port_from_url "${qbittorrent_urls["prefs"]}") + + echo "Gluetun forwarded port is $gluetun_port" + echo "qBittorrent listen port is $qbittorrent_port" + if [ "$gluetun_port" -eq "$qbittorrent_port" ]; then + echo "qBittorrent listen port is already set to $qbittorrent_port. No need to change. Exiting script." + else + echo "Updating qBittorrent listen port to Gluetun forwarded port $gluetun_port." + send_post_request "${qbittorrent_urls["setPrefs"]}" "$gluetun_port" + qbittorrent_port=$(get_port_from_url "${qbittorrent_urls["prefs"]}") + echo "qBittorrent listen port updated to $qbittorrent_port. Exiting script." + fi +else + echo "Either Gluetun or qBittorrent container is not running. Exiting script." +fi diff --git a/scripts/scripts/tmux-sessionizer.sh b/scripts/scripts/tmux-sessionizer.sh new file mode 100755 index 0000000..e89f2fb --- /dev/null +++ b/scripts/scripts/tmux-sessionizer.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# Save this file as ~/scripts/tmux-sessionizer +# Make it executable with: chmod +x ~/.local/bin/tmux-sessionizer + +if [[ $# -eq 1 ]]; then + selected=$1 +else + selected=$(fd -H . ~/dotfiles ~/Desktop/main-cs ~/Desktop/main-cs/Projects ~/ ~/Desktop/work ~/Desktop/work/youtube -t d -d 1 | fzf) +fi + +if [[ -z $selected ]]; then + exit 0 +fi + +selected_name=$(basename "$selected" | tr . _) +tmux_running=$(pgrep tmux) + +if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then + tmux new-session -s $selected_name -c $selected + exit 0 +fi + +if ! tmux has-session -t=$selected_name 2> /dev/null; then + tmux new-session -ds $selected_name -c $selected +fi + +tmux switch-client -t $selected_name diff --git a/scripts/scripts/zoxide_openfiles_nvim.sh b/scripts/scripts/zoxide_openfiles_nvim.sh new file mode 100755 index 0000000..3d177ed --- /dev/null +++ b/scripts/scripts/zoxide_openfiles_nvim.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Script to find every single file and opens in neovim +# alias set as nzo in .zshrc +search_with_zoxdie() { + if [ -z "$1" ]; then + # use fd with fzf to select & open a file when no arg are provided + file="$(fd --type f -I -H -E .git -E .git-crypt -E .cache -E .backup | fzf --height=70% --preview='bat -n --color=always --line-range :500 {}')" + if [ -n "$file" ]; then + nvim "$file" + fi + else + # Handle when an arg is provided + lines=$(zoxide query -l | xargs -I {} fd --type f -I -H -E .git -E .git-crypt -E .cache -E .backup -E .vscode "$1" {} | fzf --no-sort) # Initial filter attempt with fzf + line_count="$(echo "$lines" | wc -l | xargs)" # Trim any leading spaces + + if [ -n "$lines" ] && [ "$line_count" -eq 1 ]; then + # looks for the exact ones and opens it + file="$lines" + nvim "$file" + elif [ -n "$lines" ]; then + # If multiple files are found, allow further selection using fzf and bat for preview + file=$(echo "$lines" | fzf --query="$1" --height=70% --preview='bat -n --color=always --line-range :500 {}') + if [ -n "$file" ]; then + nvim "$file" + fi + else + echo "No matches found." >&2 + fi + fi +} + +search_with_zoxdie "$@" diff --git a/zshrc/.aliases.zsh b/zshrc/.aliases.zsh new file mode 100755 index 0000000..5b4cbf8 --- /dev/null +++ b/zshrc/.aliases.zsh @@ -0,0 +1,174 @@ + +alias nt='/mnt/ssd1/scripts/nothumb.sh' +alias nn='/mnt/ssd1/scripts/nonum.sh' +alias rt='/mnt/ssd1/scripts/retag.sh' +alias ea='/mnt/ssd1/scripts/extraudio.sh' +alias dd='/mnt/ssd1/scripts/m3u8.sh' + + +# podmand +alias pops='sudo podman ps' +alias pos='sudo podman start' +alias post='sudo podman stop' +alias poc='sudo podman-compose up -d' +alias pocp='sudo podman-compose pull' +alias pocf='sudo podman-compose up -d --force-recreate' +alias pocst='sudo podman-compose stop' +alias pocs='sudo podman-compose start' +alias pocrs='sudo podman-compose restart' +alias porm='sudo podman rm' +alias pormf='sudo podman rm -f' +alias pormi='sudo podman rmi' +alias pors='sudo podman restart' +alias pol='sudo podman logs' +alias poi='sudo podman images' +alias pocd='sudo podman-compose down' +alias pocdf='pocd && pocf' +alias pocup='pocp && poc' +alias pocupf='pocp && pocf' +alias pocdupd='pocst && pocd && pocp && poc' + + +alias cl='clear' +alias cld='clear && cd' +alias neo='neofetch' +alias f='fuck' +alias soz='source ~/.zshrc' +alias rmm='sudo rm -R' +alias mc='musikcube' +alias mat='tldr' + +# 8 commandlinetools zoxide_openfiles_nvim +alias nzo="~/scripts/zoxide_openfiles_nvim.sh" +alias rebo='sudo grub-mkconfig -o /boot/grub/grub.cfg; reboot' +alias shut='sudo grub-mkconfig -o /boot/grub/grub.cfg; shutdown now' +alias grubb='sudo grub-mkconfig -o /boot/grub/grub.cfg' + +# called from ~/scrtipts/ +alias nlof="~/scripts/fzf_listoldfiles.sh" +# alias fman="compgen -c | fzf | xargs man" + +# tmux +alias ta='tmux attach' +alias tn='tmux new' +alias tns='~/scripts/tmux-sessionizer.sh' + +# eza +alias lt='eza --tree --level=1 --long --icons --git' +alias ltt='eza --tree --level=2 --long --icons --git' +alias lttt='eza --tree --level=3 --long --icons --git' +alias ltre='eza --tree --level=1 --icons --git' +alias ltree='eza --tree --level=2 --icons --git' +alias ltreee='eza --tree --level=3 --icons --git' +#alias ls='eza --color=always --long --git --no-time --icons=always --no-user --no-permissions' + +# mirrorlist +alias mbak='sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak' +alias mlist='sudo reflector --verbose --latest 10 --age 1 --download-timeout 20 --protocol https --sort rate --save /etc/pacman.d/mirrorlist' + +# git commands +# alias gad='git add' +# alias gaf='git add *' +# alias gco='git commit -m' +# alias gp='git push' +# alias gcc='git clone' +alias lgit='lazygit' + +# proton vpn +alias vpnn='sudo protonvpn c' +alias vpnr='sudo protonvpn reconnect' # reconnect after sleep +alias vpn='sudo protonvpn c -f' # connect to fastest server +alias vpnd='sudo protonvpn d' # diconnect current session +alias vpnp='sudo protonvpn c --p2p' # connect to fastest p2p server +alias vpns='protonvpn status' # check status + +# NetworkManager +alias nmwi='nmcli device wifi list' # show you all possible wifi networks +alias nmst='nmcli device status' # shows you the current connection +alias nmco='nmcli device wifi connect' # add '$SSID' and '$PASSWORD' +alias nmsh='nmcli con show' # shows all valid connnections +alias nmup='nmcli con up' # add the name of the connection in '' +alias nmdo='nmcli con down' # add the nome of the connection in '' + +# open with password +alias tshift='sudo -E timeshift-launcher' +alias part='sudo -E gparted' + +# mtp mount (android etc) +alias mtpd='mtp-detect' +alias mtpm='jmtpfs ~/android_device' +alias mtpu='fusermount -u ~/android_device' + +# mount not android +alias lsb='lsblk' +alias lsd='sudo mkdir /mount/' +alias lsm='sudo mount /dev/' +alias lsu='sudo umount /mount/' + +# streamrip +alias ripp='rip search tidal album' + +# paru +alias ys='paru -S' # install package +alias yr='paru -Rn' # remove package +alias yy='paru -Ss' # paru search for package + +# trash-cli +alias te='trash-empty' +alias tr='trash-restore' + +# pyenv +alias pyl='pyenv local' # set this for folder in spec python version +alias pyg='pyenv global' # changes the global python version +alias pyve='pyenv virtualenvs' # shows all possible vitualenvironments +alias pyd='pyenv virtualenv-delete' +alias pyn='pyenv virtualenv' # makes a new env $VSERION $NAME +alias pyv='pyenv versions' +alias pyil='pyenv install -l' +alias pyi='pyenv install' + +# aria2 and yt-dlp +alias aryt="yt-dlp --external-downloader aria2c --external-downloader-args '-x 8 -j2'" # add URL in '' +alias aria='aria2c -x 8' # add URL in '' for 8 segmented download +alias yd='yt-dlp' # copy link from videodownload helper and add the URL in '' + +# ffmpeg +alias ffcmp='ffmpeg -i video.mp4 -q:a 0 -map a audio.mp3' # convert on mp4 into mp3 +alias ffcbmp='for file in *.mp4; do + ffmpeg -i "$file" -q:a 0 -map a "${file%.mp4}.mp3" +done' # batch rename all mp4 into mp3 add -af "volume=1.5" to increase audio volume by 1.5 +alias photodetect='gphoto2 --auto-detect' +alias photoget='gphoto2 --get-all-files' + +# borg backup +alias boinit='borg init --encryption repokey' # add folder like /folder/ initiates the backupfunction +alias bolist='borg list' # /backup/ creates a list of al the backups which are contained in this folder +alias boc='borg create --stats --progress --compression lz4' # /backup::backup1 dotfiles creates the backup. The ::backup1 will be name of the backup +# create placeholder sudo borg create --stats --compression lz4 ::{user}-{now} file or folder +alias bomo='borg mount /home/liph/backup /tmp/borg' # which repo to mount and where to mount it. make sure the folder already exists +alias boumo='borg umount /tmp/borg' # unmount the mount folder + +# systemctl +alias sysen='sudo systemctl enable' +alias sysst='sudo systemctl start' + +# disk space +alias dfh='df -h' # shows a list of all mounted drives +alias duh='du -sh' #calculates folder space +alias duf='duf' # analyzes diskspace +alias duaa='dua i' # opens dua in interactive mode +alias rns='sudo pacman -Rns $(pacman -Qdtq)' # remove orphaned packages +alias rsc='sudo pacman -Sc' # remove cached packeged +alias rmc='rm -rf ~/.cache/*' # clear user cache + +# ip addr +alias ipa='sudo ip addr add ' +alias ipl='sudo ip link set ' +alias ipf='sudo ip addr flush ' + +# wireguard vpn +alias wgu='sudo wg-quick up' # start the connection you like to establish (f.E open) +alias wgd='sudo wg-quick down' # end the connection you like to end (f.E open) +alias wgc='sudo wg showconf' # show the config for a connection (f.E open) +alias wgs='sudo wg show' # show informations about the connection + diff --git a/zshrc/.export.zsh b/zshrc/.export.zsh new file mode 100755 index 0000000..6b462cf --- /dev/null +++ b/zshrc/.export.zsh @@ -0,0 +1,27 @@ +# FZF +export FZF_CTRL_T_OPTS="--preview 'bat -n --color=always --line-range :500 {}'" +export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'" +export FZF_DEFAULT_OPTS="--height 50% --layout=default --border --color=hl:#2dd4bf" +export FZF_TMUX_OPTS=" -p90%,70% " + +# FD +export FZF_DEFAULT_COMMAND="fd --hidden --strip-cwd-prefix --exclude .git" +export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND" +export FZF_ALT_C_COMMAND="fd --type=d --hidden --strip-cwd-prefix --exclude .g-t" +export FZF_DEFAULT_OPTS='--bind tab:accept' + +# temuxifier +export PATH="$HOME/.tmuxifier/bin:$PATH" + +# yazi setup +export EDITOR="nvim" + +# manpager +export MANPAGER='nvim +Man!' + +export XDG_CURRENT_DESKTOP=Hyprland +export XDG_SESSION_TYPE=wayland +export QT_QPA_PLATFORM=wayland +export SDL_VIDEODRIVER=wayland +export CLUTTER_BACKEND=wayland +export MOZ_ENABLE_WAYLAND=1 diff --git a/zshrc/.plugins.zsh b/zshrc/.plugins.zsh new file mode 100755 index 0000000..3ac2607 --- /dev/null +++ b/zshrc/.plugins.zsh @@ -0,0 +1,17 @@ +# Add in Powerline10k +#zinit ice depth=1; zinit light romkatv/powerlevel10k + +# Add in plugins +zinit light zsh-users/zsh-syntax-highlighting +zinit light zsh-users/zsh-completions +zinit light zsh-users/zsh-autosuggestions +zinit light Aloxaf/fzf-tab + +# Add in snippets from "OhMyZsh“ +zinit snippet OMZP::git +zinit snippet OMZP::sudo +zinit snippet OMZP::archlinux +zinit snippet OMZP::aws +zinit snippet OMZP::kubectl +zinit snippet OMZP::kubectx +zinit snippet OMZP::command-not-found diff --git a/zshrc/.zshrc b/zshrc/.zshrc new file mode 100755 index 0000000..4292080 --- /dev/null +++ b/zshrc/.zshrc @@ -0,0 +1,94 @@ + + +# set the directory we want to store zinit and plugins +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.locale/share}/zinit/zinit.git" + +# Download Zinit +if [ ! -d "$ZINIT_HOME" ]; then + mkdir -p "$(dirname $ZINIT_HOME)" + git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" +fi + +# Source zsh, alias +source "${ZINIT_HOME}/zinit.zsh" +source ~/.aliases.zsh +source ~/.plugins.zsh +source ~/.export.zsh +# Set up fzf key bindings and fuzzy completion +source <(fzf --zsh) + +# Load completions +autoload -U compinit && compinit + +## zinit cdreplay -q +eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/zen.toml)" + +#eval "$(ssh-agent -s)" +#if ! pgrep -u "$USER" ssh-agent > /dev/null; then +# ssh-agent > ~/.ssh-agent.env +#fi +#if [[ -z "$SSH_AUTH_SOCK" ]]; then +# source ~/.ssh-agent.env > /dev/null +#fi + + +# Bindkey +bindkey -e +bindkey '^p' history-search-backward +bindkey '^n' history-search-forward + +# History +HISTSIZE=5000 +HISTFILE=~/.zsh_history +SAVEHIST=$HISTSIZE +HISTDUP=erase +setopt appendhistory +setopt sharehistory +setopt hist_ignore_space +setopt hist_ignore_all_dups +setopt hist_save_no_dups +setopt hist_ignore_dups +setopt hist_find_no_dups + +# Completion styling +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' +zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" +zstyle ':completion:*' menu no +zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls --color $realpath' + +# Shell integration +eval "$(fzf --zsh)" +eval "$(zoxide init --cmd cd zsh)" + +_fzf_comprun() { + local command=$1 + shift + + case "$command" in + cd) fzf --preview 'eza --tree --color=always {} | head -200' "$@" ;; + export|unset) fzf --preview "eval 'echo \$' {}" "$@" ;; + ssh) fzf --preview 'dig {}' "$@" ;; + *) fzf --preview "--preview 'bat -n --color=always --line-range :10 {}'" "$@" ;; + esac +} + +function y() { + local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd + yazi "$@" --cwd-file="$tmp" + if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then + builtin cd -- "$cwd" + fi + rm -f -- "$tmp" +} + +# Load a few important annexes, without Turbo +# (this is currently required for annexes) +zinit light-mode for \ + zdharma-continuum/zinit-annex-as-monitor \ + zdharma-continuum/zinit-annex-bin-gem-node \ + zdharma-continuum/zinit-annex-patch-dl \ + zdharma-continuum/zinit-annex-rust + +### End of Zinit's installer chunk + +# . "$HOME/.local/bin/env"