From 96004daf1bb2e03caf73aaa7555a74b0980006ae Mon Sep 17 00:00:00 2001
From: Jo <jo@thevoid.cafe>
Date: Wed, 26 Mar 2025 09:19:49 +0100
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20Zed=20home=20module?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../x86_64-linux/jo@puzzlevision/default.nix  |  1 +
 modules/home/apps/zed/default.nix             | 70 +++++++++++++++++++
 2 files changed, 71 insertions(+)
 create mode 100644 modules/home/apps/zed/default.nix

diff --git a/homes/x86_64-linux/jo@puzzlevision/default.nix b/homes/x86_64-linux/jo@puzzlevision/default.nix
index 9756028..b9ad81b 100644
--- a/homes/x86_64-linux/jo@puzzlevision/default.nix
+++ b/homes/x86_64-linux/jo@puzzlevision/default.nix
@@ -6,6 +6,7 @@
 
     apps.nushell.enable = false;
     apps.vscodium.enable = true;
+    apps.zed.enable = true;
   };
 
   home.file."~/.config/Yubico/u2f_keys".text = ''
diff --git a/modules/home/apps/zed/default.nix b/modules/home/apps/zed/default.nix
new file mode 100644
index 0000000..9f9a38f
--- /dev/null
+++ b/modules/home/apps/zed/default.nix
@@ -0,0 +1,70 @@
+{
+  lib,
+  pkgs,
+  config,
+  namespace,
+  ...
+}: let
+  inherit (lib) mkEnableOption mkIf;
+  cfg = config.${namespace}.apps.zed;
+in {
+  options.${namespace}.apps.zed = {
+    enable = mkEnableOption "zed, the graphical editor from the future";
+  };
+
+  config = mkIf cfg.enable {
+    sops.secrets.wakatime-cfg = {
+      format = "binary";
+      sopsFile = lib.snowfall.fs.get-file "secrets/wakatime.cfg";
+      path = "/home/jo/.wakatime.cfg";
+    };
+
+    home.packages = with pkgs; [
+      alejandra
+    ];
+
+    programs.zed-editor = {
+      enable = true;
+      extensions = ["nix" "catppuccin" "wakatime" "discord_presence"];
+
+      userSettings = {
+        icon_theme = "Catppuccin Macchiato";
+        theme = {
+          dark = "Catppuccin Macchiato (blue)";
+          light = "Catppuccin Macchiato (blue)";
+        };
+
+        ### Disable telemetry
+        telemetry = {
+          metrics = false;
+        };
+
+        ### Disable certain AI features
+        features = {
+          copilot = false;
+        };
+
+        ### Language specific configurations
+        languages = {
+          ### Nix language
+          Nix = {
+            language_servers = [ "nixd" "!nil" ];
+          };
+        };
+
+        ### LSP configurations
+        lsp = {
+          nixd = {
+            initialization_options = {
+              formatting = {
+                command = ["alejandra" "--quiet" "--"];
+              };
+            };
+          };
+        };
+      };
+
+      extraPackages = with pkgs; [ nixd ];
+    };
+  };
+}