nvim stuff

This commit is contained in:
2025-08-05 19:13:18 +02:00
parent df513eb640
commit 504f9637d9
29 changed files with 322 additions and 256 deletions

View File

@@ -5,8 +5,7 @@
lib,
user,
...
}:
{
}: {
imports = [
agenix.darwinModules.default
];
@@ -19,16 +18,15 @@
allowUnsupportedSystem = true;
};
overlays =
let
path = ../../overlays;
in
overlays = let
path = ../../overlays;
in
with builtins;
map (n: import (path + ("/" + n))) (
filter (n: match ".*\\.nix" n != null || pathExists (path + ("/" + n + "/default.nix"))) (
attrNames (readDir path)
)
);
map (n: import (path + ("/" + n))) (
filter (n: match ".*\\.nix" n != null || pathExists (path + ("/" + n + "/default.nix"))) (
attrNames (readDir path)
)
);
};
nix = {
@@ -42,7 +40,7 @@
"https://nix-community.cachix.org"
"https://cache.nixos.org"
];
trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" ];
trusted-public-keys = ["cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="];
};
gc = {
automatic = true;

View File

@@ -1,9 +1,4 @@
{
pkgs,
...
}:
{
{pkgs, ...}: {
programs.bat = {
enable = true;
config = {

View File

@@ -1,14 +1,9 @@
{
...
}:
let
{...}: let
name = "Christoph Schmatzler";
in
{
in {
programs.git = {
enable = true;
ignores = [ "*.swp" ];
ignores = ["*.swp"];
userName = name;
lfs = {
enable = true;

View File

@@ -0,0 +1,35 @@
{
programs.nixvim = {
autoGroups = {
Christoph = {};
};
autoCmd = [
{
event = "BufWritePre";
group = "Christoph";
pattern = "*";
command = "%s/\\s\\+$//e";
}
{
event = "LspAttach";
group = "Christoph";
callback.__raw = ''
function(e)
local opts = { buffer = e.buf }
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
end
'';
}
];
};
}

View File

@@ -1,7 +1,10 @@
{
{pkgs, ...}: {
imports = [
./options.nix
./autocmd.nix
./plugins/conform.nix
./plugins/mini.nix
./plugins/oil.nix
./plugins/treesitter.nix
./plugins/which-key.nix
];

View File

@@ -1 +0,0 @@
{ }

View File

@@ -0,0 +1,14 @@
{
programs.nixvim.plugins.conform-nvim = {
enable = true;
settings = {
format_on_save = {};
formatters_by_ft = {
nix = ["alejandra"];
javascript = ["prettier"];
typescript = ["prettier"];
elixir = ["mix"];
};
};
};
}

View File

@@ -0,0 +1,59 @@
{
programs.nixvim.plugins.mini = {
enable = true;
modules = {
basics = {
options = {
basic = true;
extra_ui = true;
win_ui_borders = "dot";
};
mappings = {
basic = true;
windows = true;
move_with_alt = true;
};
autocommands = {
basic = true;
};
};
icons = {};
notify = {};
sessions = {};
statusline = {};
extra = {};
ai = {
custom_textobjects = {
B.__raw = "require('mini.extra').gen_ai_spec.buffer()";
F.__raw = "require('mini.ai').gen_spec.treesitter({ a = '@function.outer', i = '@function.inner' })";
};
};
align = {};
bracketed = {};
bufremove = {};
comment = {};
completion = {
lsp_completion = {
source_func = "omnifunc";
};
};
pick = {};
surround = {};
};
};
programs.nixvim.keymaps = [
{
mode = "n";
key = "<leader>ff";
action = ":Pick files<CR>";
options.desc = "Search files";
}
{
mode = "n";
key = "<leader>/";
action = ":Pick grep_live<CR>";
options.desc = "Grep";
}
];
}

View File

@@ -1,7 +1,6 @@
{
programs.nixvim.plugins.oil = {
enable = true;
autoLoad = true;
settings = {
columns = [
"icon"

View File

@@ -0,0 +1,17 @@
{pkgs, ...}: {
programs.nixvim.plugins.treesitter = {
enable = true;
settings = {
highlight.enable = true;
indent.enable = true;
};
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
bash
fish
json
nix
toml
yaml
];
};
}

View File

@@ -3,9 +3,7 @@
lib,
user,
...
}:
{
}: {
programs.ssh = {
enable = true;
includes = [

View File

@@ -1,9 +1,4 @@
{
lib,
...
}:
{
{lib, ...}: {
programs.starship = {
enable = true;
enableFishIntegration = true;

View File

@@ -1,5 +1,4 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
programs.zellij = {
enable = true;
enableFishIntegration = true;

View File

@@ -1,9 +1,8 @@
{ pkgs }:
with pkgs;
[
{pkgs}:
with pkgs; [
age
age-plugin-yubikey
alejandra
delta
docker
docker-compose
@@ -16,8 +15,10 @@ with pkgs;
nerd-fonts.iosevka
nixfmt
nodejs_24
nurl
opencode
openssh
prettier
ripgrep
sqlite
tree

View File

@@ -6,9 +6,7 @@
nixvim,
user,
...
}:
{
}: {
imports = [
./dock
./system.nix
@@ -25,26 +23,24 @@
home-manager = {
useGlobalPkgs = true;
users.${user} =
{
pkgs,
config,
lib,
...
}:
{
_module.args = { inherit user; };
imports = [
nixvim.homeModules.nixvim
../base/home-manager
./home-manager/ghostty.nix
];
fonts.fontconfig.enable = true;
home = {
packages = pkgs.callPackage ./packages.nix { } ++ pkgs.callPackage ../base/packages.nix { };
stateVersion = "24.05";
};
users.${user} = {
pkgs,
config,
lib,
...
}: {
_module.args = {inherit user;};
imports = [
nixvim.homeModules.nixvim
../base/home-manager
./home-manager/ghostty.nix
];
fonts.fontconfig.enable = true;
home = {
packages = pkgs.callPackage ./packages.nix {} ++ pkgs.callPackage ../base/packages.nix {};
stateVersion = "24.05";
};
};
};
local = {
@@ -52,11 +48,11 @@
enable = true;
username = user;
entries = [
{ path = "/Applications/Safari.app/"; }
{ path = "/${pkgs.ghostty-bin}/Applications/Ghostty.app/"; }
{ path = "/System/Applications/Notes.app/"; }
{ path = "/System/Applications/Music.app/"; }
{ path = "/System/Applications/System Settings.app/"; }
{path = "/Applications/Safari.app/";}
{path = "/${pkgs.ghostty-bin}/Applications/Ghostty.app/";}
{path = "/System/Applications/Notes.app/";}
{path = "/System/Applications/Music.app/";}
{path = "/System/Applications/System Settings.app/";}
{
path = "${config.users.users.${user}.home}/Downloads";
section = "others";

View File

@@ -4,13 +4,10 @@
lib,
...
}:
with lib;
let
with lib; let
cfg = config.local.dock;
inherit (pkgs) stdenv dockutil;
in
{
in {
options = {
local.dock = {
enable = mkOption {
@@ -21,11 +18,10 @@ in
entries = mkOption {
description = "Entries on the Dock";
type =
with types;
type = with types;
listOf (submodule {
options = {
path = lib.mkOption { type = str; };
path = lib.mkOption {type = str;};
section = lib.mkOption {
type = str;
default = "apps";
@@ -48,11 +44,14 @@ in
config = mkIf cfg.enable (
let
normalize = path: if hasSuffix ".app" path then path + "/" else path;
entryURI =
path:
normalize = path:
if hasSuffix ".app" path
then path + "/"
else path;
entryURI = path:
"file://"
+ (builtins.replaceStrings
+ (
builtins.replaceStrings
[
" "
"!"
@@ -80,12 +79,12 @@ in
(normalize path)
);
wantURIs = concatMapStrings (entry: "${entryURI entry.path}\n") cfg.entries;
createEntries = concatMapStrings (
entry:
"${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n"
) cfg.entries;
in
{
createEntries =
concatMapStrings (
entry: "${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n"
)
cfg.entries;
in {
system.activationScripts.postActivation.text = ''
echo >&2 "Setting up the Dock for ${cfg.username}..."
su ${cfg.username} -s /bin/sh <<'USERBLOCK'

View File

@@ -1,9 +1,4 @@
{
pkgs,
...
}:
{
{pkgs, ...}: {
programs.ghostty = {
enable = true;
package = pkgs.ghostty-bin;

View File

@@ -1,8 +1,6 @@
{ pkgs, ... }:
{
{pkgs, ...}: {
homebrew = {
enable = true;
masApps = { };
masApps = {};
};
}

View File

@@ -1,7 +1,5 @@
{ pkgs }:
with pkgs;
[
{pkgs}:
with pkgs; [
_1password-gui
dockutil
raycast

View File

@@ -5,8 +5,7 @@
secrets,
user,
...
}:
{
}: {
age.identityPaths = [
"/Users/${user}/.ssh/id_ed25519"
];

View File

@@ -1,6 +1,4 @@
{ lib, ... }:
{
{lib, ...}: {
system.defaults = {
NSGlobalDomain = {
AppleShowAllExtensions = true;

View File

@@ -6,13 +6,10 @@
nixvim,
user,
...
}:
let
sharedFiles = import ../base/files.nix { inherit config pkgs; };
additionalFiles = import ./files.nix { inherit config pkgs; };
in
{
}: let
sharedFiles = import ../base/files.nix {inherit config pkgs;};
additionalFiles = import ./files.nix {inherit config pkgs;};
in {
imports = [
./packages.nix
./secrets.nix
@@ -33,27 +30,25 @@ in
home-manager = {
useGlobalPkgs = true;
users.${user} =
{
pkgs,
config,
lib,
...
}:
{
_module.args = { inherit user; };
imports = [
nixvim.homeModules.nixvim
../base/home-manager
users.${user} = {
pkgs,
config,
lib,
...
}: {
_module.args = {inherit user;};
imports = [
nixvim.homeModules.nixvim
../base/home-manager
];
home = {
packages = pkgs.callPackage ./packages.nix {};
file = lib.mkMerge [
sharedFiles
additionalFiles
];
home = {
packages = pkgs.callPackage ./packages.nix { };
file = lib.mkMerge [
sharedFiles
additionalFiles
];
stateVersion = "23.11";
};
stateVersion = "23.11";
};
};
};
}