Merge branch 'main' of paperclover.dev:nix/config
This commit is contained in:
commit
84993913c2
23 changed files with 210 additions and 185 deletions
3
.mailmap
Normal file
3
.mailmap
Normal file
|
@ -0,0 +1,3 @@
|
|||
# To learn more about git's mailmap: https://ntietz.com/blog/git-mailmap-for-name-changes
|
||||
clover caruso <git@paperclover.net> <git@paperclover.net>
|
||||
Natalie Marks <nmarks413@gmail.com> <nmarks413@gmail.com>
|
16
flake.nix
16
flake.nix
|
@ -97,9 +97,9 @@
|
|||
packages = forAllSystems (
|
||||
{ system, pkgs, ... }:
|
||||
{
|
||||
nvim-chloe = mkNeovim "chloe" pkgs;
|
||||
nvim-clover = mkNeovim "clover" pkgs;
|
||||
nvim-fish = mkNeovim "fish" pkgs;
|
||||
nvim-natalie = mkNeovim "natalie" pkgs;
|
||||
nvim-julia = mkNeovim "julia" pkgs;
|
||||
|
||||
inherit (pkgs) autofmt;
|
||||
}
|
||||
|
@ -122,22 +122,22 @@
|
|||
system = "aarch64-darwin";
|
||||
};
|
||||
|
||||
# chloe's mac studio "sandwich"
|
||||
# clover's mac studio "sandwich"
|
||||
darwinConfigurations.sandwich = mkSystem "sandwich" {
|
||||
user = "chloe";
|
||||
user = "clover";
|
||||
host = "sandwich";
|
||||
system = "aarch64-darwin";
|
||||
};
|
||||
# chloe's macbook air "paperback"
|
||||
# clover's macbook air "paperback"
|
||||
darwinConfigurations.paperback = mkSystem "paperback" {
|
||||
user = "chloe";
|
||||
user = "clover";
|
||||
host = "paperback";
|
||||
system = "aarch64-darwin";
|
||||
};
|
||||
|
||||
# julia's cattop
|
||||
# fish's cattop
|
||||
nixosConfigurations.cattop = mkSystem "cattop" {
|
||||
user = "julia";
|
||||
user = "fish";
|
||||
host = "cattop";
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
|
|
|
@ -6,8 +6,9 @@
|
|||
}:
|
||||
{
|
||||
imports = [
|
||||
./options.nix
|
||||
./formatter.nix
|
||||
./keybind.nix
|
||||
./options.nix
|
||||
];
|
||||
# based on default options from upstream:
|
||||
# https://github.com/NotAShelf/nvf/blob/main/configuration.nix
|
||||
|
@ -18,6 +19,10 @@
|
|||
# override level 999 is used to not conflict with mkDefault as used by nvf.
|
||||
# which allows user configurations to disable/override anything here.
|
||||
config.vim = lib.mkOverride 999 {
|
||||
extraLuaFiles = [
|
||||
./lib.lua
|
||||
];
|
||||
|
||||
theme = {
|
||||
enable = true;
|
||||
};
|
||||
|
@ -60,8 +65,8 @@
|
|||
listReferences = "gr";
|
||||
goToType = "gy";
|
||||
hover = "K";
|
||||
nextDiagnostic = "<leader>d";
|
||||
openDiagnosticFloat = "<leader>df";
|
||||
nextDiagnostic = null; # ]d
|
||||
openDiagnosticFloat = "<leader>d";
|
||||
renameSymbol = "rn";
|
||||
documentHighlight = null;
|
||||
listDocumentSymbols = null;
|
||||
|
@ -78,11 +83,9 @@
|
|||
enable = true;
|
||||
addDefaultGrammars = true;
|
||||
};
|
||||
debugger = {
|
||||
nvim-dap = {
|
||||
enable = true;
|
||||
ui.enable = true;
|
||||
};
|
||||
debugger.nvim-dap = {
|
||||
enable = true;
|
||||
ui.enable = true;
|
||||
};
|
||||
languages = {
|
||||
enableFormat = true;
|
||||
|
@ -96,36 +99,58 @@
|
|||
clang.enable = true;
|
||||
css.enable = true;
|
||||
html.enable = true;
|
||||
lua.enable = true;
|
||||
markdown.enable = true;
|
||||
nix.enable = true;
|
||||
python.enable = true;
|
||||
rust.crates.enable = true;
|
||||
rust.enable = true;
|
||||
ts.enable = true;
|
||||
zig.enable = true;
|
||||
lua.enable = true;
|
||||
# sort-lines: off
|
||||
|
||||
nix = {
|
||||
enable = true;
|
||||
format.type = "nixfmt"; # looks so much nicer
|
||||
};
|
||||
filetree.neo-tree = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
enable_cursor_hijack = true;
|
||||
git_status_async = true;
|
||||
};
|
||||
};
|
||||
filetree = {
|
||||
neo-tree = {
|
||||
enable = false;
|
||||
fzf-lua = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
fzf_colors = true;
|
||||
};
|
||||
};
|
||||
tabline = {
|
||||
nvimBufferline.enable = true;
|
||||
};
|
||||
autocomplete = {
|
||||
blink-cmp = {
|
||||
enable = true;
|
||||
sourcePlugins = {
|
||||
ripgrep.enable = true;
|
||||
autocomplete.blink-cmp = {
|
||||
enable = true;
|
||||
mappings = {
|
||||
close = null;
|
||||
complete = null;
|
||||
confirm = null;
|
||||
next = null;
|
||||
previous = null;
|
||||
scrollDocsDown = null;
|
||||
scrollDocsUp = null;
|
||||
};
|
||||
setupOpts = {
|
||||
keymap = {
|
||||
preset = "super-tab";
|
||||
};
|
||||
friendly-snippets.enable = true;
|
||||
completion = {
|
||||
ghost_text.enabled = false;
|
||||
list.selection.preselect = true;
|
||||
trigger = {
|
||||
show_in_snippet = true;
|
||||
};
|
||||
accept.auto_brackets.enabled = true;
|
||||
};
|
||||
signature.enabled = true;
|
||||
};
|
||||
sourcePlugins = {
|
||||
ripgrep.enable = true;
|
||||
};
|
||||
friendly-snippets.enable = true;
|
||||
};
|
||||
statusline = {
|
||||
lualine = {
|
||||
|
@ -137,71 +162,6 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
utility = {
|
||||
snacks-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
bigfile.enable = true;
|
||||
dashboard = {
|
||||
preset.keys = [
|
||||
{
|
||||
icon = " ";
|
||||
key = "n";
|
||||
desc = "New File";
|
||||
action = ":ene | startinsert";
|
||||
}
|
||||
{
|
||||
icon = " ";
|
||||
key = "r";
|
||||
desc = "Recent Files";
|
||||
action = ":lua Snacks.dashboard.pick('oldfiles')";
|
||||
}
|
||||
];
|
||||
sections = [
|
||||
{ section = "header"; }
|
||||
{
|
||||
section = "keys";
|
||||
indent = 2;
|
||||
padding = 1;
|
||||
}
|
||||
{
|
||||
icon = " ";
|
||||
title = "Projects";
|
||||
section = "projects";
|
||||
indent = 2;
|
||||
padding = 1;
|
||||
}
|
||||
{
|
||||
icon = " ";
|
||||
title = "Git";
|
||||
section = "terminal";
|
||||
enabled = lib.options.literalExpression ''
|
||||
function()
|
||||
return Snacks.git.get_root() ~= nil
|
||||
end
|
||||
'';
|
||||
cmd = "git status --short --branch --renames";
|
||||
height = 10;
|
||||
padding = 1;
|
||||
ttl = 5 * 60;
|
||||
indent = 3;
|
||||
}
|
||||
];
|
||||
};
|
||||
image = {
|
||||
enable = true;
|
||||
math.enabled = false;
|
||||
};
|
||||
notifier.timeout = 3000;
|
||||
picker = {
|
||||
enable = true;
|
||||
sources = {
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
binds = {
|
||||
whichKey.enable = true;
|
||||
cheatsheet.enable = true;
|
||||
|
|
83
modules/neovim/keybind.nix
Normal file
83
modules/neovim/keybind.nix
Normal file
|
@ -0,0 +1,83 @@
|
|||
# this file implements a keybind system, which is a higher level system
|
||||
# to configure vim.keymaps (note the different name bind vs map)
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
keyRemap = mode: key: action: { inherit mode key action; };
|
||||
keyCmd =
|
||||
mode: key: cmd:
|
||||
keyRemap mode key ":${cmd}<Return>";
|
||||
in
|
||||
{
|
||||
# default binds
|
||||
config.vim.keybinds = {
|
||||
search-commands = keyCmd "n" "<leader>?" "FzfLua keymaps";
|
||||
|
||||
# user interface
|
||||
toggle-explorer = keyCmd "n" "<leader>e" "Neotree toggle";
|
||||
reveal-active-file = keyCmd "n" "<leader>E" "Neotree reveal<CR>:Neotree focus";
|
||||
lazygit = keyCmd "n" "<leader>gg" "FullscreenTerm ${pkgs.lazygit}/bin/lazygit";
|
||||
|
||||
# pickers
|
||||
pick-file = keyCmd "n" "<leader><leader>" "FzfLua files";
|
||||
pick-mark = keyCmd "n" "<leader>'" "FzfLua marks";
|
||||
#pick-buffer = keyCmd "n" "<leader>b" "FzfLua buffers";
|
||||
pick-grep = keyCmd "n" "<leader>ff" "FzfLua grep_project";
|
||||
pick-recent-command = keyCmd "n" "<leader>fc" "FzfLua command_history";
|
||||
pick-other = keyCmd "n" "<leader>f?" "FzfLua builtin"; # picker of Fzf pickers
|
||||
|
||||
# lsp
|
||||
code-action =
|
||||
keyCmd "n" "<leader>ca"
|
||||
"FzfLua lsp_code_actions winopts.height=15 winopts.backdrop=100 winopts.title=false winopts.preview.title=false winopts.row=1";
|
||||
|
||||
# subtle nice features
|
||||
visual-dedent = keyRemap "v" "<" "<gv"; # keep selection
|
||||
visual-indent = keyRemap "v" ">" ">gv"; # keep selection
|
||||
clear-search-highlights = keyRemap "n" "<esc" ":noh<Return><esc>";
|
||||
};
|
||||
|
||||
# implementation
|
||||
options.vim.keybinds = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.nullOr (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
mode = lib.mkOption { type = lib.types.str; };
|
||||
key = lib.mkOption { type = lib.types.str; };
|
||||
action = lib.mkOption { type = lib.types.str; };
|
||||
};
|
||||
}
|
||||
)
|
||||
);
|
||||
default = { };
|
||||
};
|
||||
config.vim.keymaps =
|
||||
let
|
||||
titleCase =
|
||||
str:
|
||||
lib.concatStringsSep " " (
|
||||
map (
|
||||
word:
|
||||
lib.strings.toUpper (builtins.substring 0 1 word)
|
||||
+ builtins.substring 1 (builtins.stringLength word) word
|
||||
) (lib.splitString "-" str)
|
||||
);
|
||||
in
|
||||
builtins.filter (f: f != null) (
|
||||
lib.attrsets.mapAttrsToList (
|
||||
desc: bind:
|
||||
if bind != null then
|
||||
{
|
||||
desc = titleCase desc;
|
||||
inherit (bind) mode key action;
|
||||
}
|
||||
else
|
||||
null
|
||||
) config.vim.keybinds
|
||||
);
|
||||
}
|
27
modules/neovim/lib.lua
Normal file
27
modules/neovim/lib.lua
Normal file
|
@ -0,0 +1,27 @@
|
|||
-- Ported from https://www.reddit.com/r/neovim/comments/vemydn
|
||||
vim.api.nvim_create_user_command("FullscreenTerm", function(opts)
|
||||
vim.cmd("tab terminal " .. opts.args)
|
||||
local laststatus = vim.o.laststatus
|
||||
local showtabline = vim.o.showtabline
|
||||
local cmdheight = vim.o.cmdheight
|
||||
vim.o.laststatus = 0
|
||||
vim.o.cmdheight = 0
|
||||
vim.o.showtabline = 0
|
||||
vim.wo.signcolumn = "no"
|
||||
vim.wo.relativenumber = false
|
||||
vim.wo.number = false
|
||||
vim.cmd(
|
||||
"autocmd! TermClose <buffer=abuf> "
|
||||
.. "if !v:event.status"
|
||||
.. " | exec 'bd! '..expand('<abuf>')"
|
||||
.. " | endif"
|
||||
.. " | checktime"
|
||||
.. " | set laststatus="
|
||||
.. laststatus
|
||||
.. " | set cmdheight="
|
||||
.. cmdheight
|
||||
.. " | set showtabline="
|
||||
.. showtabline
|
||||
)
|
||||
vim.cmd("startinsert")
|
||||
end, { nargs = "*" })
|
4
nvim
4
nvim
|
@ -1,11 +1,11 @@
|
|||
#!/bin/sh
|
||||
username="$(id -u -n)"
|
||||
if [ "$username" = "clo" ]; then
|
||||
name="chloe"
|
||||
name="clover"
|
||||
elif [ "$username" = "nmarks" ]; then
|
||||
name="natalie"
|
||||
elif [ "$username" = "fish" ]; then
|
||||
name="julia"
|
||||
name="fish"
|
||||
fi
|
||||
if [ -z "$name" ]; then
|
||||
echo "Configure this wrapper script with your name." >&2
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# nix config
|
||||
|
||||
this setup allows natalie and chloe to share common configuration between their
|
||||
machines, but also share useful modules between each other.
|
||||
this setup allows natalie, clover, and more to share common configuration
|
||||
between their machines, but also share useful modules between each other.
|
||||
|
||||
```
|
||||
lib/ # reusable functions
|
||||
|
@ -12,7 +12,7 @@ modules/ # reusable modules
|
|||
+-- nixos/ # linux configurations
|
||||
+-- shared/ # shared between nixos-rebuild & darwin-rebuild
|
||||
users/
|
||||
+-- chloe/
|
||||
+-- clover/
|
||||
| +-- user.nix # info about her
|
||||
| +-- configuration.nix # for all hosts (system)
|
||||
| +-- home.nix # for all hosts (userspace)
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
_: {
|
||||
homebrew = {
|
||||
enable = true;
|
||||
casks = [ "eloston-chromium" ];
|
||||
};
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
_: {
|
||||
vim = {
|
||||
options = {
|
||||
linebreak = true;
|
||||
};
|
||||
git = {
|
||||
gitsigns.setupOpts = {
|
||||
current_line_blame = true;
|
||||
current_line_blame_opts = {
|
||||
virt_text = true;
|
||||
virt_text_pos = "right_align";
|
||||
delay = 25;
|
||||
ignore_whitespace = true;
|
||||
virt_text_priority = 100;
|
||||
use_focus = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
autocomplete.blink-cmp = {
|
||||
enable = true;
|
||||
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
keymaps =
|
||||
let
|
||||
mkKeymap = mode: key: action: desc: {
|
||||
inherit mode;
|
||||
inherit key action desc;
|
||||
};
|
||||
n = mkKeymap "n"; # normal mode
|
||||
in
|
||||
[
|
||||
# UI
|
||||
(n "<leader>e" ":lua require('snacks').explorer()<CR>" "File Explorer")
|
||||
# Find Files
|
||||
(n "<leader><space>" ":lua require('snacks').picker.smart()<CR>" "Smart Find Files")
|
||||
(n "<leader>f" ":lua require('snacks').picker.grep()<CR>" "Grep Files")
|
||||
];
|
||||
};
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
# Configuration applied to all of chloe's machines
|
||||
# Configuration applied to all of clover's machines
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
# packages for all machines
|
|
@ -21,6 +21,7 @@ in
|
|||
# packages to install for desktop environments (non-server)
|
||||
desktop = [
|
||||
git-town
|
||||
lazygit
|
||||
];
|
||||
# packages to install on all servers
|
||||
server = [ ];
|
9
users/clover/paperback/configuration.nix
Normal file
9
users/clover/paperback/configuration.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
_: {
|
||||
homebrew = {
|
||||
enable = true;
|
||||
casks = [
|
||||
"eloston-chromium"
|
||||
"db-browser-for-sqlite"
|
||||
];
|
||||
};
|
||||
}
|
|
@ -4,7 +4,6 @@
|
|||
# most of these are needed for my work environment.
|
||||
programs = {
|
||||
bun.enable = true;
|
||||
zed-editor.enable = true;
|
||||
zsh.profileExtra = ''
|
||||
_bun() {
|
||||
local context state line
|
||||
|
@ -14,6 +13,7 @@
|
|||
};
|
||||
home.packages = with pkgs; [
|
||||
doppler
|
||||
deno
|
||||
nodejs_22
|
||||
rustup
|
||||
typescript
|
|
@ -1,18 +1,11 @@
|
|||
# This definition is used by modules to customize as needed.
|
||||
{
|
||||
username = "clo"; # username
|
||||
name = "chloe caruso";
|
||||
name = "clover caruso";
|
||||
email = "account@paperclover.net";
|
||||
timeZone = "America/Los_Angeles";
|
||||
|
||||
dotfilesDir = "~/config"; # absolute path of the local repo
|
||||
|
||||
# Stylix/Theming
|
||||
theme = null;
|
||||
#font
|
||||
sexuality = "lesbian"; # hyfetch
|
||||
|
||||
# Default terminal command. NOTE: ghostty is not installed for you
|
||||
term = "ghostty"; # preferred $TERMINAL
|
||||
editor = "nvim"; # preferred $EDITOR
|
||||
}
|
20
users/clover/vim.nix
Normal file
20
users/clover/vim.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
_: {
|
||||
vim = {
|
||||
options = {
|
||||
linebreak = true;
|
||||
};
|
||||
git = {
|
||||
gitsigns.setupOpts = {
|
||||
current_line_blame = false;
|
||||
current_line_blame_opts = {
|
||||
virt_text = true;
|
||||
virt_text_pos = "right_align";
|
||||
delay = 25;
|
||||
ignore_whitespace = true;
|
||||
virt_text_priority = 100;
|
||||
use_focus = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
rec {
|
||||
username = "fish"; # username
|
||||
name = "Julia"; # name/identifier
|
||||
name = "Fish"; # name/identifier
|
||||
email = "fish@fishcat.fish"; # email (used for certain configurations)
|
||||
dotfilesDir = "~/config"; # absolute path of the local repo
|
||||
theme = "catppuccin-mocha"; # name of theme that stylix will use
|
Loading…
Reference in a new issue