From 15d06fd26a3ca2befc3d2f67d4a4acaac4d63ae4 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Wed, 13 Dec 2023 19:30:04 +0100 Subject: [PATCH] Move from lualine to mini.statusline and more --- home/features/cli/khal.nix | 10 +- .../cli/productivity/smos/default.nix | 1 + home/features/desktop/discord/default.nix | 9 +- home/features/desktop/firefox/default.nix | 4 +- home/features/desktop/wezterm/wezterm.lua | 5 + home/features/neovim/config/lazy-lock.json | 10 +- .../neovim/config/lua/my/helpers/env.lua | 5 +- home/features/neovim/config/lua/my/lazy.lua | 8 +- .../neovim/config/lua/my/plugins/init.lua | 39 +----- .../config/lua/my/plugins/mini-operators.lua | 4 +- .../config/lua/my/plugins/mini-surround.lua | 2 +- .../neovim/config/lua/my/plugins/neorg.lua | 54 -------- .../neovim/config/lua/my/plugins/obsidian.lua | 32 ----- .../lua/my/plugins/themes/catppuccin.lua | 14 +- home/features/neovim/default.nix | 127 ++++++++++++------ home/features/persistence.nix | 25 ++-- home/global.nix | 13 +- hosts/nixos/tethys/services/syncthing.nix | 2 +- modules/common/lua-encoders.nix | 19 ++- modules/common/neovim.nix | 15 +-- modules/home-manager/satellite-dev.nix | 2 +- 21 files changed, 181 insertions(+), 219 deletions(-) delete mode 100644 home/features/neovim/config/lua/my/plugins/neorg.lua delete mode 100644 home/features/neovim/config/lua/my/plugins/obsidian.lua diff --git a/home/features/cli/khal.nix b/home/features/cli/khal.nix index 82c33f8..2d1e035 100644 --- a/home/features/cli/khal.nix +++ b/home/features/cli/khal.nix @@ -1,10 +1,13 @@ # TODO: sync theme with global theme -{ pkgs, ... }: { +{ pkgs, ... }: +let calendarsHome = "productivity/calendars"; +in +{ home.packages = with pkgs; [ khal ]; xdg.configFile."khal/config".text = '' [calendars] [[calendars]] - path = ~/Calendars/* + path = ~/${calendarsHome}/* type = discover color = dark magenta @@ -15,7 +18,8 @@ [view] theme = light ''; + satellite.persistence.at.data.apps.khal.directories = [ - "Calendars" + calendarsHome ]; } diff --git a/home/features/cli/productivity/smos/default.nix b/home/features/cli/productivity/smos/default.nix index 71d180c..5082c0e 100644 --- a/home/features/cli/productivity/smos/default.nix +++ b/home/features/cli/productivity/smos/default.nix @@ -2,6 +2,7 @@ programs.smos = { enable = true; notify.enable = true; + workflowDir = "${config.home.homeDirectory}/productivity/smos"; github = { enable = true; diff --git a/home/features/desktop/discord/default.nix b/home/features/desktop/discord/default.nix index 0af2b0f..f3e240a 100644 --- a/home/features/desktop/discord/default.nix +++ b/home/features/desktop/discord/default.nix @@ -23,7 +23,14 @@ in home.packages = [ discocss ]; xdg.configFile."discocss/custom.css".source = config.satellite.theming.get themeMap; - satellite.persistence.at.state.apps.Discord.directories = [ + # {{{ Storage + # Clean cache older than 10 days + systemd.user.tmpfiles.rules = [ + "d ${config.xdg.configHome}/discord/Cache/Cache_Data - - - 10d" + ]; + + satellite.persistence.at.state.apps.discord.directories = [ "${config.xdg.configHome}/discord" # Why tf does discord store it's state here 💀 ]; + # }}} } diff --git a/home/features/desktop/firefox/default.nix b/home/features/desktop/firefox/default.nix index 48f536d..09f4419 100644 --- a/home/features/desktop/firefox/default.nix +++ b/home/features/desktop/firefox/default.nix @@ -327,11 +327,11 @@ in home.sessionVariables.BROWSER = "firefox"; # }}} # {{{ Persistence - satellite.persistence.at.state.apps.Firefox.directories = [ + satellite.persistence.at.state.apps.firefox.directories = [ ".mozilla/firefox" # More important stuff ]; - satellite.persistence.at.cache.apps.Firefox.directories = [ + satellite.persistence.at.cache.apps.firefox.directories = [ "${config.xdg.cacheHome}/mozilla/firefox" # Non important cache ]; # }}} diff --git a/home/features/desktop/wezterm/wezterm.lua b/home/features/desktop/wezterm/wezterm.lua index 702fe5f..829bdce 100644 --- a/home/features/desktop/wezterm/wezterm.lua +++ b/home/features/desktop/wezterm/wezterm.lua @@ -83,6 +83,11 @@ config.keys = { mods = "CTRL|SHIFT", action = wezterm.action.DisableDefaultAssignment, }, + { + key = "w", + mods = "CTRL|SHIFT", + action = wezterm.action.DisableDefaultAssignment, + }, -- }}} } -- }}} diff --git a/home/features/neovim/config/lazy-lock.json b/home/features/neovim/config/lazy-lock.json index 004e89d..b10a92b 100644 --- a/home/features/neovim/config/lazy-lock.json +++ b/home/features/neovim/config/lazy-lock.json @@ -13,14 +13,12 @@ "crates": { "branch": "main", "commit": "b8ea20fda2e1029fbbb1bae7a9eab35c84037ca0" }, "dhall-vim": { "branch": "master", "commit": "68500ef46ff3706f46c99db3be7a0c8abcf6a3ae" }, "discord-rich-presence": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, - "dressing.nvim": { "branch": "master", "commit": "8b7ae53d7f04f33be3439a441db8071c96092d19" }, - "femaco": { "branch": "main", "commit": "6af458f0196215f397db31a6e1fb2df795811693" }, + "edit-code-block": { "branch": "main", "commit": "5e4e31012eafa113216cb5894f696682833f8e7f" }, "fidget.nvim": { "branch": "main", "commit": "0ba1e16d07627532b6cae915cc992ecac249fb97" }, "flash": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "ftft": { "branch": "master", "commit": "09a72f9adf8ee7c824c517ef8408c9e687453039" }, "github-actions-yaml.vim": { "branch": "master", "commit": "f2f16243447cea174daa6b4a9ffd3ff9213814ef" }, "gitlinker": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, - "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, "gitsigns.nvim": { "branch": "main", "commit": "87640f5a877b18bdd49884dbcac220fed924b867" }, "harpoon": { "branch": "master", "commit": "867e212ac153e793f95b316d1731f3ca1894625e" }, "haskell-tools": { "branch": "master", "commit": "92e097c6832405fb64e4c44a7ce8bebe7836cae6" }, @@ -35,20 +33,17 @@ "lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, "lean.nvim": { "branch": "main", "commit": "360908674890f3bd92eb41c5b362510dca8fc4cb" }, - "live-command.nvim": { "branch": "main", "commit": "d460067d47948725a6f25b20f31ea8bbfdfe4622" }, "lspkind.nvim": { "branch": "master", "commit": "57610d5ab560c073c465d6faf0c19f200cb67e6e" }, - "lualine": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, "magma-nvim": { "branch": "main", "commit": "ff3deba8a879806a51c005e50782130246143d06" }, "mini.comment": { "branch": "main", "commit": "3d9c8009615857e982f09bc5357fc95f2a2175f3" }, "mini.files": { "branch": "main", "commit": "173d73f5d0b2a9abbb2d6533a3770fdbbd0c4dcc" }, "mini.operators": { "branch": "main", "commit": "7a97e2528a4c274e9da8953d3ba22f493c360a9f" }, + "mini.statusline": { "branch": "main", "commit": "950d9029c7ed901b67c839e74478f784b7432665" }, "mini.surround": { "branch": "main", "commit": "af8129efcabe95fc08a233e9f91569829bed031f" }, "neoconf": { "branch": "main", "commit": "64437787dba70fce50dad7bfbb97d184c5bc340f" }, "neoconf.nvim": { "branch": "main", "commit": "64437787dba70fce50dad7bfbb97d184c5bc340f" }, "neodev.nvim": { "branch": "main", "commit": "c4ce017bd4bacf60bf59330cec9e93c5d5e104a6" }, "neogit": { "branch": "master", "commit": "761e9be2aa7cc4c8ca87f10c8c37108a687b928e" }, - "neorg": { "branch": "main", "commit": "baaf13a3145534144b795ad37db22bfffd2ad343" }, - "neorg-telescope": { "branch": "main", "commit": "6a7a677c40fa3c348924a4e2a06a513e0b34c056" }, "nui": { "branch": "main", "commit": "c9b4de623d19a85b353ff70d2ae9c77143abe69c" }, "null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" }, "nvim-autopairs": { "branch": "master", "commit": "0f04d78619cce9a5af4f355968040f7d675854a1" }, @@ -75,7 +70,6 @@ "typst.vim": { "branch": "main", "commit": "5b11b42de1703838ca1bb31dc66e73c002698e49" }, "undotree": { "branch": "master", "commit": "36ff7abb6b60980338344982ad4cdf03f7961ecd" }, "venn.nvim": { "branch": "main", "commit": "e4d68341a73dd56c64955058821a58295fb337b1" }, - "vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" }, "vim-teal": { "branch": "master", "commit": "d2aa107b257879e774680792a2aebaf9cd5742e0" }, "vim-tmux-navigator": { "branch": "master", "commit": "7db70e08ea03b3e4d91f63713d76134512e28d7e" }, "vimux": { "branch": "master", "commit": "616fcb4799674a7a809b14ca2dc155bb6ba25788" }, diff --git a/home/features/neovim/config/lua/my/helpers/env.lua b/home/features/neovim/config/lua/my/helpers/env.lua index e5807a9..9f98732 100644 --- a/home/features/neovim/config/lua/my/helpers/env.lua +++ b/home/features/neovim/config/lua/my/helpers/env.lua @@ -25,10 +25,11 @@ local M = { return vim.g.vscode ~= nil end), neovide = makeEnv(function() - return vim.g.neovide ~= nil or require("nix.env") == "neovide" + return vim.g.neovide ~= nil or vim.g.nix_neovim_app == "neovide" end), firenvim = makeEnv(function() - return vim.g.started_by_firenvim ~= nil or require("nix.env") == "firenvim" + return vim.g.started_by_firenvim ~= nil + or vim.g.nix_neovim_app == "firenvim" end), _and = function(a, b) return makeEnv(function() diff --git a/home/features/neovim/config/lua/my/lazy.lua b/home/features/neovim/config/lua/my/lazy.lua index 6e317ec..e5daf3b 100644 --- a/home/features/neovim/config/lua/my/lazy.lua +++ b/home/features/neovim/config/lua/my/lazy.lua @@ -24,16 +24,12 @@ function M.setup() fallback = true, -- Directory where I store my local plugin projects - path = "~/Projects", - + path = vim.g.nix_projects_path, patterns = { "Mateiadrielrafael" }, }, performance = { rtp = { - paths = { - -- Extra runtime path specified by nix - os.getenv("NVIM_EXTRA_RUNTIME") or "", - }, + paths = { vim.g.nix_extra_runtime }, disabled_plugins = { "gzip", "matchit", diff --git a/home/features/neovim/config/lua/my/plugins/init.lua b/home/features/neovim/config/lua/my/plugins/init.lua index cc70451..35cdf19 100644 --- a/home/features/neovim/config/lua/my/plugins/init.lua +++ b/home/features/neovim/config/lua/my/plugins/init.lua @@ -110,7 +110,8 @@ return { keys = { "", "", "", "" }, cond = env.vscode.not_active() and env.neovide.not_active() - and env.firenvim.not_active(), + and env.firenvim.not_active() + and false, }, { @@ -122,40 +123,6 @@ return { config = true, }, - { - -- case switching + the subvert command - "tpope/vim-abolish", - event = "VeryLazy", - enabled = false, - }, - - { - -- automatically set options based on current file - "tpope/vim-sleuth", - event = "BufRead", - cond = env.vscode.not_active(), - }, - - { - -- generate permalinks for code - "ruifm/gitlinker.nvim", - dependencies = { "nvim-lua/plenary.nvim" }, - opts = { mappings = "yg" }, - init = function() - local status, wk = pcall(require, "which-key") - - if status then - wk.register({ - ["yg"] = { - desc = "[Y]ank [g]it remote url", - }, - }) - end - end, - cond = env.firenvim.not_active(), - keys = "yg", - }, - -- Live command preview for stuff like :norm { "smjonas/live-command.nvim", @@ -167,6 +134,6 @@ return { }) end, event = "VeryLazy", - -- cond = false, + cond = false, }, } diff --git a/home/features/neovim/config/lua/my/plugins/mini-operators.lua b/home/features/neovim/config/lua/my/plugins/mini-operators.lua index d1f13c8..d9fa955 100644 --- a/home/features/neovim/config/lua/my/plugins/mini-operators.lua +++ b/home/features/neovim/config/lua/my/plugins/mini-operators.lua @@ -1,7 +1,7 @@ local M = { "echasnovski/mini.operators", - event = "VeryLazy", - opts = {}, + event = "BufReadPost", + config = true, } return M diff --git a/home/features/neovim/config/lua/my/plugins/mini-surround.lua b/home/features/neovim/config/lua/my/plugins/mini-surround.lua index fc3c31e..b89be37 100644 --- a/home/features/neovim/config/lua/my/plugins/mini-surround.lua +++ b/home/features/neovim/config/lua/my/plugins/mini-surround.lua @@ -1,6 +1,6 @@ local M = { "echasnovski/mini.surround", - event = "VeryLazy", + event = "BufReadPost", } function M.config() diff --git a/home/features/neovim/config/lua/my/plugins/neorg.lua b/home/features/neovim/config/lua/my/plugins/neorg.lua deleted file mode 100644 index a4ad892..0000000 --- a/home/features/neovim/config/lua/my/plugins/neorg.lua +++ /dev/null @@ -1,54 +0,0 @@ -local M = { - "nvim-neorg/neorg", - build = ":Neorg sync-parsers", - dependencies = { "nvim-lua/plenary.nvim", "nvim-neorg/neorg-telescope" }, - ft = "norg", - config = function() - require("neorg").setup({ - load = { - ["core.defaults"] = {}, -- Loads default behaviour - ["core.concealer"] = {}, -- Adds pretty icons to your documents - ["core.integrations.telescope"] = {}, - -- {{{ Completions - ["core.completion"] = { - config = { - engine = "nvim-cmp", - }, - }, - -- }}} - -- {{{ Dirman - ["core.dirman"] = { -- Manages Neorg workspaces - config = { - workspaces = { - notes = "~/Neorg", - ["uni-notes"] = "~/Projects/uni-notes", - }, - }, - }, - -- }}} - -- {{{ Keybinds - ["core.keybinds"] = { - config = { - hook = function(keybinds) - -- Binds the `gtd` key in `norg` mode to execute `:echo 'Hello'` - keybinds.map("norg", "n", "gtd", "echo 'Hello!'") - end, - }, - }, - -- }}} - }, - }) - - -- {{{ Lazy cmp loading - vim.api.nvim_create_autocmd("InsertEnter", { - group = vim.api.nvim_create_augroup("CmpSourceNeorg", {}), - pattern = "*.norg", - callback = function() - require("cmp").setup.buffer({ sources = { { name = "neorg" } } }) - end, - }) - -- }}} - end, -} - -return M diff --git a/home/features/neovim/config/lua/my/plugins/obsidian.lua b/home/features/neovim/config/lua/my/plugins/obsidian.lua deleted file mode 100644 index eb2db2c..0000000 --- a/home/features/neovim/config/lua/my/plugins/obsidian.lua +++ /dev/null @@ -1,32 +0,0 @@ -local env = require("my.helpers.env") -local vault = "/home/adrielus/Projects/stellar-sanctum" - -return { - "epwalsh/obsidian.nvim", - event = "VeryLazy", - dependencies = { - "nvim-lua/plenary.nvim", - }, - opts = { - dir = vault, - notes_subdir = "chaos", - daily_notes = { - folder = "daily", - date_format = "%Y-%m-%d", - }, - completion = { - nvim_cmp = true, - min_chars = 2, - new_notes_location = "current_dir", - prepend_note_id = true, - }, - mappings = {}, - disable_frontmatter = true, - }, - keys = { - { "", "ObsidianQuickSwitch" }, - }, - cond = env.vscode.not_active() - and env.firenvim.not_active() - and vim.loop.cwd() == vault, -} diff --git a/home/features/neovim/config/lua/my/plugins/themes/catppuccin.lua b/home/features/neovim/config/lua/my/plugins/themes/catppuccin.lua index 6f04a8d..be74934 100644 --- a/home/features/neovim/config/lua/my/plugins/themes/catppuccin.lua +++ b/home/features/neovim/config/lua/my/plugins/themes/catppuccin.lua @@ -14,7 +14,11 @@ function M.config() catppuccin.setup({ transparent_background = T.transparent.terminal, - integrations = { nvimtree = true, telescope = true }, + integrations = { + nvimtree = true, + telescope = true, + mini = { enabled = true }, + }, }) vim.cmd([[highlight NotifyINFOIcon guifg=#d6b20f]]) @@ -23,7 +27,13 @@ function M.config() vim.cmd("colorscheme catppuccin") if T.transparent.terminal then - vim.cmd([[highlight FloatBorder blend=0]]) + vim.cmd([[highlight FloatBorder blend=0 guibg=NONE]]) + -- vim.cmd([[highlight MiniStatuslineInactive blend=0 guibg=NONE]]) + vim.cmd([[highlight MiniStatuslineFilename blend=0 guibg=NONE]]) + -- vim.cmd([[highlight MiniStatuslineFileinfo blend=0 guibg=NONE]]) + -- vim.cmd([[highlight MiniStatuslineDevInfo blend=0 guibg=NONE]]) + vim.cmd([[highlight Statusline blend=0 guibg=NONE]]) + vim.cmd([[highlight StatuslineNC blend=0 guibg=NONE]]) end end diff --git a/home/features/neovim/default.nix b/home/features/neovim/default.nix index f6d73d7..fef25f3 100644 --- a/home/features/neovim/default.nix +++ b/home/features/neovim/default.nix @@ -75,34 +75,26 @@ let ] ++ config.satellite.neovim.generated.dependencies; # }}} # {{{ extraRuntime - extraRuntimePaths = env: [ + extraRuntimePaths = [ # Base16 theme (config.satellite.lib.lua.writeFile "lua/nix" "theme" config.satellite.colorscheme.lua ) - # Provide hints as to what app we are in - # (Useful because neovide does not provide the info itself right away) - (pkgs.writeTextDir - "lua/nix/env.lua" - "return '${env}'" - ) - # Experimental nix module generation config.satellite.neovim.generated.all ]; - extraRuntime = env: - let - generated = pkgs.symlinkJoin { - name = "nixified-neovim-lua-modules"; - paths = extraRuntimePaths env; - }; + extraRuntimeJoinedPaths = pkgs.symlinkJoin { + name = "nixified-neovim-lua-modules"; + paths = extraRuntimePaths; + }; - snippets = config.satellite.dev.path "home/features/neovim/snippets"; + extraRuntime = + let snippets = config.satellite.dev.path "home/features/neovim/snippets"; in - lib.concatStringsSep "," [ generated snippets ]; + lib.concatStringsSep "," [ extraRuntimeJoinedPaths snippets ]; # }}} # {{{ Client wrapper # Wraps a neovim client, providing the dependencies @@ -112,6 +104,14 @@ let # I cannot just install those dirs using the builtin package support because # my package manager (lazy.nvim) disables those. wrapClient = { base, name, binName ? name, extraArgs ? "" }: + let startupScript = pkgs.writeText "startup.lua" /* lua */'' + vim.g.nix_extra_runtime = ${nlib.encode extraRuntime} + vim.g.nix_projects_dir = ${nlib.encode config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR} + -- Provide hints as to what app we are running in + -- (Useful because neovide does not provide the info itself right away) + vim.g.nix_neovim_app = ${nlib.encode name} + ''; + in pkgs.symlinkJoin { inherit (base) name meta; paths = [ base ]; @@ -119,7 +119,7 @@ let postBuild = '' wrapProgram $out/bin/${binName} \ --prefix PATH : ${lib.makeBinPath extraPackages} \ - --set NVIM_EXTRA_RUNTIME ${extraRuntime name} \ + --add-flags ${lib.escapeShellArg ''--cmd "lua dofile('${startupScript}')"''} \ ${extraArgs} ''; }; @@ -156,7 +156,10 @@ in satellite.toggles.neovim.enable = true; xdg.configFile.nvim.source = config.satellite.dev.path "home/features/neovim/config"; - home.sessionVariables.EDITOR = "nvim"; + home.sessionVariables = { + EDITOR = "nvim"; + NVIM_GENERATED_RUNTIME = extraRuntimeJoinedPaths; + }; home.packages = [ neovim @@ -247,34 +250,36 @@ in keys.action = "NvimTreeToggle"; }; # }}} - # {{{ lualine - satellite.neovim.lazy.lualine = { - package = "nvim-lualine/lualine.nvim"; + # {{{ mini.statusline + satellite.neovim.lazy.mini-statusline = { + package = "echasnovski/mini.statusline"; + name = "mini.statusline"; dependencies.lua = [ lazy.web-devicons.package ]; env.blacklist = [ "vscode" "firenvim" ]; - event = "VeryLazy"; + lazy = false; - opts = { - options = { - component_separators = { left = ""; right = ""; }; - section_separators = { left = ""; right = ""; }; - theme = "auto"; - disabled_filetypes = [ "undotree" ]; - }; + opts.content.inactive = nlib.thunk /* lua */ '' + require("mini.statusline").combine_groups({ + { hl = "MiniStatuslineFilename", strings = { vim.fn.expand("%:t") } }, + }) + ''; - sections = { - lualine_a = [ "branch" ]; - lualine_b = [ "filename" ]; - lualine_c = [ "filetype" ]; - lualine_x = [ "diagnostics" "diff" ]; - lualine_y = [ ]; - lualine_z = [ ]; - }; + opts.content.active = nlib.thunk /* lua */ '' + local st = require("mini.statusline"); + local mode, mode_hl = st.section_mode({ trunc_width = 120 }) + local git = st.section_git({ trunc_width = 75 }) + local diagnostics = st.section_diagnostics({ trunc_width = 75 }) - # Integration with other plugins - extensions = [ "nvim-tree" ]; - }; + return st.combine_groups({ + { hl = mode_hl, strings = { mode } }, + { hl = "MiniStatuslineDevinfo", strings = { git } }, + { hl = "MiniStatuslineFilename", strings = { vim.fn.expand("%:t") } }, + "%=", -- End left alignment + { hl = "MiniStatuslineFilename", strings = { diagnostics } }, + { hl = "MiniStatuslineDevinfo", strings = { vim.bo.filetype } }, + }) + ''; }; # }}} # {{{ winbar @@ -282,7 +287,7 @@ in package = "fgheng/winbar.nvim"; env.blacklist = [ "vscode" "firenvim" ]; - event = "VeryLazy"; + event = "BufReadPost"; opts.enabled = true; }; @@ -627,8 +632,9 @@ in satellite.neovim.lazy.wakatime = { package = "wakatime/vim-wakatime"; env.blacklist = [ "vscode" "firenvim" ]; - event = "VeryLazy"; + event = "BufReadPost"; }; + # }}} # {{{ discord rich presence satellite.neovim.lazy.discord-rich-presence = { @@ -636,7 +642,7 @@ in main = "presence"; env.blacklist = [ "vscode" "firenvim" ]; - event = "VeryLazy"; + event = "BufReadPost"; setup = true; }; # }}} @@ -662,6 +668,41 @@ in opts.provider = "paste.rs"; }; # }}} + # {{{ obsidian + satellite.neovim.lazy.obsidian = + let vault = "${config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR}/stellar-sanctum"; + in + { + package = "epwalsh/obsidian.nvim"; + dependencies.lua = [ lazy.plenary.package ]; + + env.blacklist = [ "vscode" "firenvim" ]; + cond = nlib.lua /* lua */ "vim.loop.cwd() == ${nlib.encode vault}"; + event = "VeryLazy"; + + keys.mapping = ""; + keys.action = "ObsidianQuickSwitch"; + + opts = { + dir = vault; + notes_subdir = "chaos"; + daily_notes = { + folder = "daily"; + date_format = "%Y-%m-%d"; + }; + + completion = { + nvim_cmp = true; + min_chars = 2; + new_notes_location = "current_dir"; + prepend_note_id = true; + }; + + mappings = { }; + disable_frontmatter = true; + }; + }; + # }}} # }}} # }}} # {{{ Persistence diff --git a/home/features/persistence.nix b/home/features/persistence.nix index 3799e47..d895adc 100644 --- a/home/features/persistence.nix +++ b/home/features/persistence.nix @@ -21,12 +21,12 @@ config.xdg.userDirs.pictures config.xdg.userDirs.music config.xdg.userDirs.videos - "Projects" + config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR ]; # }}} # {{{ OpenTabletDriver - satellite.persistence.at.state.apps.OpenTabletDriver.directories = [ - #"${config.xdg.configHome}/OpenTabletDriver" + satellite.persistence.at.state.apps.open-tablet-driver.directories = [ + "${config.xdg.configHome}/OpenTabletDriver" ]; # }}} # {{{ Programming tooling @@ -98,22 +98,22 @@ # }}} # {{{ Desktop apps # {{{ QBittorrent - satellite.persistence.at.state.apps.QBittorrent.directories = [ + satellite.persistence.at.state.apps.qbittorrent.directories = [ "${config.xdg.configHome}/qBittorrent" # Config options ]; - satellite.persistence.at.cache.apps.QBittorrent.directories = [ + satellite.persistence.at.cache.apps.qbittorrent.directories = [ # TODO: investigate which subdirectories/files I actually want to keep "${config.xdg.dataHome}/qBittorrent" # Torrent files, logs, etc ]; # }}} # {{{ Signal - satellite.persistence.at.state.apps.Signal.directories = [ + satellite.persistence.at.state.apps.signal.directories = [ "${config.xdg.configHome}/Signal" # Why tf does signal store it's state here 💀 ]; # }}} # {{{ Steam - satellite.persistence.at.state.apps.Steam = { + satellite.persistence.at.state.apps.steam = { directories = [ ".factorio" # TODO: perhaps this should have it's own file? # A couple of games don't play well with bindfs @@ -126,17 +126,22 @@ # }}} # {{{ Lutris # TODO: there might be more to cache in .cache/lutris - satellite.persistence.at.state.apps.Lutris.directories = [ + satellite.persistence.at.state.apps.lutris.directories = [ "${config.xdg.configHome}/lutris" # General config data "${config.xdg.cacheHome}/lutris/banners" # Game banners "${config.xdg.cacheHome}/lutris/coverart" # Game cover art # Aparently IO intensive stuff like games prefer symlinks? - { directory = "Games/Lutris"; method = "symlink"; } # Lutris games + { directory = "media/games/lutris"; method = "symlink"; } # Lutris games ]; # }}} # {{{ Wine - satellite.persistence.at.state.apps.Wine.directories = [ ".wine" ]; + satellite.persistence.at.state.apps.wine.directories = [ ".wine" ]; + # }}} + # {{{ Element + satellite.persistence.at.state.apps.element.directories = [ + "${config.xdg.configHome}/Element" + ]; # }}} # }}} } diff --git a/home/global.nix b/home/global.nix index 9b88536..dfea2e1 100644 --- a/home/global.nix +++ b/home/global.nix @@ -75,7 +75,18 @@ in xdg.userDirs = { enable = lib.mkDefault true; createDirectories = lib.mkDefault false; - extraConfig.XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/Screenshots"; + + desktop = null; + templates = null; + download = "${config.home.homeDirectory}/downloads"; + publicShare = "${config.home.homeDirectory}/public"; + music = "${config.home.homeDirectory}/media/music"; + pictures = "${config.home.homeDirectory}/media/pictures"; + videos = "${config.home.homeDirectory}/media/videos"; + documents = "${config.home.homeDirectory}/media/documents"; + + extraConfig.XDG_SCREENSHOTS_DIR = "${config.xdg.userDirs.pictures}/screenshots"; + extraConfig.XDG_PROJECTS_DIR = "${config.home.homeDirectory}/projects"; }; # }}} } diff --git a/hosts/nixos/tethys/services/syncthing.nix b/hosts/nixos/tethys/services/syncthing.nix index fd9498d..ff716db 100644 --- a/hosts/nixos/tethys/services/syncthing.nix +++ b/hosts/nixos/tethys/services/syncthing.nix @@ -18,7 +18,7 @@ in versioning = commonVersioning; }; "stellar-sanctum" = { - path = "/home/adrielus/Projects/stellar-sanctum/"; + path = "/home/adrielus/projects/stellar-sanctum/"; devices = [ "enceladus" "lapetus" ]; versioning = commonVersioning; }; diff --git a/modules/common/lua-encoders.nix b/modules/common/lua-encoders.nix index 1df6a0b..68e8fa1 100644 --- a/modules/common/lua-encoders.nix +++ b/modules/common/lua-encoders.nix @@ -30,6 +30,7 @@ let map = f: encoder: given: encoder (f given); # This is simply right-composition of functions postmap = f: encoder: given: f (encoder given); + filter = f: encoder: luaEncoders.conditional f encoder luaEncoders.nil; # This is mostly useful for debugging trace = message: luaEncoders.map (f: lib.traceSeq message (lib.traceVal f)); fail = mkMessage: v: builtins.throw (mkMessage v); @@ -72,6 +73,16 @@ let # This simply combines the above combinators into one. luaCode = tag: luaEncoders.luaImportOr tag luaEncoders.luaString; # }}} + # {{{ Operators + conjunction = left: right: given: + let + l = left given; + r = right given; + in + if l == "nil" then r + else if r == "nil" then l + else "${l} and ${r}"; + # }}} # {{{ Lists listOf = encoder: list: luaEncoders.mkRawLuaObject (lib.lists.map encoder list); @@ -80,10 +91,10 @@ let lib.isList (luaEncoders.listOf encoder); # Returns nil when given empty lists - tryNonemptyList = encoder: luaEncoders.conditional - (l: l == [ ]) - luaEncoders.nil - (luaEncoders.listOf encoder); + tryNonemptyList = encoder: + luaEncoders.filter + (l: l != [ ]) + (luaEncoders.listOf encoder); oneOrMany = encoder: luaEncoders.listOfOr encoder encoder; # Can encode: # - zero values as nil diff --git a/modules/common/neovim.nix b/modules/common/neovim.nix index 0be7c94..23744a2 100644 --- a/modules/common/neovim.nix +++ b/modules/common/neovim.nix @@ -530,15 +530,12 @@ in version = e.nullOr e.string; dependencies = e.map (d: d.lua) (e.tryNonemptyList (e.stringOr lazyObjectEncoder)); lazy = e.nullOr e.bool; - cond = - if opts.env.blacklist != [ ] then - assert lib.asserts.assertMsg (opts.cond == null) - "env.blacklist overrides plugin condition"; - e.const /* lua */ '' + cond = e.conjunction + (e.nullOr (e.luaCode "cond")) + (e.filter (_: opts.env.blacklist != [ ]) + (e.const /* lua */ '' require(${e.string cfg.runtime.env}).blacklist(${e.listOf e.string opts.env.blacklist}) - '' - else - e.nullOr (e.luaCode "cond"); + '')); config = _: let @@ -590,5 +587,3 @@ in ]; # }}} } - - diff --git a/modules/home-manager/satellite-dev.nix b/modules/home-manager/satellite-dev.nix index 89c175d..8a415f9 100644 --- a/modules/home-manager/satellite-dev.nix +++ b/modules/home-manager/satellite-dev.nix @@ -8,7 +8,7 @@ root = lib.mkOption { type = lib.types.str; - default = "${config.home.homeDirectory}/Projects/satellite"; + default = "${config.xdg.userDirs.extraConfig.XDG_PROJECTS_DIR}/satellite"; description = "Where the satellite repo is cloned"; };