Compare commits

..

1 commit

Author SHA1 Message Date
4be4a7979f
feat: add "ubuntu" config for containers 2024-12-16 14:08:48 +01:00
36 changed files with 346 additions and 605 deletions

13
.envrc
View file

@ -1,7 +1,8 @@
export DIRENV_WARN_TIMEOUT=20s use flake .nix
eval "$(devenv direnvrc)" if on_git_branch; then
echo
# The use_devenv function supports passing flags to the devenv command git status --short --branch
# For example: use devenv --impure --option services.postgres.enable:bool true echo
use devenv git fetch
fi

10
.gitignore vendored
View file

@ -2,13 +2,3 @@
# Ignore build outputs from performing a nix-build or `nix build` command # Ignore build outputs from performing a nix-build or `nix build` command
result result
result-* result-*
# Devenv
.devenv*
devenv.local.nix
# direnv
.direnv
# pre-commit
.pre-commit-config.yaml

25
.nix/flake.lock generated Normal file
View file

@ -0,0 +1,25 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1729665710,
"narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=",
"rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d",
"revCount": 696158,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.696158%2Brev-2768c7d042a37de65bb1b5b3268fc987e534c49d/0192bd28-d6c0-735c-ab86-8ab9d12f7d62/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

32
.nix/flake.nix Normal file
View file

@ -0,0 +1,32 @@
{
description = "A flake editing flake";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs = { nixpkgs, ... }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell.override
{
# Override stdenv in order to change compiler:
# stdenv = pkgs.clangStdenv;
}
{
packages = with pkgs; [
pre-commit
commitizen
];
shellHook = ''
pre-commit install --allow-missing-config --hook-type pre-commit --hook-type commit-msg
'';
};
});
};
}

27
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,27 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: detect-private-key
- id: mixed-line-ending
- repo: https://github.com/commitizen-tools/commitizen
rev: v3.27.0
hooks:
- id: commitizen
stages: [commit-msg]
- repo: local
hooks:
- id: home-manager-check
name: Home Manager Config Check
entry: home-manager switch --dry-run
language: system
pass_filenames: false
exclude: ^docs/

View file

@ -1,103 +0,0 @@
{
"nodes": {
"devenv": {
"locked": {
"dir": "src/modules",
"lastModified": 1747116279,
"owner": "cachix",
"repo": "devenv",
"rev": "79e442e0b24f0f45db0d853d88d3d27dff422b3b",
"type": "github"
},
"original": {
"dir": "src/modules",
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1747046372,
"owner": "edolstra",
"repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1746537231,
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "fa466640195d38ec97cf0493d6d6882bc4d14969",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1746807397,
"owner": "cachix",
"repo": "devenv-nixpkgs",
"rev": "c5208b594838ea8e6cca5997fbf784b7cca1ca90",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "rolling",
"repo": "devenv-nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"devenv": "devenv",
"git-hooks": "git-hooks",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": [
"git-hooks"
]
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,27 +0,0 @@
{pkgs, ...}: {
packages = with pkgs; [
watchexec
];
git-hooks = {
hooks = {
alejandra.enable = true;
check-case-conflicts.enable = true;
check-merge-conflicts.enable = true;
commitizen.enable = true;
deadnix.enable = true;
detect-private-keys.enable = true;
end-of-file-fixer.enable = true;
markdownlint.enable = true;
mdformat.enable = true;
};
hooks.home-manager-check = {
enable = true;
name = "Home Manager Config Check";
entry = "home-manager switch --dry-run";
pass_filenames = false;
excludes = ["^docs/"];
};
};
}

View file

@ -1,15 +0,0 @@
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
inputs:
nixpkgs:
url: github:cachix/devenv-nixpkgs/rolling
# If you're using non-OSS software, you can set allowUnfree to true.
# allowUnfree: true
# If you're willing to use a package that's vulnerable
# permittedInsecurePackages:
# - "openssl-1.1.1w"
# If you have more than one devenv you can merge them
#imports:
# - ./backend

12
flake.lock generated
View file

@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1750730235, "lastModified": 1734093295,
"narHash": "sha256-rZErlxiV7ssvI8t7sPrKU+fRigNc2KvoKZG3gtUtK50=", "narHash": "sha256-hSwgGpcZtdDsk1dnzA0xj5cNaHgN9A99hRF/mxMtwS4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "d07e9cceb4994ed64a22b9b36f8b76923e87ac38", "rev": "66c5d8b62818ec4c1edb3e941f55ef78df8141a8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -22,11 +22,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1750506804, "lastModified": 1734119587,
"narHash": "sha256-VLFNc4egNjovYVxDGyBYTrvVCgDYgENp5bVi9fPTDYc=", "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4206c4cb56751df534751b058295ea61357bbbaa", "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -59,6 +59,27 @@
vimwikiPath = "~/vimwiki"; vimwikiPath = "~/vimwiki";
}; };
}; };
"ubuntu" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./shell
./git
./gpg
./neovim
./horsch.nix
];
extraSpecialArgs = {
user = "ubuntu";
userName = "Michael Mandl";
userEmail = "michael.mandl@horsch.com";
gpgSigningKey = "088ED38F036C7AF2";
gpgSSHKeys = [ "AEB2BF3FF9CF9529E9A3C6F1A202D21686FF9278" ];
theme = "dark";
vimwikiPath = "~/vimwiki";
};
};
}; };
}; };
} }

View file

@ -1,17 +1,9 @@
{ pkgs, userName, userEmail, gpgSigningKey, ... }:
{ {
pkgs,
userName,
userEmail,
gpgSigningKey,
...
}: {
programs = { programs = {
less.enable = true; less.enable = true;
git-credential-oauth.enable = true; git-credential-oauth.enable = true;
git-worktree-switcher = {
enable = true;
enableZshIntegration = true;
};
git = { git = {
enable = true; enable = true;
@ -24,24 +16,9 @@
signByDefault = true; signByDefault = true;
}; };
delta = {
enable = true;
options = {
dark = true;
theme = "Solarized (dark)";
side-by-side = true;
line-numbers = true;
true-color = "always";
plus-style = "syntax \"#003800\"";
minus-style = "syntax \"#380000\"";
};
};
difftastic = { difftastic = {
enable = false; enable = true;
background = "light"; background = "light";
display = "side-by-side-show-both";
enableAsDifftool = true;
}; };
lfs = { lfs = {
@ -49,34 +26,14 @@
}; };
extraConfig = { extraConfig = {
branch.sort = "-committerdate"; core.editor = "nvim";
core.pager = "less -FX";
core = { diff.ignoreSubmodules = "none";
editor = "nvim";
fsmonitor = true;
untrackedCache = true;
};
column.ui = "auto"; fetch.parallel = 8;
fetch.writeCommitGraph = true;
commit.verbose = true; fetch.recurseSubmodules = true;
diff = {
algorithm = "histogram";
colorMoved = "plain";
ignoreSubmodules = "none";
mnemonicPrefix = true;
renames = true;
};
fetch = {
all = true;
parallel = 8;
prune = true;
pruneTags = true;
recurseSubmodules = true;
writeCommitGraph = true;
};
format.pretty = "format:%C(yellow)%h %Cblue%>(12)%ad %C(red)%G? %Cgreen%<(7,trunc)%aN%Cred%d %Creset%s"; format.pretty = "format:%C(yellow)%h %Cblue%>(12)%ad %C(red)%G? %Cgreen%<(7,trunc)%aN%Cred%d %Creset%s";
@ -84,49 +41,28 @@
log.date = "relative"; log.date = "relative";
merge = { merge.ff = false;
conflictstyle = "zdiff3"; merge.tool = "nvim";
ff = false;
tool = "nvim";
};
mergetool.nvim.cmd = "nvim -d $BASE $LOCAL $REMOTE $MERGED -c 'DiffviewOpen'"; mergetool.nvim.cmd = "nvim -f -c \"Gdiffsplit!\" \"$MERGED\"";
mergetool.nvim.trustExitCode = false;
mergetool.prompt = false; mergetool.prompt = false;
pager.difftool = true; pager.difftool = true;
pull.rebase = true; pull.rebase = true;
push = { push.recurseSubmodules = "on-demand";
autoSetupRemote = true;
default = "simple";
followTags = true;
recurseSubmodules = "on-demand";
};
rebase = { rebase.autostash = true;
qutoSquash = true;
autoStash = true;
updateRefs = true;
};
rerere = { rerere.enabled = true;
autoupdate = true;
enabled = true;
};
status.submoduleSummary = true; status.submoduleSummary = true;
submodule.fetchJobs = 8; submodule.fetchJobs = 8;
submodule.recurse = true; submodule.recurse = true;
tag.sort = "version:refname"; worktree.guessRemote = true;
worktree = {
guessRemote = true;
useRelativePaths = true;
};
}; };
aliases = { aliases = {
@ -165,5 +101,26 @@
git -C ''${dir}/.base checkout --detach HEAD git -C ''${dir}/.base checkout --detach HEAD
git -C ''${dir}/.base worktree add ../''${branch} git -C ''${dir}/.base worktree add ../''${branch}
'') '')
(writeShellScriptBin "git-make-relative" ''
gitfile=''${1}
if [[ -z ''${gitfile} ]]; then
gitfile=".git"
fi
if [[ ! -f ''${gitfile} ]]; then
echo "file ''${gitfile} does not exist"
exit 1
fi
gitdir=$(grep "gitdir:" ''${gitfile} | cut -d: -f2 | xargs)
rel_gitdir=$(realpath -s --relative-to=. ''${gitdir})
echo "relative path: ''${rel_gitdir}"
sed -i -e "s,gitdir:.*,gitdir: ''${rel_gitdir}," ''${gitfile}
'')
]; ];
} }

View file

@ -4,7 +4,7 @@
services.gpg-agent = { services.gpg-agent = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
pinentry.package = pkgs.pinentry-curses; pinentryPackage = pkgs.pinentry-curses;
enableSshSupport = true; enableSshSupport = true;
sshKeys = gpgSSHKeys; sshKeys = gpgSSHKeys;
defaultCacheTtl = 3600 * 12; defaultCacheTtl = 3600 * 12;

View file

@ -1,43 +1,11 @@
{ ... }:
{ {
pkgs, programs.gh = {
lib, enable = true;
...
}: {
nixpkgs.config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"gh-copilot"
];
home.packages = with pkgs; [ settings = {
delta git_protocol = "ssh";
];
programs = {
gh = {
enable = true;
settings = {
git_protocol = "ssh";
};
extensions = with pkgs; [
gh-copilot
gh-dash
];
};
gh-dash = {
enable = true;
settings = {
defaults = {
preview = {
open = true;
width = 64;
};
};
pager.diff = "delta";
};
}; };
}; };
} }

View file

@ -1,4 +1,6 @@
{...}: { { ... }:
{
programs = { programs = {
ssh = { ssh = {
enable = true; enable = true;
@ -15,7 +17,7 @@
}; };
}; };
Fusion-USB = { Fusion-USB = {
host = "fusion-usb 172.16.0.1"; host = "fusion-usb fusion 172.16.0.1";
user = "root"; user = "root";
hostname = "172.16.0.1"; hostname = "172.16.0.1";
checkHostIP = false; checkHostIP = false;
@ -26,7 +28,7 @@
}; };
}; };
Fusion-Wifi = { Fusion-Wifi = {
host = "fusion-wifi fusion 172.16.1.1"; host = "fusion-wifi 172.16.1.1";
user = "root"; user = "root";
hostname = "172.16.1.1"; hostname = "172.16.1.1";
checkHostIP = false; checkHostIP = false;

View file

@ -1,5 +1,6 @@
{...}: { { ... }:
programs.zsh.initContent = '' {
programs.zsh.initExtra = ''
if [ -f $HOME/.nix-profile/etc/profile.d/nix.sh ]; if [ -f $HOME/.nix-profile/etc/profile.d/nix.sh ];
then then
source $HOME/.nix-profile/etc/profile.d/nix.sh source $HOME/.nix-profile/etc/profile.d/nix.sh
@ -53,11 +54,8 @@
local ssh_login="fusion" local ssh_login="fusion"
local update_file=''${1} local update_file=''${1}
local fzf_preview='stat --printf "%n\nSize: %s bytes\nModified: %y" {}'
if [ -z ''${update_file} ]; then if [ -z ''${update_file} ]; then
update_file=$(find build/tmp/deploy/images -name "*.swu" -type f \ update_file=$(find build/tmp/deploy/images -name "*.swu" -type f | fzf --select-1)
| fzf --select-1 --exit-0 --header "Select a update file" --preview=''${fzf_preview} --preview-window=top)
fi fi
if [ -z ''${update_file} ]; then if [ -z ''${update_file} ]; then
@ -99,7 +97,7 @@
local wic_file=''${2} local wic_file=''${2}
if [ -z ''${bootloader_file} ]; then if [ -z ''${bootloader_file} ]; then
bootloader_file=$(find build/tmp/deploy/images -name "imx-boot-horsch-*" -type f \ bootloader_file=$(find build/tmp/deploy/images -name "imx-boot-horsch-fusion-sd*" -type f \
| fzf --select-1 --exit-0 --header "Select a bootloader file" --preview=''${fzf_preview} --preview-window=top) | fzf --select-1 --exit-0 --header "Select a bootloader file" --preview=''${fzf_preview} --preview-window=top)
fi fi
@ -134,16 +132,5 @@
--get \ --get \
| jq | bat | jq | bat
} }
function hb-roots {
curl --silent \
--location "https://hawkbit-smartcan.horsch.com/rest/v1/softwaremodules" \
--header "Content-Type: application/json" \
--header "Authorization: Basic ''$hawkbitToken" \
--data "q=type==rootfs-smartcan" \
--data "sort=id:DESC" \
--get \
| jq | bat
}
''; '';
} }

View file

@ -1,38 +0,0 @@
require("copilot").setup({
copilot_model = "claude-4-sonnet"
})
require("blink-copilot").setup({})
require("blink-cmp").setup({
completion = {
documentation = { auto_show = true, auto_show_delay_ms = 500 },
ghost_text = { enabled = true },
list = {
selection = { preselect = false, auto_insert = true },
},
},
keymap = {
preset = "default",
["<Tab>"] = { "select_next", "fallback" },
["<S-Tab>"] = { "select_prev", "fallback" },
["<CR>"] = { "accept", "fallback" },
},
signature = { enabled = true },
sources = {
default = { "copilot", "lsp", "buffer", "path", "cmdline" },
per_filetype = {
codecompanion = { "codecompanion" }
},
providers = {
copilot = {
name = "copilot",
module = "blink-copilot",
score_offset = 100,
async = true,
}
}
},
})

View file

@ -1,35 +0,0 @@
local codecompanion = require("codecompanion")
vim.g.codecompanion_auto_tool_mode = true
codecompanion.setup({
strategies = {
chat = {
adapter = "copilot",
tools = {
opts = {
auto_submit_errors = true,
auto_submit_success = true,
requires_approval = false,
}
}
},
inline = {
adapter = "copilot",
},
cmd = {
adapter = "copilot",
},
},
adapters = {
copilot = function()
return require("codecompanion.adapters").extend("copilot", {
schema = {
model = {
default = "claude-sonnet-4",
},
},
})
end,
}
})

View file

@ -1,26 +1,6 @@
local dap = require("dap") local dap = require("dap")
local dapui = require("dapui") local dapui = require("dapui")
dap.adapters.lldb = {
type = "executable",
command = "lldb-dap",
name = "lldb",
}
dap.configurations.cpp = {
{
name = "Launch",
type = "lldb",
request = "launch",
program = function()
return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
end,
cwd = "${workspaceFolder}",
stopOnEntry = false,
args = {},
},
}
dapui.setup() dapui.setup()
vim.fn.sign_define("DapBreakpoint", { text = "🔴", texthl = "", linehl = "", numhl = "" }) vim.fn.sign_define("DapBreakpoint", { text = "🔴", texthl = "", linehl = "", numhl = "" })

View file

@ -1,9 +1,8 @@
{ pkgs, theme, vimwikiPath, ... }:
{ {
pkgs, # symlink for a stable path
theme, home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb;
vimwikiPath,
...
}: {
programs = { programs = {
neovim = { neovim = {
enable = true; enable = true;
@ -13,33 +12,37 @@
# theme # theme
nvim-solarized-lua nvim-solarized-lua
# keep window layout when deleting buffers
vim-bbye
# auto-close brackets, etc # auto-close brackets, etc
nvim-autopairs nvim-autopairs
# trailing whirespaces
vim-better-whitespace
# better wildmenu # better wildmenu
wilder-nvim wilder-nvim
# better quickfix # undo-tree
undotree
# quickfix
nvim-bqf nvim-bqf
# ui
dressing-nvim
# session handling # session handling
project-nvim
auto-session auto-session
# escape handling
better-escape-nvim
nvim-treesitter.withAllGrammars nvim-treesitter.withAllGrammars
nvim-treesitter-textobjects nvim-treesitter-textobjects
nvim-ts-context-commentstring nvim-ts-context-commentstring
markdown-preview-nvim # use({ "iamcco/markdown-preview.nvim", run = ":call mkdp#util#install()" }) markdown-preview-nvim # use({ "iamcco/markdown-preview.nvim", run = ":call mkdp#util#install()" })
render-markdown-nvim
toggleterm-nvim toggleterm-nvim
nvim-notify nvim-notify
comment-nvim comment-nvim
lualine-nvim lualine-nvim
tabline-nvim
indent-blankline-nvim indent-blankline-nvim
plenary-nvim plenary-nvim
vim-illuminate vim-illuminate
@ -52,11 +55,21 @@
vim-flog vim-flog
git-blame-nvim git-blame-nvim
nvim-web-devicons # used by diffview-nvim nvim-web-devicons # used by diffview-nvim
diffview-nvim
# snippets
friendly-snippets
luasnip
# auto-completion # auto-completion
blink-cmp nvim-cmp
blink-copilot cmp-nvim-lsp
cmp-buffer
cmp-path
cmp-cmdline
cmp-nvim-lua
cmp_luasnip
cmp-calc
cmp-nvim-lsp-signature-help
# telescope # telescope
telescope-nvim telescope-nvim
@ -67,15 +80,10 @@
nvim-lspconfig nvim-lspconfig
lsp-status-nvim lsp-status-nvim
rustaceanvim rustaceanvim
lazydev-nvim neodev-nvim
none-ls-nvim none-ls-nvim
lsp_lines-nvim lsp_lines-nvim
lspkind-nvim lsp-inlayhints-nvim
# Copilot
copilot-lua
copilot-cmp
codecompanion-nvim
# debugging # debugging
nvim-dap nvim-dap
@ -83,12 +91,6 @@
# vim-wiki # vim-wiki
vimwiki vimwiki
# firenvim
firenvim
# tmux
vim-tmux-navigator
]; ];
withNodeJs = true; withNodeJs = true;
@ -109,14 +111,12 @@
texlab texlab
nixd nixd
nixpkgs-fmt nixpkgs-fmt
pyright bitbake-language-server
(python3.withPackages (ps: with ps; [
(python3.withPackages (ps: pep8
with ps; [ autopep8
pep8 python-lsp-server
autopep8 ]))
python-lsp-server
]))
#clipboard #clipboard
xclip xclip
@ -137,18 +137,17 @@
require("local_toggleterm") require("local_toggleterm")
require("local_notify") require("local_notify")
require("local_comment") require("local_comment")
require("local_lualine")
if vim.g.started_by_firenvim ~= true then require("local_tabline")
require("local_lualine")
end
require("local_indent-blankline") require("local_indent-blankline")
require("local_gitsigns") require("local_gitsigns")
require("local_blink-cmp") require("local_luasnip")
require("local_nvim-cmp")
require("local_telescope") require("local_telescope")
require("local_themes").setup("${theme}") require("local_themes").setup("${theme}")
require("local_project-nvim")
require("local_dap") require("local_dap")
require("local_illuminate") require("local_illuminate")
require("local_wilder") require("local_wilder")
@ -158,26 +157,7 @@
vim.g.gitblame_date_format = "%r" vim.g.gitblame_date_format = "%r"
require("nvim-autopairs").setup({}) require("nvim-autopairs").setup({})
require("neogen").setup({ snippet_engine = "luasnip" })
require("local_firenvim")
require("local_codecompanion")
require("diffview").setup({
view = {
merge_tool = {
layout = "diff4_mixed",
disable_diagnostics = true,
}
}
})
require("render-markdown").setup({
file_types = { "markdown", "vimwiki", "copilot-chat" },
})
vim.g.strip_whitespace_on_save = 1
vim.g.strip_whitespace_confirm = 0
''; '';
}; };
}; };
@ -192,17 +172,18 @@
home.file.".config/nvim/lua/local_notify.lua".source = ./notify.lua; home.file.".config/nvim/lua/local_notify.lua".source = ./notify.lua;
home.file.".config/nvim/lua/local_comment.lua".source = ./comment.lua; home.file.".config/nvim/lua/local_comment.lua".source = ./comment.lua;
home.file.".config/nvim/lua/local_lualine.lua".source = ./lualine.lua; home.file.".config/nvim/lua/local_lualine.lua".source = ./lualine.lua;
home.file.".config/nvim/lua/local_tabline.lua".source = ./tabline.lua;
home.file.".config/nvim/lua/local_indent-blankline.lua".source = ./indent-blankline.lua; home.file.".config/nvim/lua/local_indent-blankline.lua".source = ./indent-blankline.lua;
home.file.".config/nvim/lua/local_gitsigns.lua".source = ./gitsigns.lua; home.file.".config/nvim/lua/local_gitsigns.lua".source = ./gitsigns.lua;
home.file.".config/nvim/lua/local_blink-cmp.lua".source = ./blink-cmp.lua; home.file.".config/nvim/lua/local_luasnip.lua".source = ./luasnip.lua;
home.file.".config/nvim/lua/local_nvim-cmp.lua".source = ./nvim-cmp.lua;
home.file.".config/nvim/lua/local_telescope.lua".source = ./telescope.lua; home.file.".config/nvim/lua/local_telescope.lua".source = ./telescope.lua;
home.file.".config/nvim/lua/local_themes.lua".source = ./themes.lua; home.file.".config/nvim/lua/local_themes.lua".source = ./themes.lua;
home.file.".config/nvim/lua/local_vimwiki.lua".source = ./vimwiki.lua; home.file.".config/nvim/lua/local_vimwiki.lua".source = ./vimwiki.lua;
home.file.".config/nvim/lua/local_project-nvim.lua".source = ./project-nvim.lua;
home.file.".config/nvim/lua/local_dap.lua".source = ./dap.lua; home.file.".config/nvim/lua/local_dap.lua".source = ./dap.lua;
home.file.".config/nvim/lua/local_illuminate.lua".source = ./illuminate.lua; home.file.".config/nvim/lua/local_illuminate.lua".source = ./illuminate.lua;
home.file.".config/nvim/lua/local_wilder.lua".source = ./wilder.lua; home.file.".config/nvim/lua/local_wilder.lua".source = ./wilder.lua;
home.file.".config/nvim/lua/local_firenvim.lua".source = ./firenvim.lua;
home.file.".config/nvim/lua/local_codecompanion.lua".source = ./codecompanion.lua;
} }

View file

@ -1,38 +0,0 @@
if vim.g.started_by_firenvim ~= true then
return
end
vim.g.firenvim_config = {
globalSettings = { alt = "all" },
localSettings = {
[".*"] = {
cmdline = "neovim",
content = "text",
priority = 0,
selector = "textarea",
takeover = "never"
}
}
}
vim.api.nvim_create_autocmd('UIEnter', {
callback = function()
local client = vim.api.nvim_get_chan_info(vim.v.event.chan).client
if client ~= nil and client.name == "Firenvim" then
vim.o.laststatus = 0
end
end
})
vim.api.nvim_create_autocmd({ 'TextChanged', 'TextChangedI' }, {
callback = function()
if vim.g.timer_started == true then
return
end
vim.g.timer_started = true
vim.fn.timer_start(500, function()
vim.g.timer_started = false
vim.cmd('silent write')
end)
end
})

View file

@ -12,19 +12,19 @@ nnoremap("<C-k>", ":wincmd k<CR>")
nnoremap("<C-l>", ":wincmd l<CR>") nnoremap("<C-l>", ":wincmd l<CR>")
-- Switch buffers -- Switch buffers
nnoremap("<C-PageDown>", ":bnext<CR>") nnoremap("<C-PageDown>", ":TablineBufferNext<CR>")
nnoremap("<C-PageUp>", ":bprevious<CR>") nnoremap("<C-PageUp>", ":TablineBufferPrevious<CR>")
-- fugitive -- fugitive
nnoremap("<leader>g", ":0Git<CR>") nnoremap("<leader>g", ":0Git<CR>")
-- vim-flog -- vim-flog
nnoremap("<leader>G", ":Flog -all -date=relative -open-cmd=new<CR>") nnoremap("<leader>G", ":Flog -all -date=relative -open-cmd=new<CR>")
nnoremap("<leader>F", ":Flog -path=% -date=relative -open-cmd=new<CR>")
-- telescope -- telescope
local telescope = require("telescope.builtin") local telescope = require("telescope.builtin")
local telescope_themes = require("telescope.themes") local telescope_themes = require("telescope.themes")
local telescope_projects = require("telescope").extensions.projects
local function map_telescope(key, telescope_function) local function map_telescope(key, telescope_function)
vim.api.nvim_set_keymap("n", key, "", { vim.api.nvim_set_keymap("n", key, "", {
@ -39,6 +39,7 @@ end
map_telescope("<leader>ff", telescope.find_files) map_telescope("<leader>ff", telescope.find_files)
map_telescope("<leader>fb", telescope.buffers) map_telescope("<leader>fb", telescope.buffers)
map_telescope("<leader>fg", telescope.git_files) map_telescope("<leader>fg", telescope.git_files)
map_telescope("<leader>fp", telescope_projects.projects)
map_telescope("<leader>fs", telescope.lsp_document_symbols) map_telescope("<leader>fs", telescope.lsp_document_symbols)
map_telescope("<leader>fS", telescope.lsp_dynamic_workspace_symbols) map_telescope("<leader>fS", telescope.lsp_dynamic_workspace_symbols)
map_telescope("<C-f>", telescope.grep_string) map_telescope("<C-f>", telescope.grep_string)
@ -59,10 +60,10 @@ vim.api.nvim_create_autocmd("TermOpen", {
}) })
-- buffer closing -- buffer closing
nnoremap("gq", ":Bdelete<CR>") nnoremap("gq", ":bdelete<CR>")
-- toggle search highlighting -- toggle search highlighting
vim.cmd('nnoremap <expr> * v:hlsearch ? ":nohlsearch<cr>" : "*"') vim.cmd('nnoremap <expr> * v:hlsearch ? ":nohlsearch<cr>" : "*"')
-- open CodeCompanion chat window -- insert-map jj/jk to escape
nnoremap("<leader>cc", ":CodeCompanionChat #buffer{watch} #lsp @full_stack_dev<CR>") require("better_escape").setup()

View file

@ -12,6 +12,8 @@ local on_attach = function(client, bufnr)
}) })
end end
require("lsp-inlayhints").on_attach(client, bufnr)
local telescope = require("telescope.builtin") local telescope = require("telescope.builtin")
nnoremap("gD", vim.lsp.buf.declaration) nnoremap("gD", vim.lsp.buf.declaration)
@ -39,6 +41,8 @@ local on_attach = function(client, bufnr)
end end
end end
require("lsp-inlayhints").setup({})
local lsp_status = require("lsp-status") local lsp_status = require("lsp-status")
lsp_status.config({ lsp_status.config({
current_function = false, current_function = false,
@ -48,10 +52,21 @@ lsp_status.config({
}) })
lsp_status.register_progress() lsp_status.register_progress()
require('lazydev').setup() -- setup lua language server for init.nvim and nvim plugin development
require("neodev").setup({
override = function(root_dir, options)
if require("neodev.util").has_file(root_dir, "/etc/nixos") then
options.enabled = true
options.plugins = true
end
end,
})
local capabilities = require("cmp_nvim_lsp").default_capabilities(lsp_status.capabilities)
local servers = { local servers = {
["bashls"] = {}, ["bashls"] = {},
["bitbake_language_server"] = {},
["clangd"] = {}, ["clangd"] = {},
["cmake"] = {}, ["cmake"] = {},
["dockerls"] = {}, ["dockerls"] = {},
@ -98,7 +113,6 @@ local servers = {
} }
} }
}, },
["pyright"] = {},
["texlab"] = {}, ["texlab"] = {},
["yamlls"] = { ["yamlls"] = {
yaml = { yaml = {

View file

@ -3,13 +3,5 @@ require('lualine').setup({
sections = { sections = {
lualine_c = { { "filename", path = 1 }, "require('lsp-status').status()" } lualine_c = { { "filename", path = 1 }, "require('lsp-status').status()" }
}, },
tabline = { extensions = { "toggleterm" }
lualine_a = { 'buffers' },
lualine_z = { 'tabs' }
},
extensions = {
"fugitive",
"fzf",
"toggleterm"
}
}) })

1
neovim/luasnip.lua Normal file
View file

@ -0,0 +1 @@
require("luasnip.loaders.from_vscode").lazy_load()

87
neovim/nvim-cmp.lua Normal file
View file

@ -0,0 +1,87 @@
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and
vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(
col, col):match("%s") == nil
end
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_lsp_signature_help" },
{ name = "luasnip" },
{ name = "path" },
{ name = "buffer" },
{ name = "nvim-lua" },
{ name = "calc" },
}),
mapping = cmp.mapping.preset.insert({
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete({}),
["<C-e>"] = cmp.mapping.abort(),
["<CR>"] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { "i", "s" }),
}),
experimental = { ghost_text = true },
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
},
formatting = {
fields = { "menu", "abbr", "kind" },
format = function(entry, item)
local menu_icon = {
nvim_lsp = "λ",
luasnip = "",
buffer = "Ω",
path = "🖿",
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
})
-- `/` cmdline setup.
cmp.setup.cmdline("/", {
sources = cmp.config.sources(
{ name = "buffer" }
)
})
-- `:` cmdline setup.
cmp.setup.cmdline(":", {
sources = cmp.config.sources(
{ name = "path" },
{ name = "cmdline" }
)
})

View file

@ -14,8 +14,8 @@ vim.opt.expandtab = true
-- scroll offset -- scroll offset
vim.opt.scrolloff = 4 vim.opt.scrolloff = 4
-- wrap lines -- don't warp lines
vim.opt.wrap = true vim.opt.wrap = false
-- split to right/below -- split to right/below
vim.opt.splitright = true vim.opt.splitright = true

1
neovim/project-nvim.lua Normal file
View file

@ -0,0 +1 @@
require('project_nvim').setup({})

1
neovim/tabline.lua Normal file
View file

@ -0,0 +1 @@
require('tabline').setup({ enable = true, options = { show_bufnr = true, show_filename_only = true } })

View file

@ -26,3 +26,4 @@ telescope.setup({
telescope.load_extension("fzf") telescope.load_extension("fzf")
telescope.load_extension("ui-select") telescope.load_extension("ui-select")
telescope.load_extension("projects")

View file

@ -1,4 +1,4 @@
{ pkgs, user, lib, ... }: { pkgs, user, ... }:
{ {
home.username = user; home.username = user;
@ -13,8 +13,7 @@
thunderbird thunderbird
keepassxc keepassxc
light light
# element-desktop-wayland element-desktop-wayland
element-desktop
darktable darktable
kubectl kubectl
kubectx kubectx
@ -26,11 +25,6 @@
evince evince
inkscape inkscape
chromium chromium
zoom-us
];
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"zoom"
]; ];
programs.home-manager.enable = true; programs.home-manager.enable = true;
@ -40,6 +34,5 @@
./kitty.nix ./kitty.nix
./nextcloud.nix ./nextcloud.nix
./sway ./sway
./private/ssh.nix
]; ];
} }

View file

@ -1,19 +0,0 @@
{ ... }:
{
programs = {
ssh = {
enable = true;
matchBlocks = {
tc-0x = {
host = "tc-*";
user = "root";
};
ed-0x = {
host = "ed-*";
user = "root";
};
};
};
};
}

View file

@ -1,15 +1,13 @@
{pkgs, ...}: { { pkgs, ... }:
{
home.packages = with pkgs; [ home.packages = with pkgs; [
devenv
difftastic difftastic
dust dust
htop htop
jq jq
nh nh
sshfs
unzip unzip
xclip xclip
llm
]; ];
imports = [ imports = [
@ -24,7 +22,6 @@
./rsync.nix ./rsync.nix
./shell_aliases.nix ./shell_aliases.nix
./starship.nix ./starship.nix
./tmux.nix
./tree.nix ./tree.nix
./zoxide.nix ./zoxide.nix
./zsh.nix ./zsh.nix

View file

@ -4,7 +4,6 @@
programs = { programs = {
direnv = { direnv = {
enable = true; enable = true;
silent = true;
enableZshIntegration = true; enableZshIntegration = true;
nix-direnv.enable = true; nix-direnv.enable = true;
}; };

View file

@ -7,7 +7,7 @@
gs = "git status"; gs = "git status";
gd = "git diff"; gd = "git diff";
gf = "git fetch"; gf = "git fetch";
gfg = "git fetch --no-recurse-submodules && git graph --all --max-count 32"; gfp = "git fetch --prune";
k = "kubectl"; k = "kubectl";
ww = "nvim -c VimwikiIndex"; ww = "nvim -c VimwikiIndex";
}; };

View file

@ -1,28 +0,0 @@
{pkgs, ...}: {
programs = {
tmux = {
enable = true;
clock24 = true;
keyMode = "vi";
escapeTime = 0;
plugins = with pkgs.tmuxPlugins; [
tmux-colors-solarized
vim-tmux-navigator
{
plugin = power-theme;
extraConfig = ''
set -g @tmux_power_theme "colour4"
'';
}
];
terminal = "xterm-256color";
extraConfig = ''
# Terminal overrides
set-option -sa terminal-overrides ",xterm-256color:Tc"
# Reload tmux config to ensure theme is applied
bind r source-file ~/.config/tmux/tmux.conf \; display-message "Config reloaded!"
'';
};
};
}

View file

@ -1,13 +1,8 @@
{ pkgs, theme, ... }:
let
zsh_autosuggest_highlight_style = if theme == "light" then "fg=180" else "fg=10";
in
{ {
pkgs,
theme,
...
}: let
zsh_autosuggest_highlight_style =
if theme == "light"
then "fg=180"
else "fg=10";
in {
programs.zsh = { programs.zsh = {
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
@ -18,16 +13,7 @@ in {
highlight = zsh_autosuggest_highlight_style; highlight = zsh_autosuggest_highlight_style;
}; };
initContent = '' initExtra = ''
# Auto-start tmux if conditions are met
if [[ -z "$TMUX" && -z "$SSH_TTY" && $- == *i* ]]; then
# Check if tmux is available and terminal supports it
if command -v tmux >/dev/null 2>&1; then
# Try to attach to existing session, or create new one
exec tmux new-session -A -s default
fi
fi
function set_win_title(){ function set_win_title(){
local TITLE=$(git config --get remote.origin.url || echo "$PWD") local TITLE=$(git config --get remote.origin.url || echo "$PWD")
echo -ne "\033]0; $(basename "$TITLE") \007" echo -ne "\033]0; $(basename "$TITLE") \007"