mirror of
https://github.com/harivansh-afk/nix.git
synced 2026-04-20 22:02:41 +00:00
chore: faster builds, fzf lua
This commit is contained in:
parent
80efbae1e9
commit
9541a345bf
8 changed files with 52 additions and 25 deletions
|
|
@ -96,6 +96,9 @@ function M.setup_integrations()
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local bufnr = args.buf
|
local bufnr = args.buf
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<C-f>", "<cmd>FzfLua files<cr>", { buffer = bufnr })
|
||||||
|
vim.keymap.set("n", "<C-s>", "<cmd>FzfLua live_grep<cr>", { buffer = bufnr })
|
||||||
|
|
||||||
vim.keymap.set("n", "gC", function()
|
vim.keymap.set("n", "gC", function()
|
||||||
show_all = not show_all
|
show_all = not show_all
|
||||||
require("canola").set_columns(show_all and detail_columns or base_columns)
|
require("canola").set_columns(show_all and detail_columns or base_columns)
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ return {
|
||||||
local opts = {
|
local opts = {
|
||||||
"default-title",
|
"default-title",
|
||||||
winopts = {
|
winopts = {
|
||||||
|
fullscreen = true,
|
||||||
border = "single",
|
border = "single",
|
||||||
preview = {
|
preview = {
|
||||||
layout = "vertical",
|
layout = "vertical",
|
||||||
|
|
@ -47,6 +48,18 @@ return {
|
||||||
fzf_opts = {
|
fzf_opts = {
|
||||||
["--layout"] = "reverse",
|
["--layout"] = "reverse",
|
||||||
},
|
},
|
||||||
|
files = {
|
||||||
|
winopts = { preview = { hidden = true } },
|
||||||
|
},
|
||||||
|
git_files = {
|
||||||
|
winopts = { preview = { hidden = true } },
|
||||||
|
},
|
||||||
|
grep = {
|
||||||
|
_headers = {},
|
||||||
|
},
|
||||||
|
live_grep = {
|
||||||
|
_headers = {},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
fzf.setup(opts)
|
fzf.setup(opts)
|
||||||
|
|
@ -58,18 +71,8 @@ return {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{ "<C-f>", "<cmd>FzfLua files<cr>" },
|
||||||
"<C-f>",
|
{ "<C-s>", "<cmd>FzfLua live_grep<cr>" },
|
||||||
function()
|
|
||||||
local fzf = require "fzf-lua"
|
|
||||||
local git_dir = vim.fn.system("git rev-parse --git-dir 2>/dev/null"):gsub("\n", "")
|
|
||||||
if vim.v.shell_error == 0 and git_dir ~= "" then
|
|
||||||
fzf.git_files()
|
|
||||||
else
|
|
||||||
fzf.files()
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{ "<leader>ff", "<cmd>FzfLua files<cr>" },
|
{ "<leader>ff", "<cmd>FzfLua files<cr>" },
|
||||||
{ "<leader>fg", "<cmd>FzfLua live_grep<cr>" },
|
{ "<leader>fg", "<cmd>FzfLua live_grep<cr>" },
|
||||||
{ "<leader>fb", "<cmd>FzfLua buffers<cr>" },
|
{ "<leader>fb", "<cmd>FzfLua buffers<cr>" },
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,13 @@ return {
|
||||||
local neocodeium = require "neocodeium"
|
local neocodeium = require "neocodeium"
|
||||||
neocodeium.setup()
|
neocodeium.setup()
|
||||||
|
|
||||||
vim.keymap.set("i", "<Right>", neocodeium.accept)
|
vim.keymap.set("i", "<Right>", function()
|
||||||
|
if neocodeium.visible() then
|
||||||
|
neocodeium.accept()
|
||||||
|
else
|
||||||
|
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Right>", true, false, true), "n", false)
|
||||||
|
end
|
||||||
|
end)
|
||||||
vim.keymap.set("i", "<A-w>", neocodeium.accept_word)
|
vim.keymap.set("i", "<A-w>", neocodeium.accept_word)
|
||||||
vim.keymap.set("i", "<A-a>", neocodeium.accept_line)
|
vim.keymap.set("i", "<A-a>", neocodeium.accept_line)
|
||||||
vim.keymap.set("i", "<A-e>", neocodeium.cycle_or_complete)
|
vim.keymap.set("i", "<A-e>", neocodeium.cycle_or_complete)
|
||||||
|
|
|
||||||
|
|
@ -8,19 +8,20 @@ let
|
||||||
sourceFile = ../config/devin/config.json;
|
sourceFile = ../config/devin/config.json;
|
||||||
targetDir = "${config.xdg.configHome}/devin";
|
targetDir = "${config.xdg.configHome}/devin";
|
||||||
targetFile = "${targetDir}/config.json";
|
targetFile = "${targetDir}/config.json";
|
||||||
bin = "${pkgs.coreutils}/bin";
|
coreutilsBin = "${pkgs.coreutils}/bin";
|
||||||
|
cmpBin = "${pkgs.diffutils}/bin/cmp";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Devin rewrites this file when settings change, so seed a mutable copy
|
# Devin rewrites this file when settings change, so seed a mutable copy
|
||||||
# instead of pointing the path at the read-only Nix store.
|
# instead of pointing the path at the read-only Nix store.
|
||||||
home.activation.installDevinConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
home.activation.installDevinConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
${bin}/mkdir -p "${targetDir}"
|
${coreutilsBin}/mkdir -p "${targetDir}"
|
||||||
|
|
||||||
if [ -f "${targetFile}" ] && ! ${bin}/cmp -s "${sourceFile}" "${targetFile}"; then
|
if [ -f "${targetFile}" ] && ! ${cmpBin} -s "${sourceFile}" "${targetFile}"; then
|
||||||
timestamp="$(${bin}/date +%Y%m%d%H%M%S)"
|
timestamp="$(${coreutilsBin}/date +%Y%m%d%H%M%S)"
|
||||||
${bin}/cp "${targetFile}" "${targetFile}.hm-bak.$timestamp"
|
${coreutilsBin}/cp "${targetFile}" "${targetFile}.hm-bak.$timestamp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${bin}/install -m 600 "${sourceFile}" "${targetFile}"
|
${coreutilsBin}/install -m 600 "${sourceFile}" "${targetFile}"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
co = "codex --dangerously-bypass-approvals-and-sandbox";
|
co = "codex --dangerously-bypass-approvals-and-sandbox";
|
||||||
ca = "cursor-agent";
|
ca = "cursor-agent";
|
||||||
agent-claude = "cursor-agent --model=claude-opus-4-7-thinking --force";
|
agent-claude = "cursor-agent --model=claude-opus-4-7-1M --force";
|
||||||
agent-codex = "cursor-agent --model=gpt-5.4-xhigh-fast --force";
|
agent-codex = "cursor-agent --model=gpt-5.4-xhigh-fast --force";
|
||||||
cc = "claude";
|
cc = "claude";
|
||||||
ch = "claude-handoff";
|
ch = "claude-handoff";
|
||||||
|
|
|
||||||
4
justfile
4
justfile
|
|
@ -15,10 +15,10 @@ build config='darwin':
|
||||||
switch config='darwin':
|
switch config='darwin':
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
if [[ "{{config}}" == "darwin" ]]; then
|
if [[ "{{config}}" == "darwin" ]]; then
|
||||||
sudo env PATH="$PATH" nix --extra-experimental-features 'nix-command flakes' run github:nix-darwin/nix-darwin/master#darwin-rebuild -- switch --flake path:.#{{config}}
|
sudo --set-home --preserve-env=PATH nix --extra-experimental-features 'nix-command flakes' run path:.#darwin-rebuild -- switch --flake path:.#{{config}}
|
||||||
else
|
else
|
||||||
backup_ext="hm-bak-$(date +%Y%m%d-%H%M%S)"
|
backup_ext="hm-bak-$(date +%Y%m%d-%H%M%S)"
|
||||||
nix --extra-experimental-features 'nix-command flakes' run github:nix-community/home-manager -- switch --flake path:.#{{config}} -b "$backup_ext"
|
nix --extra-experimental-features 'nix-command flakes' run path:.#home-manager -- switch --flake path:.#{{config}} -b "$backup_ext"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,22 @@
|
||||||
{ ... }:
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
{
|
{
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgs, ... }:
|
{ pkgs, system, ... }:
|
||||||
{
|
{
|
||||||
formatter = pkgs.nixfmt-tree;
|
formatter = pkgs.nixfmt-tree;
|
||||||
|
|
||||||
|
packages =
|
||||||
|
{
|
||||||
|
home-manager = inputs.home-manager.packages.${system}.home-manager;
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs (lib.hasSuffix "darwin" system) {
|
||||||
|
darwin-rebuild = inputs.nix-darwin.packages.${system}.darwin-rebuild;
|
||||||
|
};
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
deadnix
|
deadnix
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,9 @@
|
||||||
onActivation = {
|
onActivation = {
|
||||||
autoUpdate = false;
|
autoUpdate = false;
|
||||||
upgrade = false;
|
upgrade = false;
|
||||||
cleanup = "uninstall";
|
# `brew bundle --cleanup` is by far the slowest part of darwin activation
|
||||||
|
# on this machine. Keep switches fast and do cleanup manually when needed.
|
||||||
|
cleanup = "none";
|
||||||
};
|
};
|
||||||
|
|
||||||
taps = [
|
taps = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue