diff --git a/home/apps/helixnotes.nix b/home/apps/helixnotes.nix index aeb6b1b..a7e8dd7 100644 --- a/home/apps/helixnotes.nix +++ b/home/apps/helixnotes.nix @@ -4,7 +4,110 @@ pkgs, inputs, ... -}: { +}: let + hexBlend = (import ../../lib/hex-blend.nix {inherit lib;}).blend; + + colors = config.lib.stylix.colors.withHashtag; + accent = colors.base0D; + themeId = "custom-1786382261140"; # Thos has to be this format, otherwise Helixnotes won't load it + vaultPath = "${config.home.homeDirectory}/Vault"; + configJSON = builtins.toJSON { + accent_color = accent; + active_bookmark_id = null; + active_vault = vaultPath; + ai_api_key = null; + ai_model = "claude-sonnet-4-6"; + ai_provider = null; + ai_writing_style = null; + autostart = false; + backup_enabled = false; + backup_frequency = "24h"; + backup_include_attachments = false; + backup_location = null; + backup_max_count = 10; + close_to_tray = false; + compact_notes = false; + content_width = null; + custom_themes = [ + { + colors = { + bg_active = hexBlend 0.25 accent colors.base03; + bg_editor = colors.base00; + bg_hover = hexBlend 0.15 accent colors.base02; + bg_primary = colors.base00; + bg_secondary = colors.base01; + bg_tertiary = colors.base02; + border_color = colors.base02; + text_primary = colors.base05; + text_secondary = colors.base04; + }; + id = themeId; + is_dark = true; + name = "Stylix"; + } + ]; + daily_title_format = "iso"; + default_view_mode = false; + enable_wiki_links = true; + font_family = null; + font_size = 16; + gpu_acceleration = true; + hide_title_in_body = true; + last_backup_time = null; + last_sync_time = null; + line_height = null; + max_versions_per_note = 20; + new_notes_in_source_mode = false; + ollama_api_key = null; + ollama_base_url = null; + openai_api_key = null; + openai_compatible_api_key = null; + openai_compatible_base_url = null; + pdf_height = 600; + pdf_preview = false; + restore_last_session = false; + show_all_notes = true; + show_daily_notes = false; + show_line_numbers = true; + show_link_arrows = true; + show_note_dates = true; + show_note_switcher = false; + show_quick_access = true; + show_tasks = true; + show_trash = false; + show_tray_icon = false; + startup_view = "all"; + sync_interval_minutes = 0; + sync_on_change = false; + sync_on_open = false; + sync_provider = null; + system_dark_theme = themeId; + system_light_theme = themeId; + theme = "system"; + time_format = "24h"; + title_mode = "input"; + ui_scale = 1.0; + vaults = [ + { + bookmark_id = null; + last_sync_time = null; + name = "Vault"; + path = vaultPath; + sync_interval_minutes = 0; + sync_on_change = false; + sync_on_open = false; + sync_provider = null; + webdav_password = null; + webdav_url = null; + webdav_username = null; + } + ]; + webdav_password = null; + webdav_url = null; + webdav_username = null; + week_start = "monday"; + }; +in { options.modules.apps.helixnotes.enable = lib.mkOption { default = config.modules.apps.enable; description = "HelixNotes markdown note-taking app"; @@ -12,8 +115,42 @@ }; config = lib.mkIf config.modules.apps.helixnotes.enable { - home.packages = [ - inputs.helix-notes.packages.${pkgs.stdenv.hostPlatform.system}.default - ]; + home = { + activation.helixnotesConfig = lib.mkIf config.modules.desktop.stylix.enable ( + lib.hm.dag.entryAfter ["writeBoundary"] '' + CONFIG_FILE="${config.home.homeDirectory}/.config/helixnotes/config.json" + $VERBOSE_ECHO "Writing helixnotes config.json" + $DRY_RUN_CMD mkdir -p "$(dirname "$CONFIG_FILE")" + $DRY_RUN_CMD cat > "$CONFIG_FILE" << 'EOF' + ${configJSON} + EOF + $DRY_RUN_CMD chmod 644 "$CONFIG_FILE" + '' + ); + file = { + ".config/com.helixnotes.app/.window-state.json" = { + force = true; + text = builtins.toJSON { + main = { + decorated = false; + fullscreen = false; + height = 0; + # Stuff I do care about, no idea why it comes with window decorations by default + maximized = false; + prev_x = 0; + prev_y = 0; + visible = true; + # Stuff I don't care about, but hardcoding doesn't seems to break it? + width = 0; + x = 0; + y = 0; + }; + }; + }; + }; + packages = [ + inputs.helix-notes.packages.${pkgs.stdenv.hostPlatform.system}.default + ]; + }; }; }