Personal Nix setup

Add zed-editor basic setup

Changed files
+346 -21
home
lib
machines
sodacream
+21 -21
flake.lock
···
]
},
"locked": {
-
"lastModified": 1750191719,
-
"narHash": "sha256-FEoD84p5JXbofEH8uSGhMSgvA5lWBOFnFb2fwLP45JU=",
+
"lastModified": 1750623672,
+
"narHash": "sha256-47ubcTe92Ep+iP+b6ZRJ4TfjC8AHm7iuz56j/N8+O70=",
"owner": "tadfisher",
"repo": "android-nixpkgs",
-
"rev": "e507e23b720d39c70a0f942a310eb4273c8d2806",
+
"rev": "5678783829d2d7d34e3502c2b698cee6c2979cfa",
"type": "github"
},
"original": {
···
]
},
"locked": {
-
"lastModified": 1749873626,
-
"narHash": "sha256-1Mc/D/1RwwmDKY59f4IpDBgcQttxffm+4o0m67lQ8hc=",
+
"lastModified": 1750618568,
+
"narHash": "sha256-w9EG5FOXrjXGfbqCcQg9x1lMnTwzNDW5BMXp8ddy15E=",
"owner": "lnl7",
"repo": "nix-darwin",
-
"rev": "2f140d6ac8840c6089163fb43ba95220c230f22b",
+
"rev": "1dd19f19e4b53a1fd2e8e738a08dd5fe635ec7e5",
"type": "github"
},
"original": {
···
]
},
"locked": {
-
"lastModified": 1750256996,
-
"narHash": "sha256-xPH4tgE7yIeBtOn54B6iDzMGXrf7mWvODML+DCN+H8I=",
+
"lastModified": 1750690749,
+
"narHash": "sha256-x6fRPeqdgDKVTCyvbp4J8Q5UQ3DV3oWYSoyM444N8cY=",
"owner": "nix-community",
"repo": "home-manager",
-
"rev": "f754e377dc2da5d34dfea6a5215c21741eaf8930",
+
"rev": "05b8c9506452349d8be854ac46e5a7630fa7917d",
"type": "github"
},
"original": {
···
},
"nixos-hardware": {
"locked": {
-
"lastModified": 1750083401,
-
"narHash": "sha256-ynqbgIYrg7P1fAKYqe8I/PMiLABBcNDYG9YaAP/d/C4=",
+
"lastModified": 1750431636,
+
"narHash": "sha256-vnzzBDbCGvInmfn2ijC4HsIY/3W1CWbwS/YQoFgdgPg=",
"owner": "NixOS",
"repo": "nixos-hardware",
-
"rev": "61837d2a33ccc1582c5fabb7bf9130d39fee59ad",
+
"rev": "1552a9f4513f3f0ceedcf90320e48d3d47165712",
"type": "github"
},
"original": {
···
},
"nixpkgs": {
"locked": {
-
"lastModified": 1750183894,
-
"narHash": "sha256-ZtOgEt70keBVB4YJc+z7m0h7J1BOlv/GjHE1YC6KxeA=",
+
"lastModified": 1750605355,
+
"narHash": "sha256-xT8cPLTxlktxI9vSdoBlAVK7dXgd8IK59j7ZwzkkhnI=",
"owner": "nixos",
"repo": "nixpkgs",
-
"rev": "f45e75fc63fc8a7ffc3da382b2f6b681c5b71875",
+
"rev": "3078b9a9e75f1790e6d6ef9955fdc6a2d1740cc6",
"type": "github"
},
"original": {
···
},
"locked": {
"dir": "nix",
-
"lastModified": 1748334374,
-
"narHash": "sha256-StsLdBT/+7GKlA4bdWUrFdsbPbI++0rb+2Jk/THzPx4=",
+
"lastModified": 1750358918,
+
"narHash": "sha256-IeHpcIzhdtx4W/kIwINcexY37I65n6tDVW3E2h9VElg=",
"owner": "AndyFilter",
"repo": "yeetmouse",
-
"rev": "135c452bd2db0022f6f3845bb2c71bf51ddf2e37",
+
"rev": "27b9bc538131b558bbffe8d88f216ba7e3b36de4",
"type": "github"
},
"original": {
···
},
"locked": {
-
"lastModified": 1750152169,
-
"narHash": "sha256-XN5OBCCXKmPBL+UXyyScI5HGgs4U8OFGQTnKuxurBFI=",
+
"lastModified": 1750649182,
+
"narHash": "sha256-beNAQ63SY8HxBsFdMGv/fdLzjQMYgifMh1DcmaIzMjo=",
"owner": "0xc000022070",
"repo": "zen-browser-flake",
-
"rev": "ed811ab0d0b407b59cda1023820e9986fd28c8c3",
+
"rev": "c0785a69fe3988b4ef44c74575f4a2f698f91f32",
"type": "github"
},
"original": {
+1
home/apps/default.nix
···
./minecraft.nix
./ghostty.nix
./wezterm
+
./zed-editor
];
}
+72
home/apps/zed-editor/default.nix
···
+
{ lib, config, pkgs, helpers, ... } @ inputs:
+
+
with lib;
+
let
+
themes = (import ./theme.nix inputs);
+
cfg = config.modules.apps;
+
+
userSettings = {
+
ui_font_family = "SF Pro Text";
+
ui_font_fallbacks = [ "codicon" ];
+
ui_font_size = 14;
+
buffer_font_family = "Dank Mono";
+
buffer_font_size = 14;
+
buffer_line_height.custom = 1.2;
+
tab_size = 2;
+
+
load_direnv = "shell_hook";
+
+
theme = "System Dark";
+
+
scrollbar.show = "never";
+
tab_bar.show = false;
+
git.inline_blame.enabled = false;
+
indent_guides.enabled = false;
+
seed_search_query_from_cursor = "selection";
+
use_smartcase_search = true;
+
use_autoclose = false;
+
inline_code_actions = false;
+
cursor_blink = false;
+
+
vim_mode = true;
+
+
calls = {
+
mute_on_join = true;
+
share_on_join = false;
+
};
+
+
toolbar = {
+
breadcrumbs = false;
+
quick_actions = false;
+
selections_menu = false;
+
agent_review = false;
+
code_actions = false;
+
};
+
+
telemetry = {
+
diagnostics = false;
+
metrics = false;
+
};
+
+
language_models = {
+
ollama.api_url = "http://irnbru.fable-pancake.ts.net:11434";
+
lmstudio.api_url = "http://irnbru.fable-pancake.ts.net:1234/api/v0";
+
};
+
};
+
in {
+
options.modules.apps.zed-editor = {
+
enable = mkOption {
+
default = false;
+
description = "Whether to enable Zed Editor.";
+
type = types.bool;
+
};
+
};
+
+
config = mkIf (cfg.enable && cfg.zed-editor.enable) {
+
programs.zed-editor = {
+
enable = true;
+
installRemoteServer = true;
+
inherit themes userSettings;
+
};
+
};
+
}
+237
home/apps/zed-editor/theme.nix
···
+
{ pkgs, ... } @ inputs:
+
+
let
+
inherit (import ../../../lib/colors.nix inputs) colors mkZedStyles;
+
+
raw = let
+
element = colors.element.gui;
+
cursor = colors.cursor.gui;
+
gutter = colors.gutter.gui;
+
split = colors.split.gui;
+
+
black = colors.black.gui;
+
grey = colors.grey.gui;
+
red = colors.red.gui;
+
brightRed = colors.brightRed.gui;
+
green = colors.green.gui;
+
brightGreen = colors.brightGreen.gui;
+
yellow = colors.yellow.gui;
+
orange = colors.orange.gui;
+
blue = colors.blue.gui;
+
brightBlue = colors.brightBlue.gui;
+
pink = colors.pink.gui;
+
magenta = colors.magenta.gui;
+
aqua = colors.aqua.gui;
+
cyan = colors.cyan.gui;
+
white = colors.white.gui;
+
muted = colors.muted.gui;
+
+
attribute = magenta;
+
keyword = magenta;
+
define = magenta;
+
macro = magenta;
+
label = magenta;
+
+
property = pink;
+
constant = pink;
+
operator = pink;
+
tag = pink;
+
+
url = brightBlue;
+
include = brightBlue;
+
+
delimiter = cyan;
+
typedef = yellow;
+
type = aqua;
+
conditional = red;
+
special = orange;
+
string = green;
+
specialChar = brightGreen;
+
number = orange;
+
function = blue;
+
identifier = white;
+
structure = yellow;
+
in {
+
players = [
+
{
+
cursor = white;
+
selection = cursor;
+
}
+
];
+
+
syntax = {
+
attribute.color = attribute;
+
constant.color = constant;
+
keyword.color = keyword;
+
"keyword.type".color = structure;
+
"constant.builtin".color = special;
+
"constant.macro".color = define;
+
string.color = green;
+
"string.escape".color = specialChar;
+
"string.special".color = specialChar;
+
number.color = number;
+
"number.float".color = number;
+
function.color = function;
+
"function.builtin".color = special;
+
"function.macro".color = macro;
+
"function.method".color = function;
+
"function.parameter".color = function;
+
variable.color = identifier;
+
"variable.parameter".color = identifier;
+
"variable.parameter.builtin".color = special;
+
"variable.member".color = property;
+
"variable.builtin".color = special;
+
"attribute.builtin".color = special;
+
label.color = label;
+
operator.color = operator;
+
conditional.color = conditional;
+
include.color = include;
+
boolean.color = conditional;
+
type.color = type;
+
"type.definition".color = typedef;
+
"type.builtin".color = special;
+
module.color = identifier;
+
tag.color = tag;
+
"tag.builtin".color = special;
+
constructor.color = structure;
+
"markup.raw".color = string;
+
"markup.list".color = operator;
+
"markup.link.label".color = delimiter;
+
"string.special.url".color = url;
+
"punctuation.bracket".color = operator;
+
"punctuation.delimiter".color = delimiter;
+
"punctuation.special".color = specialChar;
+
"keyword.exception".color = conditional;
+
"keyword.return".color = conditional;
+
"keyword.conditional".color = conditional;
+
"keyword.repeat".color = conditional;
+
"keyword.operator".color = operator;
+
"keyword.import".color = include;
+
"property".color = property;
+
+
comment = {
+
color = muted;
+
font_style = "italic";
+
};
+
+
"comment.todo".color = brightBlue;
+
"comment.error".color = brightRed;
+
"comment.note".color = magenta;
+
};
+
};
+
+
style = with colors; mkZedStyles {
+
background = black;
+
drop_target.background = element;
+
+
editor = {
+
background = black;
+
foreground = white;
+
invisible = grey;
+
gutter.background = black;
+
active_line.background = gutter;
+
active_line_number = muted;
+
line_number = grey;
+
document_highlight = {
+
read_background = element;
+
write_background = element;
+
};
+
};
+
+
subheader.background = black;
+
status_bar.background = black;
+
panel.background = black;
+
elevated_surface.background = element;
+
tab_bar.background = black;
+
title_bar.background = black;
+
+
toolbar = {
+
background = black;
+
};
+
+
tab = {
+
active_background = black;
+
inactive_background = gutter;
+
};
+
+
search.match_background = blue;
+
+
text = {
+
base = white;
+
muted = muted;
+
accent = blue;
+
disabled = grey;
+
placeholder = cursor;
+
};
+
+
border = {
+
base = split;
+
variant = gutter;
+
};
+
+
scrollbar = {
+
track.background = black;
+
thumb.background = muted;
+
};
+
+
error = red;
+
hint = brightBlue;
+
info = blue;
+
predictive = grey;
+
renamed = yellow;
+
success = green;
+
unreachable = brightRed;
+
warning = orange;
+
+
conflict = red;
+
created = green;
+
deleted = brightRed;
+
hidden = muted;
+
ignored = grey;
+
modified = blue;
+
+
element = {
+
background = element;
+
hover = cursor;
+
selected = cursor;
+
};
+
+
terminal = {
+
background = black;
+
bright_foreground = grey;
+
dim_foreground = gutter;
+
ansi = {
+
black = black;
+
bright_black = grey;
+
red = red;
+
bright_red = brightRed;
+
green = green;
+
bright_green = brightGreen;
+
yellow = yellow;
+
bright_yellow = orange;
+
blue = blue;
+
bright_blue = brightBlue;
+
magenta = pink;
+
bright_magenta = magenta;
+
cyan = aqua;
+
bright_cyan = cyan;
+
white = white;
+
bright_white = muted;
+
};
+
};
+
};
+
in {
+
system-theme = {
+
"$schema" = "https://zed.dev/schema/themes/v0.2.0.json";
+
name = "System";
+
author = "@kitten";
+
themes = let
+
theme = {
+
name = "System Dark";
+
appearance = "dark";
+
style = style // raw;
+
};
+
in [ theme ];
+
};
+
}
+
+14
lib/colors.nix
···
in
colors: (concatStringsSep "\n" (mapAttrsToList toValue (toFlatAttrs colors)));
+
mkZedStyles = let
+
valueToString = value: "${value.gui}";
+
isValue = value: isAttrs value && hasAttr "gui" value;
+
recurse = path: value:
+
if isAttrs value && !(isValue value) then
+
mapAttrsToList
+
(name: value: recurse (path ++ (if name != "base" then [name] else [])) value)
+
value
+
else {
+
${concatStringsSep "." path} = valueToString value;
+
};
+
in
+
styles: lib.foldl lib.recursiveUpdate {} (lib.flatten (recurse [] styles));
+
mkVimHardlineColors = colors:
with colors; ''
{
+1
machines/sodacream/home.nix
···
zen-browser.enable = true;
discord.enable = true;
chromium.enable = true;
+
zed-editor.enable = true;
};
};
}