diff options
Diffstat (limited to 'nixpkgs')
| -rwxr-xr-x | nixpkgs/.config/nixpkgs/common/bg.sh | 21 | ||||
| -rw-r--r-- | nixpkgs/.config/nixpkgs/common/dwl_4/config.h | 7 | ||||
| -rw-r--r-- | nixpkgs/.config/nixpkgs/common/nvim/init.vim | 39 | ||||
| -rw-r--r-- | nixpkgs/.config/nixpkgs/common/nvim/plugins/indent-blankline.lua | 5 | ||||
| -rw-r--r-- | nixpkgs/.config/nixpkgs/common/nvim/plugins/leap.lua | 1 | ||||
| -rw-r--r-- | nixpkgs/.config/nixpkgs/common/nvim/plugins/lspconfig.lua | 145 | ||||
| -rw-r--r-- | nixpkgs/.config/nixpkgs/common/nvim/plugins/lualine.lua | 1 | ||||
| -rw-r--r-- | nixpkgs/.config/nixpkgs/common/nvim/plugins/telescope.lua | 16 | ||||
| -rw-r--r-- | nixpkgs/.config/nixpkgs/common/nvim/plugins/trouble.lua | 3 | ||||
| -rwxr-xr-x | nixpkgs/.config/nixpkgs/common/start.sh | 2 | ||||
| -rw-r--r-- | nixpkgs/.config/nixpkgs/flake.lock | 36 | ||||
| -rw-r--r-- | nixpkgs/.config/nixpkgs/per-user/kdam0-work/home.nix | 161 |
12 files changed, 386 insertions, 51 deletions
diff --git a/nixpkgs/.config/nixpkgs/common/bg.sh b/nixpkgs/.config/nixpkgs/common/bg.sh index 9bcefa6..036d2da 100755 --- a/nixpkgs/.config/nixpkgs/common/bg.sh +++ b/nixpkgs/.config/nixpkgs/common/bg.sh @@ -1,12 +1,23 @@ #!/bin/sh +pkill wbg || echo "No wbg process was running." + WALLPAPERS_HOME=${1:-$HOME/pics/wallpapers} # Get a random image file from the dir. RAND_BG=$(find "$WALLPAPERS_HOME" -type f -name "*.jpeg" -o -name "*.jpg" -o -name "*.png" | shuf | head -n1) -# Set the image file as the background. -(command -v wbg > /dev/null || (echo "wbg is not installed." && exit 1) && \ - # else - notify-send "Set background." && wbg "${RAND_BG}" -) +# Store the chosen bg +cp -a ${RAND_BG} /tmp/bg + +WBG_PATH="$(command -v wbg || echo $HOME/.nix-profile/bin/wbg)" +echo "WBG is $WBG_PATH" + +if [[ ! -f "$WBG_PATH" ]]; then + ehco "WBG is not installed. Exiting." + exit 1 +else + # Set the image file as the background. + notify-send "Setting background." + "${WBG_PATH}" "${RAND_BG}" & +fi diff --git a/nixpkgs/.config/nixpkgs/common/dwl_4/config.h b/nixpkgs/.config/nixpkgs/common/dwl_4/config.h index d5107e2..b0ef901 100644 --- a/nixpkgs/.config/nixpkgs/common/dwl_4/config.h +++ b/nixpkgs/.config/nixpkgs/common/dwl_4/config.h @@ -115,12 +115,12 @@ static const char *volup[] = { "amixer", "set", "Master", "10%+", NULL }; static const char *brightdown[] = { "light", "-U", "10", NULL }; static const char *brightup[] = { "light", "-A", "10", NULL }; static const char *hibernatecmd[] = { "systemctl", "hibernate", NULL }; -static const char *lockcmd[] = { "waylock", NULL }; +static const char *lockcmd[] = { "swaylock", "-i", "/tmp/bg", NULL }; static const char scrotcmd[] = "slurp | \ grim -g - - | \ - wl-copy && \ + wl-copy --type image && \ notify-send 'Copied selection to clipboard!' && \ - wl-paste > $HOME/pics/$(date +'%Y-%m-%d-%H%M%S_grim.png')"; + wl-paste --type image > $HOME/pics/$(date +'%Y-%m-%d-%H%M%S_grim.png')"; static const Key keys[] = { /* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */ @@ -155,6 +155,7 @@ static const Key keys[] = { { 0, XKB_KEY_XF86MonBrightnessDown, spawn, {.v = brightdown} }, { 0, XKB_KEY_XF86MonBrightnessUp, spawn, {.v = brightup} }, { 0, XKB_KEY_Print, spawn, SHCMD(scrotcmd) }, + { 0, XKB_KEY_F1, spawn, SHCMD(scrotcmd) }, { MODKEY, XKB_KEY_Delete, spawn, {.v = lockcmd} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Delete, spawn, {.v = hibernatecmd} }, TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0), diff --git a/nixpkgs/.config/nixpkgs/common/nvim/init.vim b/nixpkgs/.config/nixpkgs/common/nvim/init.vim new file mode 100644 index 0000000..d733e83 --- /dev/null +++ b/nixpkgs/.config/nixpkgs/common/nvim/init.vim @@ -0,0 +1,39 @@ +nnoremap <SPACE> <Nop> +let mapleader = " " +colorscheme tokyonight-moon +set number relativenumber + +" Keymaps +" save +nmap <Leader>, :w<cr> +" exit to normal mode +inoremap jk <Esc> +" Toggle line chars view +noremap <Leader>l :set list!<CR> + +" Telescope Keymaps +map <Leader><Space> :Telescope find_files<CR> +map <Leader>/ :Telescope live_grep<CR> +map <Leader>g :Telescope git_files<CR> +map <Leader>: :Telescope command_history<CR> + +" Indent blocks in visual mode. +vnoremap K xkP`[V`] +vnoremap J xp`[V`] +vnoremap L >gv +vnoremap H <gv + +" Move beteween splits +map <C-j> <C-W>j +map <C-k> <C-W>k +map <C-h> <C-W>h +map <C-l> <C-W>l + +" Start n³ in the current buffers directory +let g:nnn#action = { + \ '<c-t>': 'tab split', + \ '<c-s>': 'split', + \ '<c-v>': 'vsplit' } +nnoremap <Leader>n :NnnPicker %:p:h<CR> + +autocmd BufRead,BufNewFile *.yaml set filetype=yaml.ansible diff --git a/nixpkgs/.config/nixpkgs/common/nvim/plugins/indent-blankline.lua b/nixpkgs/.config/nixpkgs/common/nvim/plugins/indent-blankline.lua new file mode 100644 index 0000000..425b8cf --- /dev/null +++ b/nixpkgs/.config/nixpkgs/common/nvim/plugins/indent-blankline.lua @@ -0,0 +1,5 @@ +vim.opt.listchars:append "eol:↴" + +require("indent_blankline").setup { + show_end_of_line = true, +} diff --git a/nixpkgs/.config/nixpkgs/common/nvim/plugins/leap.lua b/nixpkgs/.config/nixpkgs/common/nvim/plugins/leap.lua new file mode 100644 index 0000000..c0aeeef --- /dev/null +++ b/nixpkgs/.config/nixpkgs/common/nvim/plugins/leap.lua @@ -0,0 +1 @@ +require('leap').add_default_mappings() diff --git a/nixpkgs/.config/nixpkgs/common/nvim/plugins/lspconfig.lua b/nixpkgs/.config/nixpkgs/common/nvim/plugins/lspconfig.lua new file mode 100644 index 0000000..5fc6857 --- /dev/null +++ b/nixpkgs/.config/nixpkgs/common/nvim/plugins/lspconfig.lua @@ -0,0 +1,145 @@ +local servers = {'ansiblels', 'dockerls', 'pylsp', 'bashls', 'jsonls'} +require('nvim-autopairs').setup({ + disable_filetype = { "TelescopePrompt" , "vim" }, +}) +require("mason").setup() +require("mason-lspconfig").setup { + ensure_installed = servers +} +require("neoconf").setup() + +local cmp = require('cmp') +local cmp_nvim_lsp = require('cmp_nvim_lsp') +local cmp_autopairs = require('nvim-autopairs.completion.cmp') +local luasnip = require('luasnip') +local lspconfig = require('lspconfig') + +local capabilities = cmp_nvim_lsp.default_capabilities() + +local opts = { noremap=true, silent=true } +--vim.keymap.set('n', '<space>le', vim.diagnostic.open_float, opts) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) +--vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts) +vim.keymap.set("n", "<leader>xx", "<cmd>TroubleToggle<cr>", opts) +vim.keymap.set("n", "<leader>xw", "<cmd>TroubleToggle workspace_diagnostics<cr>", opts) +vim.keymap.set("n", "<leader>xe", "<cmd>TroubleToggle document_diagnostics<cr>", opts) +vim.keymap.set("n", "<leader>xl", "<cmd>TroubleToggle loclist<cr>", opts) +vim.keymap.set("n", "<leader>xq", "<cmd>TroubleToggle quickfix<cr>", opts) +vim.keymap.set("n", "gR", "<cmd>TroubleToggle lsp_references<cr>", opts) + +local on_attach = function(client, bufnr) + -- Mappings. + local bufopts = { noremap=true, silent=true, buffer=bufnr } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts) + vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts) +end + +cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + ['<C-b>'] = cmp.mapping.scroll_docs(-4), + ['<C-f>'] = cmp.mapping.scroll_docs(4), + ['<C-Space>'] = cmp.mapping.complete(), + ['<C-e>'] = cmp.mapping.abort(), + ['<CR>'] = cmp.mapping.confirm({ + behavior = cmp.ConfirmBehavior.Replace, + select = true + }), + ['<Tab>'] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + ['<S-Tab>'] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, + }) +}) + +cmp.event:on( + 'confirm_done', + cmp_autopairs.on_confirm_done() +) + +local settings = { + pylsp = { + pylsp = { + plugins = { + autopep8 = { enabled = false }, + flake8 = { enabled = false }, + pycodestyle = { enabled = false }, + pydocstyle = { enabled = false }, + pyflakes = { enabled = false }, + yapf = { enabled = false }, + pylint = { enabled = false }, + black = { enabled = false }, + } + } + }, + bashls = {}, + ansiblels = { + ansible = { + ansible = { + useFullyQualifiedCollectionNames = false + }, + python = { + activationScript = "~/.venv/ansible/bin/activate" + + }, + completion = { + provideRedirectModules = true, + provideModuleOptionAliases = true + }, + validation = { + enabled = true, + lint = { + enabled = true, + arguments = "-c ansible-lint.yaml" + } + } + } + } +} + +for _,lsp in ipairs(servers) do + lspconfig[lsp].setup{ + on_attach = on_attach, + capabilities = capabilities, + settings = settings[lsp], + } +end + +require("luasnip.loaders.from_vscode").lazy_load() diff --git a/nixpkgs/.config/nixpkgs/common/nvim/plugins/lualine.lua b/nixpkgs/.config/nixpkgs/common/nvim/plugins/lualine.lua new file mode 100644 index 0000000..90e6db2 --- /dev/null +++ b/nixpkgs/.config/nixpkgs/common/nvim/plugins/lualine.lua @@ -0,0 +1 @@ +require('lualine').setup() diff --git a/nixpkgs/.config/nixpkgs/common/nvim/plugins/telescope.lua b/nixpkgs/.config/nixpkgs/common/nvim/plugins/telescope.lua new file mode 100644 index 0000000..97ef563 --- /dev/null +++ b/nixpkgs/.config/nixpkgs/common/nvim/plugins/telescope.lua @@ -0,0 +1,16 @@ +local telescope = require('telescope') +local actions = require('telescope.actions') + +local trouble = require("trouble.providers.telescope") + +telescope.setup { + defaults = { + file_ignore_patterns = { "^.git/" }, + mappings = { + i = { ["<c-t>"] = trouble.open_with_trouble }, + n = { ["<c-t>"] = trouble.open_with_trouble }, + }, + }, +} + +telescope.load_extension('fzf') diff --git a/nixpkgs/.config/nixpkgs/common/nvim/plugins/trouble.lua b/nixpkgs/.config/nixpkgs/common/nvim/plugins/trouble.lua new file mode 100644 index 0000000..cf7a27b --- /dev/null +++ b/nixpkgs/.config/nixpkgs/common/nvim/plugins/trouble.lua @@ -0,0 +1,3 @@ +require('trouble').setup { + use_diagnostic_signs = true +} diff --git a/nixpkgs/.config/nixpkgs/common/start.sh b/nixpkgs/.config/nixpkgs/common/start.sh index 3dd6cf0..9bf656e 100755 --- a/nixpkgs/.config/nixpkgs/common/start.sh +++ b/nixpkgs/.config/nixpkgs/common/start.sh @@ -14,5 +14,7 @@ sleep 1 exec mako & +sleep 1 + # set bg exec ./bg.sh & diff --git a/nixpkgs/.config/nixpkgs/flake.lock b/nixpkgs/.config/nixpkgs/flake.lock index 93e170d..e1301b2 100644 --- a/nixpkgs/.config/nixpkgs/flake.lock +++ b/nixpkgs/.config/nixpkgs/flake.lock @@ -4,15 +4,14 @@ "inputs": { "nixpkgs": [ "nixpkgs" - ], - "utils": "utils" + ] }, "locked": { - "lastModified": 1678019241, - "narHash": "sha256-ntj0u3guaIu9dT8aZ3HtnEVhIsibtM7EaG/2VteKaTw=", + "lastModified": 1682072616, + "narHash": "sha256-sR5RL3LACGuq5oePcAoJ/e1S3vitKQQSNACMYmqIE1E=", "owner": "nix-community", "repo": "home-manager", - "rev": "e314f6cf211e480ab8fa101a017e593a9bb9f21b", + "rev": "47d6c3f65234230d37f1cf7d3d6b5575ec80fe0c", "type": "github" }, "original": { @@ -23,11 +22,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1678095239, - "narHash": "sha256-4F6jovFJcwh6OkMsY94ZrHdrvVqZi1FX5pYv6V9LIQw=", + "lastModified": 1680876084, + "narHash": "sha256-eP9yxP0wc7XuVaODugh+ajgbFGaile2O1ihxiLxOuvU=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "f6610997b0fc5ea5f9e142c348fca27497efe1c7", + "rev": "3006d2860a6ed5e01b0c3e7ffb730e9b293116e2", "type": "github" }, "original": { @@ -39,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1677932085, - "narHash": "sha256-+AB4dYllWig8iO6vAiGGYl0NEgmMgGHpy9gzWJ3322g=", + "lastModified": 1681920287, + "narHash": "sha256-+/d6XQQfhhXVfqfLROJoqj3TuG38CAeoT6jO1g9r1k0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3c5319ad3aa51551182ac82ea17ab1c6b0f0df89", + "rev": "645bc49f34fa8eff95479f0345ff57e55b53437e", "type": "github" }, "original": { @@ -59,21 +58,6 @@ "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs" } - }, - "utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } } }, "root": "root", diff --git a/nixpkgs/.config/nixpkgs/per-user/kdam0-work/home.nix b/nixpkgs/.config/nixpkgs/per-user/kdam0-work/home.nix index 53c4819..abc71e5 100644 --- a/nixpkgs/.config/nixpkgs/per-user/kdam0-work/home.nix +++ b/nixpkgs/.config/nixpkgs/per-user/kdam0-work/home.nix @@ -23,6 +23,12 @@ search = "nix search nixpkgs $@"; conf = "ranger ~/.config/nixpkgs/common/"; up = "home-manager switch"; + k9s = "docker run --rm -it -v ~/.kube/config:/root/.kube/config quay.io/derailed/k9s"; + b = "ssh kdamani@burne.sat"; + auto = "ssh kepler@auto.sat"; + dns = "ssh administrator@ctrlf-dns"; + pyans = "source ~/.venv/ansible/bin/activate"; + pykep36 = "source ~/.venv/kepler36/bin/activate"; }; zplug = { enable = true; @@ -32,13 +38,23 @@ ]; }; }; - programs.tmux = { + programs.tmux = { enable = true; clock24 = true; shell = "${pkgs.zsh}/bin/zsh"; prefix = "C-a"; terminal = "screen-256color"; keyMode = "vi"; + plugins = with pkgs; [ + tmuxPlugins.sensible + { + plugin = tmuxPlugins.resurrect; + extraConfig = "set -g @resurrect-strategy-nvim 'session'"; + } + tmuxPlugins.pain-control + tmuxPlugins.yank + ]; + sensibleOnTop = true; }; programs.git = { enable = true; @@ -48,45 +64,90 @@ lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"; }; }; + programs.neovim = { + enable = true; + withPython3 = false; + withRuby = true; + withNodeJs = true; + vimdiffAlias = true; + plugins = with pkgs.vimPlugins; [ + tokyonight-nvim + nvim-treesitter.withAllGrammars + nvim-autopairs + nvim-cmp + nvim-web-devicons + nnn-vim + luasnip + cmp_luasnip + cmp-nvim-lsp + friendly-snippets + { + plugin = indent-blankline-nvim-lua; + type = "lua"; + config = builtins.readFile(../../common/nvim/plugins/indent-blankline.lua); + } + { + plugin = lualine-nvim; + type = "lua"; + config = builtins.readFile(../../common/nvim/plugins/lualine.lua); + } + { + plugin = trouble-nvim; + type = "lua"; + config = builtins.readFile(../../common/nvim/plugins/trouble.lua); + } + { + plugin = telescope-nvim; + type = "lua"; + config = builtins.readFile(../../common/nvim/plugins/telescope.lua); + } + telescope-fzf-native-nvim + { + plugin = leap-nvim; + type = "lua"; + config = builtins.readFile(../../common/nvim/plugins/leap.lua); + } + mason-nvim + mason-lspconfig-nvim + neoconf-nvim + { + plugin = nvim-lspconfig; + type = "lua"; + config = builtins.readFile(../../common/nvim/plugins/lspconfig.lua); + } + ]; + extraConfig = builtins.readFile ../../common/nvim/init.vim; + }; home.stateVersion = "22.11"; - home.packages = [ + home.packages = with pkgs; [ # Window environment - (pkgs.dwl.override { - # trying to supply config.home.homeDirectory here leads to "impure" usage. - # so disabling it for now - # conf = (builtins.readFile "${config.home.homeDirectory}/.config/dwl/config.h"); - conf = ../../common/dwl_4/config.h; - }) pkgs.somebar pkgs.foot - pkgs.wofi pkgs.wl-clipboard pkgs.wf-recorder pkgs.grim pkgs.slurp - pkgs.polkit - pkgs.light pkgs.wbg # Text Editors - pkgs.neovim + #pkgs.neovim # Browsers pkgs.firefox pkgs.brave # File Managers pkgs.ranger - pkgs.pcmanfm - pkgs.gvfs + pkgs.nnn # Fonts pkgs.noto-fonts - #pkgs.nerdfonts + pkgs.nerdfonts pkgs.hack-font # Notifications pkgs.mako pkgs.libnotify # Image viewer pkgs.imv + pkgs.sxiv # Video player pkgs.mpv # Pdf Viewer @@ -95,7 +156,11 @@ pkgs.acpi # Other stuff pkgs.entr - pkgs.clang + pkgs.gcc + #stdenv.cc.cc.lib + #pkgs.libstdcxx5 + #llvmPackages_6.libstdcxxClang + #pkgs.clang pkgs.gnumake pkgs.neofetch pkgs.trash-cli @@ -106,7 +171,14 @@ pkgs.unzip pkgs.nodejs pkgs.cargo - + pkgs.wget + pkgs.lazygit + #pkgs.tree-sitter + # Work stuff + pkgs.mattermost-desktop + pkgs.signal-desktop + pkgs.wev + pkgs.sshpass ]; fonts.fontconfig.enable = true; @@ -117,6 +189,61 @@ enableSshSupport = true; }; + systemd.user.services = { + nextcloud-sync = { + Unit = { + Description = "Auto sync Nextcloud"; + After = "network-online.target"; + }; + Service = { + Type = "simple"; + EnvironmentFile = "${config.home.homeDirectory}/.nextcloud.env"; + ExecStart = '' + ${pkgs.nextcloud-client}/bin/nextcloudcmd \ + -h --non-interactive \ + --user "''${NEXTCLOUD_USER}" \ + --password "''${NEXTCLOUD_PASSWORD}" \ + ''${NEXTCLOUD_DIR} \ + ''${NEXTCLOUD_URL} + ''; + TimeoutStopSec = "180"; + KillMode = "process"; + KillSignal = "SIGINT"; + }; + Install.WantedBy = ["multi-user.target"]; + }; + bg-wallpaper = { + Unit = { + Description = "Auto refresh wallpaper"; + After = "network-online.target"; + }; + Service = { + Type = "simple"; + ExecStart = "${config.home.homeDirectory}/bg.sh"; + TimeoutStopSec = "10"; + KillMode = "process"; + KillSignal = "SIGKILL"; + }; + Install.WantedBy = ["multi-user.target"]; + }; + }; + systemd.user.timers = { + nextcloud-sync = { + Unit.Description = "Automatic sync files with Nextcloud when booted up after 5 minutes then rerun every 10 minutes"; + Timer.OnUnitActiveSec = "10min"; + Install.WantedBy = ["multi-user.target" "timers.target"]; + }; + }; + systemd.user.timers = { + bg-wallpaper = { + Unit.Description = "Automatic update of wallpaper"; + Timer.OnUnitActiveSec = "10min"; + Install.WantedBy = ["multi-user.target" "timers.target"]; + }; + }; + systemd.user.startServices = true; + + # Source app specific configs home.file."bg.sh".source = ../../common/bg.sh; home.file."start.sh".source = ../../common/start.sh; |
