nearly at parity with lua-based config

This commit is contained in:
Natalie 2025-05-21 10:44:59 -07:00
parent 10453abfb1
commit 6fea0a1f4e
No known key found for this signature in database
GPG key ID: 61F4EAEB0C9C3D5F
10 changed files with 132 additions and 79 deletions

View file

@ -49,7 +49,6 @@
}@inputs:
let
lib = nixpkgs.lib;
# TODO: apply these overlays sooner and remove uses of legacyPackages elsewhere.
overlays = [
inputs.zig.overlays.default

View file

@ -7,7 +7,7 @@
mkNeovim,
}: name: {
user, # ./users/{name}
host, # ./users/{name}/{host} (optional)
host, # ./users/{name}/{host}
system, # arch-os
extraModules ? [],
}: let

View file

@ -4,27 +4,15 @@ _: {
enable = true;
onActivation = {
autoUpdate = true;
autoUpdate = false;
cleanup = "none";
upgrade = true;
upgrade = false;
};
brews = [
"imagemagick"
"opam"
];
casks = [
"battle-net"
"stremio"
"alt-tab"
"legcord"
"zulip"
"zen-browser"
"supertuxkart"
"sf-symbols"
"mediosz/tap/swipeaerospace"
];
masApps = {

View file

@ -87,9 +87,6 @@
ripgrep.enable = true;
};
friendly-snippets.enable = true;
setupOpts = {
keymap.preset = "super-tab";
};
};
};
statusline = {

View file

@ -9,6 +9,7 @@
# Include the results of the hardware scan.
./hardware-configuration.nix
];
documentation.man.generateCaches = false;
programs = {
gamemode.enable = true;

View file

@ -2,8 +2,7 @@
pkgs,
lib,
...
}@args:
{
} @ args: {
programs = {
# sort-lines:start
atuin.enable = true;
@ -11,6 +10,7 @@
hyfetch.enable = true;
direnv.enable = true;
fish.enable = true;
man.generateCaches = false;
# sort-lines:end
};

View file

@ -1,5 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
pinentry_mac
signal-desktop-bin
@ -8,7 +7,7 @@
# Custom configuration modules in "modules" are shared between users,
# and can be configured in this "shared" namespace
shared.darwin = {
macAppStoreApps = [ "wireguard" ];
macAppStoreApps = ["wireguard"];
};
# Create /etc/zshrc that loads the nix-darwin environment.
@ -30,14 +29,6 @@
# Use homebrew to install casks
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "none";
upgrade = true;
};
brews = [
"imagemagick"
"opam"
@ -49,8 +40,11 @@
"alt-tab"
"legcord"
"zulip"
"zen-browser"
"zen"
"supertuxkart"
"sf-symbols"
"mediosz/tap/swipeaerospace"
];
};
}

View file

@ -1,8 +1,27 @@
{...}: {
{pkgs, ...}: {
imports = [
./vim/default.nix
];
vim = {
options = {
tabstop = 2;
softtabstop = 2;
shiftwidth = 2;
undofile = true;
swapfile = false;
showmode = false;
foldmethod = "expr";
foldexpr = "v:lua.vim.treesitter.foldexpr()";
};
autocmds = [
{
event = ["LspAttach"];
pattern = ["*"];
desc = "User: Set LSP folding if client supports it";
callback = pkgs.lib.generators.mkLuaInline ''function(ctx) local client = assert(vim.lsp.get_client_by_id(ctx.data.client_id)) if client:supports_method("textDocument/foldingRange") then local win = vim.api.nvim_get_current_win() vim.wo[win][0].foldexpr = "v:lua.vim.lsp.foldexpr()" end end'';
}
];
theme = {
name = "catppuccin";
style = "mocha";

View file

@ -1,4 +1,5 @@
{...}: let
{ ... }:
let
mkKeymap = mode: key: action: desc: {
inherit
mode
@ -7,7 +8,8 @@
desc
;
};
in {
in
{
vim = {
keymaps = [
(mkKeymap "n" "<leader>e" ":lua require('snacks').explorer()<CR>" "File Explorer")
@ -17,7 +19,7 @@ in {
(mkKeymap "n" "<leader>ff" ":lua require('snacks').picker.files()<CR>" "Find File")
(mkKeymap "n" "<leader>fg" ":lua require('snacks').picker.grep()<CR>" "Grep Files")
# Lsp
(mkKeymap "n" "K" ":lua vim.lsp.buf.hover()<CR>" "Hover docs")
(mkKeymap "n" "K" ":Lspsaga hover_doc<CR>" "Hover docs")
(mkKeymap "n" "lr" ":lua vim.lsp.buf.rename()<CR>" "Rename")
# (mkKeymap "n" "<leader>th" ":lua function() vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) end<CR>" "Toggle Inlay Hints")
];

View file

@ -1,30 +1,60 @@
{
flake,
userConfig,
user,
host,
pkgs,
...
}: {
}: let
darwin =
if host.darwin
then "darwin"
else "nixos";
flakePath = "/${
if host.darwin
then "Users"
else "home"
}/${user.username}/.dotfiles";
# BIG HACK DO NOT DO PLS
hostname =
if host.darwin
then "Natalies-MacBook-Air"
else "nixos";
in {
vim = {
extraPackages = with pkgs; [
python312Packages.pylatexenc
];
lsp = {
lightbulb.enable = false;
lspsaga = {
enable = true;
setupOpts = {
lightbulb = {
virtual_text = false;
};
};
};
nvim-docs-view.enable = true;
inlayHints.enable = true;
servers.nixd.settings = {
nixd.nixpkgs.expr = ''import "${flake.inputs.nixpkgs}" { }'';
options = {
servers.nixd.settings.nixd = {
nixpkgs.expr = ''import "<nixpkgs>" { }'';
options =
{
home-manager = {
expr = ''(builtins.getFlake "${flakePath}").${darwin}Configurations.${hostname}.options.home-manager.users.type.getSubOptions [ ]'';
};
}
// pkgs.lib.optionalAttrs host.darwin {
nix-darwin = {
expr = ''(builtins.getFlake "${flakePath}").darwinConfigurations.${hostname}.options'';
};
}
// pkgs.lib.optionalAttrs host.linux {
nixos = {
expr = ''
(let pkgs = import "${flake.inputs.nixpkgs}" {}; inherit (pkgs) lib; in (lib.evalModules { modules = (import "${flake.inputs.nixpkgs}/nixos/modules/module-list.nix"); check = false;})).options'';
expr = ''(builtins.getFlake "${flakePath}").nixosConfigurations.${hostname}.options'';
};
nix_darwin = {
expr = ''
(let pkgs = import "${flake.inputs.nixpkgs}" {}; inherit (pkgs) lib; in (lib.evalModules { modules = import ("${flake.inputs.darwin}/modules/module-list.nix"); check = false;})).options'';
};
home_manager = {
expr = ''
(let pkgs = import "${flake.inputs.nixpkgs}" {}; lib = import "${flake.inputs.home-manager}/modules/lib/stdlib-extended.nix" pkgs.lib; in (lib.evalModules { modules = (import "${flake.inputs.home-manager}/modules/modules.nix") { inherit lib pkgs; check = false; };})).options'';
};
};
mappings = {
@ -33,7 +63,7 @@
goToDefinition = "gd";
listReferences = "gr";
goToType = "gy";
hover = "K";
hover = null;
nextDiagnostic = "<leader>d";
openDiagnosticFloat = "<leader>df";
renameSymbol = "rn";
@ -47,17 +77,19 @@
toggleFormatOnSave = null;
};
};
};
languages = {
enableDAP = true;
# haskell.enable = true;
lua.enable = true;
python.enable = true;
python.format.type = "ruff";
markdown.extensions.render-markdown-nvim = {
markdown = {
enable = true;
extensions.render-markdown-nvim = {
enable = true;
};
};
};
formatter.conform-nvim = {
enable = true;
setupOpts = {
@ -84,9 +116,13 @@
additionalVimRegexHighlighting = true;
};
context.enable = true;
grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
markdown_inline
markdown
];
highlight.enable = true;
indent.enable = true;
indent.enable = false;
};
visuals = {
@ -98,13 +134,30 @@
};
autocomplete.blink-cmp = {
enable = true;
# mappings = {
# };
mappings = {
close = null;
complete = null;
confirm = null;
next = null;
previous = null;
scrollDocsDown = null;
scrollDocsUp = null;
};
setupOpts = {
keymap = {
preset = "super-tab";
};
completion = {
ghost_text.enabled = false;
list.selection.preselect = true;
trigger = {
show_in_snippet = true;
};
accept.auto_brackets.enabled = true;
};
signature = {
enabled = true;
};
};
};