Skip to content

Commit

Permalink
I be doin stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
addisonbeck committed Nov 25, 2024
1 parent 318ad23 commit c0bbd67
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 57 deletions.
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# Nix
# 🙈

## Installation

1. Fetch key
1. Sign in to iCloud
1. Run init script:

```bash
curl -s https://raw.githubusercontent.com/addisonbeck/nix/main/bootstrap.sh \
--output bootstrap.sh && \
bash bootstrap.sh
```
My terminal-centric systems configuration for darwin and a bit of nixOS.
There is definitely, for sure some stuff in here you haven't seen before but
it's an unapologetic mess.
6 changes: 3 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions system/with/user/me.nix
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
./with/program/toggle-theme.nix
./with/program/set-color-scheme.nix
./with/program/pika.nix
./with/program/lazysql.nix
#./with/program/azure-data-studio.nix
];

home.sessionPath = [];
Expand Down
1 change: 1 addition & 0 deletions system/with/user/with/program/azure-data-studio.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{pkgs, ...}: {home.packages = [pkgs.azuredatastudio];}
32 changes: 32 additions & 0 deletions system/with/user/with/program/lazysql.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
pkgs ? import <nixpkgs> {},
...
}:
let
# configContent = ''
# host = "localhost"
# port = 3306
# user = "user"
# password = "password"
# database = "dbname"
#
# [[queries]]
# name = "query1"
# sql = "SELECT * FROM table1"
#
# [[queries]]
# name = "query2"
# sql = "SELECT * FROM table2 WHERE column1 = "value""
#
# [logging]
# level = "INFO"
# file = "lazysql.log"
#
# [settings]
# timeout = 30
# retries = 3
# '';
in {
home.packages = [pkgs.lazysql];
# home.file.".config/lazysql/config.toml".text = configContent;
}
69 changes: 33 additions & 36 deletions system/with/user/with/program/neovim/auto-commands/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{...}: {
{ conf, ... }: {
autoCommands = [
# disable semantic highlighting
{
Expand Down Expand Up @@ -36,6 +36,12 @@
{
event = [
"BufEnter"
"FileChangedShellPost"
"Syntax"
"TextChanged"
"TextChangedI"
"InsertLeave"
"WinScrolled"
];
pattern = [
"*.markdown"
Expand All @@ -44,49 +50,40 @@
callback = {
__raw = ''
function()
local ts_utils = require 'nvim-treesitter.ts_utils'
local buf = vim.api.nvim_get_current_buf()
-- Function to get all function declarations in the current buffer
local function get_function_declarations()
-- Get the current buffer
-- Get the root node of the current buffer's syntax tree
local parser = vim.treesitter.get_parser(buf)
local tree = parser:parse()[1] -- The first tree (in case there are multiple trees for different languages)
-- Get the root node of the syntax tree
local function get_code_blocks()
local parser = vim.treesitter.get_parser(0)
local tree = parser:parse()[1]
local root = tree:root()
-- Function to recursively traverse the tree and find function declarations
local function find_functions(node)
local function find_code_blocks(node)
local result = {}
-- Check if the current node is a function declaration (for example, "function_declaration")
if node:type() == '@markup.raw.block.markdown' then
-- Get the start and end positions of the function declaration
local start_row, start_col, end_row, end_col = node:range()
table.insert(result, {start_row, start_col, end_row, end_col})
local function traverse(node)
if node:type() == 'fenced_code_block' then
local start_row, start_col, end_row, end_col = node:range()
table.insert(result, {start_row, start_col, end_row, end_col})
end
for child in node:iter_children() do
traverse(child)
end
end
traverse(node)
return result
end
-- Start from the root node and search for function declarations
local nodes = find_functions(root)
for node in nodes do
end
return find_code_blocks(root)
end
-- Example usage: Get all function declarations and print their positions
local functions = get_function_declarations()
local extmark_opts = {
virt_text = {{"<-- Symbol -->", "Comment"}}, -- You can customize this
virt_text_pos = 'eol', -- Position at the end of the line
}
for _, func in ipairs(functions) do
vim.api.nvim_buf_set_extmark(buf, 0, start_row, start_col, extmark_opts)
local code_blocks = get_code_blocks()
local namespace = vim.api.nvim_create_namespace('ab_md_code_blocks')
vim.api.nvim_buf_clear_namespace(0, namespace, 0, -1)
for _, node in ipairs(code_blocks) do
local start_row, start_col, end_row, end_col = unpack(node)
vim.api.nvim_buf_set_extmark(0, namespace, start_row, start_col, {
end_row = end_row,
end_col = end_col,
hl_group = "CodeFence",
hl_eol = true,
})
end
end
'';
Expand Down
5 changes: 5 additions & 0 deletions system/with/user/with/program/neovim/colors/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
background = "${conf.activeTheme.systemTheme}";
termguicolors = false;
};
highlight = {
CodeFence = {
bg = conf.themes.${conf.activeTheme.colorScheme}.${conf.activeTheme.systemTheme}.base01;
};
};
colorscheme = {
gruvbox = {
enable = conf.activeTheme.colorScheme == "gruvbox";
Expand Down
7 changes: 4 additions & 3 deletions system/with/user/with/program/neovim/commands/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
vimCommandName = "SearchLiveGrep";
vimKeymapBinding = {
modes = ["n" "v" "i"];
key = "<C-l>";
key = "<C-0>";
silent = true;
};
action.__raw = ''
Expand Down Expand Up @@ -482,7 +482,7 @@
vimCommandName = "SearchKeymaps";
vimKeymapBinding = {
modes = ["n" "v" "i"];
key = "<C-k>";
key = "<Space>k>";
silent = true;
};
action.__raw = (builtins.readFile ./search_keymaps.lua);
Expand Down Expand Up @@ -573,7 +573,7 @@
'';
vimCommandName = "FocusSplitDown";
vimKeymapBinding = {
key = "<c-j>";
key = "<C-j>";
modes = ["n" "v" "i"];
silent = true;
};
Expand Down Expand Up @@ -703,6 +703,7 @@
'';
};
};

in {
keymaps =
[
Expand Down
32 changes: 31 additions & 1 deletion system/with/user/with/program/neovim/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ in {
vimAlias = true;
opts = options;
colorschemes = (import ./colors {inherit conf;}).colorscheme;
highlight = (import ./colors {inherit conf;}).highlight;
plugins = (import ./plugins {inherit inputs pkgs;}).plugins;
extraPlugins = (import ./plugins {inherit inputs pkgs;}).extraPlugins;
autoCmd = (import ./auto-commands {}).autoCommands;
autoCmd = (import ./auto-commands {inherit conf;}).autoCommands;
keymaps =
[
# Custom nixvim style keymaps can be added here if needed, but I
Expand Down Expand Up @@ -67,6 +68,35 @@ in {
},
}
})
require("codecompanion").setup({
display = {
diff = {
provider = "mini_diff",
},
},
opts = {
log_level = "DEBUG",
},
strategies = {
chat = {
adapter = "copilot",
},
inline = {
adapter = "copilot",
},
},
adapters = {
anthropic = function()
return require("codecompanion.adapters").extend("copilot", {
schema = {
model = {
default = "claude-3.5-sonnet",
},
},
})
end,
},
})
-- require('satellite').setup({
-- current_only = false,
-- winblend = 0,
Expand Down
16 changes: 16 additions & 0 deletions system/with/user/with/program/neovim/plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
pkgs,
...
}: {
plugins.copilot-lua = {
enable = true;
};
plugins.mini = {
enable = true;
};

plugins.which-key.enable = false;
plugins.barbecue.enable = false; # This is cool
plugins.precognition.enable = false;
Expand Down Expand Up @@ -258,6 +265,15 @@
# hash = "sha256-WVOYouiEFeLkQBe1Ptazw/mIfzxmaQmOuEK8KlfMYoQ=";
# };
# })
(pkgs.vimUtils.buildVimPlugin {
name = "codecompanion.nvim";
src = pkgs.fetchFromGitHub {
owner = "olimorris";
repo = "codecompanion.nvim";
rev = "31c4d0917bf77340fd80f661f38b9ab6f18fd18e";
hash = "sha256-/mVb+oLJ5s6uPZJoQk+cE9WJEp89JfAx687c0+jw9gQ=";
};
})
inputs.where-am-i-nvim.packages.${pkgs.system}.default
];
}
6 changes: 4 additions & 2 deletions system/with/user/with/program/vscode.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{...}: {
programs.vscode.enable = true;
{ pkgs, ...}: {
programs.vscode = {
enable = true;
};
}

0 comments on commit c0bbd67

Please sign in to comment.