{ username ? throw "username argument is required", }: { config, lib, pkgs, ... }: let userConfig = config.users.users.${username}; hmConfig = config.home-manager.users.${username}; in { home-manager.users.${username} = { imports = [ ./options.nix ]; programs = { obsidian = { enable = true; sharedSettings = { app = { defaultViewMode = "preview"; livePreview = false; readableLineLength = false; showLineNumber = true; tabSize = 2; promptDelete = false; trashOption = "local"; alwaysUpdateLinks = true; newFileLocation = "folder"; newFileFolderPath = "inbox"; newLinkFormat = "absolute"; showUnsupportedFiles = true; attachmentFolderPath = "./assets"; }; corePlugins = [ "bookmarks" "canvas" "command-palette" "editor-status" "file-explorer" "global-search" "graph" "note-composer" "outgoing-link" "outline" "page-preview" "slash-command" "switcher" "tag-pane" ]; plugins = [ { pkg = import ./plugins/custom-sort { inherit pkgs; }; extraFiles."data.json".source = (pkgs.formats.json { }).generate "data.json" { suspended = false; statusBarEntryEnabled = false; notificationsEnabled = false; mobileNotificationsEnabled = true; customSortContextSubmenu = false; bookmarksGroupToConsumeAsOrderingReference = "Sort"; bookmarksContextMenus = false; }; } { pkg = import ./plugins/dataview { inherit pkgs; }; extraFiles."data.json".source = (pkgs.formats.json { }).generate "data.json" { enableDataviewJs = true; enableInlineDataviewJs = true; warnOnEmptyResult = false; defaultDateFormat = "dd/MM/yyyy"; defaultDateTimeFormat = "HH:mm - dd/MM/yyyy"; }; } { pkg = import ./plugins/excalidraw { inherit pkgs; }; extraFiles."data.json".source = (pkgs.formats.json { }).generate "data.json" { 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 = import ./plugins/kanban { inherit pkgs; }; extraFiles."data.json".source = (pkgs.formats.json { }).generate "data.json" { 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 = import ./plugins/linter { inherit pkgs; }; extraFiles."data.json".source = (pkgs.formats.json { }).generate "data.json" { 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; yaml-key-sort = { enabled = true; yaml-sort-order-for-other-keys = "Ascending Alphabetical"; }; 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; paragraph-blank-lines.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 = import ./plugins/minimal-settings { inherit pkgs; }; extraFiles."data.json".source = (pkgs.formats.json { }).generate "data.json" { editorFont = "var(--font-monospace)"; }; } { pkg = import ./plugins/outliner { inherit pkgs; }; extraFiles."data.json".source = (pkgs.formats.json { }).generate "data.json" { styleLists = false; stickCursor = "never"; }; } (import ./plugins/style-settings { inherit pkgs; }) { pkg = import ./plugins/tasks { inherit pkgs; }; extraFiles."data.json".source = (pkgs.formats.json { }).generate "data.json" { 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"; } ]; }; }; } ]; cssSnippets = [ ./snippets/file-explorer-separators.css ]; themes = [ (import ./themes/minimal { inherit pkgs; }) ]; 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"; } ]; "advanced-cursors:add-cursor-above" = [ { modifiers = [ "Mod" "Shift" ]; key = "ArrowUp"; } ]; "advanced-cursors:add-cursor-below" = [ { modifiers = [ "Mod" "Shift" ]; key = "ArrowDown"; } ]; }; }; }; matugen.settings.templates = builtins.mapAttrs (name: _: { input_path = ./theme.json; output_path = "${userConfig.home}/${name}/.obsidian/plugins/obsidian-style-settings/data.json"; }) hmConfig.programs.obsidian.vaults; }; home.persistence."/cache${userConfig.home}".directories = [ ".config/obsidian" ]; }; }