{ user, home }: { config, lib, pkgs, inputs, ... }: let hmConfig = config.home-manager.users.${user}; in { environment.persistence."/persist/cache"."${home}/.config/obsidian" = { }; home-manager.users.${user} = { programs.obsidian = { enable = true; defaultSettings = { app = { defaultViewMode = "preview"; livePreview = false; readableLineLength = true; showLineNumber = true; useTab = false; tabSize = 4; promptDelete = false; trashOption = "local"; alwaysUpdateLinks = true; newFileLocation = "folder"; newFileFolderPath = "inbox"; newLinkFormat = "absolute"; showUnsupportedFiles = true; attachmentFolderPath = "./assets"; }; corePlugins = [ "bookmarks" { name = "canvas"; settings = { newFileLocation = "folder"; newFileFolderPath = "Inbox"; defaultWheelBehavior = "zoom"; }; } "canvas" { name = "command-palette"; settings = { pinned = [ "file-explorer:new-file" "canvas:new-file" "obsidian-excalidraw-plugin:excalidraw-autocreate-on-current" "obsidian-kanban:create-new-kanban-board" "obsidian-read-it-later:save-clipboard-to-notice" ]; }; } "editor-status" "file-explorer" "global-search" "graph" "note-composer" "outgoing-link" "outline" "page-preview" "slash-command" "switcher" "tag-pane" { name = "templates"; settings = { folder = "98-templates"; }; } ]; communityPlugins = with pkgs; [ { pkg = obsidianPlugins.better-word-count; settings = { statusBar = [ { prefix = ""; suffix = " words"; metric = { type = 0; counter = 0; }; } ]; altBar = [ { prefix = ""; suffix = " files"; metric = { type = 2; counter = 6; }; } ]; countComments = true; # Inverse }; } { pkg = obsidianPlugins.dataview; settings = { enableDataviewJs = true; enableInlineDataviewJs = true; warnOnEmptyResult = false; defaultDateFormat = "dd/MM/yyyy"; defaultDateTimeFormat = "HH:mm - dd/MM/yyyy"; }; } { pkg = obsidianPlugins.excalidraw; settings = { folder = "Inbox"; templateFilePath = "Templates"; scriptFolderPath = "Scripts"; compress = false; drawingFilenamePrefix = ""; drawingEmbedPrefixWithFilename = false; drawingFilenameDateTime = "YYYY-MM-DD-HH.mm.ss"; previewImageType = "SVG"; previewMatchObsidianTheme = true; defaultPenMode = "mobile"; parseTODO = true; focusOnFileTab = true; pngExportScale = 2; exportWithTheme = false; exportWithBackground = false; exportEmbedScene = true; showReleaseNotes = false; showNewVersionNotification = false; }; } { pkg = obsidianPlugins.kanban; settings = { move-tags = true; move-dates = true; date-display-format = "DD/MM/YYYY"; show-relative-date = true; date-picker-week-start = 1; inline-metadata-position = "footer"; move-task-metadata = true; show-archive-all = false; show-board-settings = false; }; } { pkg = obsidianPlugins.languagetool; settings = { shouldAutoCheck = true; pickyMode = true; staticLanguage = "auto"; englishVariety = "en-US"; }; } { pkg = obsidianPlugins.linter; settings = { lintOnSave = true; displayChanged = false; lintOnFileChange = true; ruleConfigs = { add-blank-line-after-yaml.enabled = true; dedupe-yaml-array-values.enabled = true; escape-yaml-special-characters = { enabled = true; try-to-escape-single-line-arrays = true; }; format-tags-in-yaml.enabled = true; format-yaml-array = { enabled = true; default-array-style = "multi-line"; }; sort-yaml-array-values.enabled = true; capitalize-headings = { enabled = true; ignore-words = ""; }; header-increment = { enabled = true; start-at-h2 = true; }; headings-start-line.enabled = true; remove-trailing-punctuation-in-heading.enabled = true; auto-correct-common-misspellings.enabled = true; blockquote-style.enabled = true; convert-bullet-list-markers.enabled = true; emphasis-style = { enabled = true; style = "asterisk"; }; no-bare-urls = { enabled = true; no-bare-uris = true; }; ordered-list-style.enabled = true; quote-style.enabled = true; remove-consecutive-list-markers.enabled = true; remove-empty-list-markers.enabled = true; remove-hyphenated-line-breaks.enabled = true; remove-multiple-spaces.enabled = true; strong-style = { enabled = true; style = "asterisk"; }; two-spaces-between-lines-with-content.enabled = true; unordered-list-style = { enabled = true; list-style = "-"; }; compact-yaml = { enabled = true; inner-new-lines = true; }; consecutive-blank-lines.enabled = true; empty-line-around-blockquotes.enabled = true; empty-line-around-code-fences.enabled = true; empty-line-around-math-blocks.enabled = true; empty-line-around-tables.enabled = true; heading-blank-lines.enabled = true; line-break-at-document-end.enabled = true; move-math-block-indicators-to-their-own-line.enabled = true; remove-empty-lines-between-list-markers-and-checklists.enabled = true; remove-link-spacing.enabled = true; space-after-list-markers.enabled = true; trailing-spaces.enabled = true; add-blockquote-indentation-on-paste.enabled = true; prevent-double-checklist-indicator-on-paste.enabled = true; prevent-double-list-item-indicator-on-paste.enabled = true; remove-hyphens-on-paste.enabled = true; remove-leading-or-trailing-whitespace-on-paste.enabled = true; remove-leftover-footnotes-from-quote-on-paste.enabled = true; remove-multiple-blank-lines-on-paste.enabled = true; }; customRegexes = [ { label = "Open Double Quote"; find = "“"; replace = "\""; flags = "gm"; } { label = "Close Double Quote"; find = "”"; replace = "\""; flags = "gm"; } { label = "Elipsis"; find = "…"; replace = "..."; flags = "gm"; } { label = "Open Quote"; find = "‘"; replace = "'"; flags = "gm"; } { label = "Close Quote"; find = "’"; replace = "'"; flags = "gm"; } { label = "Long Dash"; find = "—"; replace = "---"; flags = "gm"; } { label = "Short Dash"; find = "–"; replace = "--"; flags = "gm"; } { label = "Long Dash with Text"; find = "([^\\s])---([^\\s])"; replace = "$1 --- $2"; flags = "gm"; } { label = "Short Dash with Text"; find = "([^\\s])--([^\\s])"; replace = "$1 -- $2"; flags = "gm"; } ]; commonStyles = { removeUnnecessaryEscapeCharsForMultiLineArrays = true; }; }; } { pkg = obsidianPlugins.map-view; settings = { "markerIconRules" = [ { ruleName = "default"; preset = true; iconDetails = { prefix = "fas"; icon = "fa-circle"; markerColor = "blue"; }; } { ruleName = "#restaurant"; preset = false; iconDetails = { prefix = "fas"; icon = "fa-utensils"; markerColor = "red"; }; } { ruleName = "#bar"; preset = false; iconDetails = { prefix = "fas"; icon = "fa-martini-glass"; markerColor = "purple"; }; } { ruleName = "#coffee"; preset = false; iconDetails = { prefix = "fas"; icon = "fa-mug-hot"; markerColor = "purple"; }; } { ruleName = "#culture"; preset = false; iconDetails = { prefix = "fas"; icon = "fa-building-columns"; markerColor = "black"; }; } { ruleName = "#shopping"; preset = false; iconDetails = { prefix = "fas"; icon = "fa-shopping-bag"; markerColor = "yellow"; }; } { ruleName = "#entertainment"; preset = false; iconDetails = { prefix = "fas"; icon = "fa-microphone"; markerColor = "pink"; }; } { ruleName = "#nature"; preset = false; iconDetails = { prefix = "fas"; icon = "fa-tree"; markerColor = "green"; }; } ]; searchProvider = "google"; geocodingApiMethod = "path"; geocodingApiPath = hmConfig.sops.secrets."google/cloud/obsidian/geocoding".path; useGooglePlaces = true; letZoomBeyondMax = true; showGeolinkPreview = true; newNotePath = "Inbox"; }; } { pkg = obsidianPlugins.minimal-settings; settings = { editorFont = "var(--font-monospace)"; }; } { pkg = obsidianPlugins.outliner; settings = { styleLists = false; stickCursor = "never"; }; } (obsidianPlugins.style-settings) { pkg = obsidianPlugins.tasks; settings = { globalQuery = "short mode"; globalFilter = "#todo"; removeGlobalFilter = true; setCreatedDate = true; statusSettings = { coreStatuses = [ { symbol = " "; name = "to-do"; nextStatusSymbol = "/"; type = "TODO"; } { symbol = "x"; name = "done"; nextStatusSymbol = " "; type = "DONE"; } ]; customStatuses = [ { symbol = "/"; name = "in-progress"; nextStatusSymbol = "x"; type = "IN_PROGRESS"; } { symbol = "-"; name = "canceled"; nextStatusSymbol = " "; type = "CANCELLED"; } { symbol = ">"; name = "forwarded"; nextStatusSymbol = "/"; type = "IN_PROGRESS"; } { symbol = "<"; name = "scheduling"; nextStatusSymbol = "/"; type = "TODO"; } { symbol = "?"; name = "question"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "!"; name = "important"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "*"; name = "star"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "\""; name = "quote"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "l"; name = "location"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "b"; name = "bookmark"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "i"; name = "information"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "S"; name = "savings"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "I"; name = "idea"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "p"; name = "pros"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "c"; name = "cons"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "f"; name = "fire"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "k"; name = "key"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "w"; name = "win"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "u"; name = "up"; nextStatusSymbol = " "; type = "TODO"; } { symbol = "d"; name = "down"; nextStatusSymbol = " "; type = "TODO"; } ]; }; }; } (obsidianPlugins.url-into-selection) ]; themes = with pkgs; [ obsidianThemes.minimal ]; hotkeys = { "command-palette:open" = [ { key = "F1"; } ]; "app:open-help" = [ ]; "editor:swap-line-down" = [ { modifiers = [ "Alt" ]; key = "ArrowDown"; } ]; "editor:swap-line-up" = [ { modifiers = [ "Alt" ]; key = "ArrowUp"; } ]; "editor:fold-all" = [ { modifiers = [ "Alt" "Mod" ]; key = "T"; } ]; "editor:add-cursor-above" = [ { modifiers = [ "Mod" "Shift" ]; key = "ArrowUp"; } ]; "editor:add-cursor-below" = [ { modifiers = [ "Mod" "Shift" ]; key = "ArrowDown"; } ]; "obsidian-outliner:move-list-item-up" = [ ]; "obsidian-outliner:move-list-item-down" = [ ]; }; }; }; theme.template = lib.attrsets.mapAttrs' ( _: vault: lib.attrsets.nameValuePair "${vault.target}/.obsidian/plugins/obsidian-style-settings/data.json" { source = ./theme.json; } ) hmConfig.programs.obsidian.vaults; sops.secrets."google/cloud/obsidian/geocoding".sopsFile = "${inputs.secrets}/domains/personal/secrets.yaml"; }; }