Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade inputs #96

Merged
merged 5 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions attrs/treesitterGrammars.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
p.tsx
p.typescript
p.vim
p.vimdoc
p.yaml
]
5 changes: 1 addition & 4 deletions dotfiles/fish/config.fish
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
source $HOME/.config/fish/secrets.fish

alias show-ip "ip addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'"
bass source $HOME/.config/fish/use-nix.sh

export PATH="/usr/local/bin:$PATH"
export EDITOR=vi

bass source $HOME/.config/fish/use-nix.sh

starship init fish | source

direnv hook fish | source
Expand Down
Empty file added dotfiles/fish/functions.fish
Empty file.
5 changes: 5 additions & 0 deletions dotfiles/fish/functions/unreleased-commits.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function unreleased-commits;
set latest (git describe --abbrev=0)
echo "Latest tag is $latest"
git log --oneline --no-decorate (git describe --abbrev=0)..HEAD;
end
4 changes: 0 additions & 4 deletions dotfiles/lazygit.yml

This file was deleted.

24 changes: 5 additions & 19 deletions dotfiles/neovim/ftplugin/http.lua
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
-- keymappings

local restNvim = require('rest-nvim')

local function selectEnv(envFile)
restNvim.select_env(envFile)
end

vim.api.nvim_create_user_command(
"HttpSelectEnv",
function(opts) selectEnv(opts.fargs[1] .. ".env") end,
{ nargs = 1 }
)

-- -- run the command in this file
vim.api.nvim_set_keymap("n", "<leader>hel", "<cmd>:HttpSelectEnv local<CR>",
-- run the command in this file
vim.api.nvim_set_keymap("n", "<leader>hel", "<cmd>:Rest env set local.env<CR>",
{ noremap = true, desc = "Use local .env file for rest-nvim" })
vim.api.nvim_set_keymap("n", "<leader>het", "<cmd>:HttpSelectEnv test<CR>",
vim.api.nvim_set_keymap("n", "<leader>het", "<cmd>:Rest env set test.env<CR>",
{ noremap = true, desc = "Use test .env file for rest-nvim" })
vim.api.nvim_set_keymap("n", "<leader>hep", "<cmd>:HttpSelectEnv prod<CR>",
vim.api.nvim_set_keymap("n", "<leader>hep", "<cmd>:Rest env set prod.env<CR>",
{ noremap = true, desc = "Use prod .env file for rest-nvim" })
vim.api.nvim_set_keymap("n", "<leader>hs", ":lua require('rest-nvim').run()<CR>",
vim.api.nvim_set_keymap("n", "<leader>hs", "<cmd>:Rest run<CR>",
{ noremap = true, desc = "Send http request" })
4 changes: 0 additions & 4 deletions dotfiles/neovim/lua/custom-lsp-config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ vim.api.nvim_set_keymap("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", { noremap
vim.api.nvim_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>",
{ noremap = true, desc = "Go to implementation" })
vim.api.nvim_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", { noremap = true, desc = "Go to references" })
vim.api.nvim_set_keymap("n", "gds", "<cmd>lua vim.lsp.buf.document_symbol()<CR>",
{ noremap = true, desc = "Go to document symbol" })
vim.api.nvim_set_keymap("n", "gws", "<cmd>lua vim.lsp.buf.workspace_symbol()<CR>",
{ noremap = true, desc = "Go to workspace symbol" })
vim.api.nvim_set_keymap("n", "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>",
{ noremap = true, desc = "Rename symbol" })
vim.api.nvim_set_keymap("n", "<leader>cf", "<cmd>lua vim.lsp.buf.format { async = true }<CR>",
Expand Down
68 changes: 46 additions & 22 deletions dotfiles/neovim/lua/custom-rest-nvim.lua
Original file line number Diff line number Diff line change
@@ -1,39 +1,63 @@
require("rest-nvim").setup({
-- Open request results in a horizontal split
result_split_horizontal = false,
-- Keep the http file buffer above|left when split horizontal|vertical
result_split_in_place = false,
-- Skip SSL verification, useful for unknown certificates
skip_ssl_verification = false,
-- Encode URL before making request
encode_url = true,
-- Highlight request on run
highlight = {
enabled = true,
timeout = 150,
},
result = {
-- toggle showing URL, HTTP info, headers at top the of result window
show_url = true,
-- show the generated curl command in case you want to launch
-- the same request via the terminal (can be verbose)
show_curl_command = false,
show_http_info = true,
show_headers = true,
-- executables or functions for formatting response body [optional]
-- set them to false if you want to disable them
formatters = {
json = "jq",
html = function(body)
return vim.fn.system({ "tidy", "-i", "-q", "-" }, body)
end
split = {
horizontal = false,
in_place = false,
stay_in_current_window_after_split = true,
},
behavior = {
decode_url = true,
show_info = {
url = true,
headers = true,
http_info = true,
curl_command = true,
},
statistics = {
enable = true,
---@see https://curl.se/libcurl/c/curl_easy_getinfo.html
stats = {
{ "total_time", title = "Time taken:" },
{ "size_download_t", title = "Download size:" },
},
},
formatters = {
json = "jq",
html = function(body)
if vim.fn.executable("tidy") == 0 then
return body, { found = false, name = "tidy" }
end
local fmt_body = vim.fn.system({
"tidy",
"-i",
"-q",
"--tidy-mark", "no",
"--show-body-only", "auto",
"--show-errors", "0",
"--show-warnings", "0",
"-",
}, body):gsub("\n$", "")

return fmt_body, { found = true, name = "tidy" }
end,
},
},
keybinds = {
buffer_local = true,
prev = "H",
next = "L",
},
},
-- Jump to request line on run
jump_to_request = false,
env_file = '.env',
custom_dynamic_variables = {},
yank_dry_run = true,
})

-- set files with .http extension to "http" filetype
Expand Down
5 changes: 0 additions & 5 deletions dotfiles/neovim/lua/git-config.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
-- use git blame to show blame in status line
local git_blame = require("gitblame")
vim.g.gitblame_enabled = 0

-- launch git status and git blame conveniently
vim.api.nvim_set_keymap("n", "<space>gg", "<cmd>:LazyGit<CR>", { noremap = true, desc = "Open LazyGit" })
vim.api.nvim_set_keymap("n", "<space>gb", "<cmd>:GitBlameToggle<CR>", { noremap = true, desc = "Toggle git blame" })

-- set custom config location for lazygit
vim.g.lazygit_use_custom_config_file_path = 1;
vim.g.lazygit_config_file_path = "$HOME/.config/lazygit/config.yml"
7 changes: 3 additions & 4 deletions dotfiles/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "xclip -selection c"

# use truecolor
set -g default-terminal "xterm-256color"
set-option -ga terminal-overrides ",xterm-256color:Tc"
set -g default-terminal "tmux-256color"
set-option -ga terminal-overrides ",tmux-256color:Tc"

# emacs key bindings in tmux command prompt (prefix + :) are better than
# vi keys, even for vim users
Expand All @@ -26,8 +26,7 @@ set -g status-keys emacs
bind C-b send-prefix

# soften status bar color from harsh green to light gray
set -g status-bg "#62466B"
set -g status-fg '#aaaaaa'
set -g status-style bg="#803abc",fg="#aaaaaa"

# nice border colors
set -g pane-border-style fg="#62466B"
Expand Down
24 changes: 12 additions & 12 deletions flake.lock

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

4 changes: 2 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
description = "@jisantuc home manager flake";

inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
nixpkgs.url = "nixpkgs/nixos-24.05";

home-manager.url = "github:nix-community/home-manager/release-23.11";
home-manager.url = "github:nix-community/home-manager/release-24.05";

flake-utils.url = "github:numtide/flake-utils";
};
Expand Down
39 changes: 25 additions & 14 deletions home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ in
set -gx CACHIX_AUTH_TOKEN ${secrets.cachixToken}
'';

xdg.configFile."lazygit/config.yml".text = builtins.readFile ./dotfiles/lazygit.yml;

xdg.configFile."direnv/lib" = {
source = ./dotfiles/direnv/lib;
recursive = true;
Expand All @@ -102,6 +100,14 @@ in

lazygit = {
enable = true;
settings = {
gui = {
nerdFontsVersion = "3";
theme = {
lightTheme = true;
};
};
};
};

neovim = {
Expand All @@ -114,18 +120,23 @@ in
inherit pkgs treesitterGrammars;
};

extraPackages = with pkgs; [
dhall-lsp-server
fzf
kotlin-language-server
lua-language-server
nil
nodePackages.typescript-language-server
pyright
silicon
terraform-ls
];

extraLuaPackages = (ps:
[
ps.lua-curl
ps.mimetypes
ps.xml2lua
]);
extraPackages = with pkgs;
[
dhall-lsp-server
fzf
lua-language-server
nil
nodePackages.typescript-language-server
pyright
silicon
terraform-ls
];
};

direnv = {
Expand Down
Binary file added lua-mimetypes-1.0.0-3.tar.gz
Binary file not shown.
4 changes: 3 additions & 1 deletion scripts/switch
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ function build_macos_x86() {
}

function activate_home() {
nix develop nixpkgs#bash --command ./result/activate
nix run nixpkgs#bash -- ./result/activate
}

if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
if [ "${1:-}" = "--help" ]; then
usage
else
echo "Building home derivation"
case "${1}" in
linux-x86) build_linux;;
macos-arm) build_macos_arm;;
Expand All @@ -38,6 +39,7 @@ if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
exit 1;
esac

echo "Activating home"
activate_home
fi
fi
Expand Down