added some static hosted files

This commit is contained in:
Nickiel12 2024-11-01 00:20:18 +00:00
parent 6fb7b744e3
commit 712564ac5d
4 changed files with 595 additions and 0 deletions

91
static/static/home.nix Normal file
View file

@ -0,0 +1,91 @@
{ config, pkgs, ... }:
let
nixvim = import (builtins.fetchGit {
url = "https://github.com/nix-community/nixvim";
# When using a different channel you can use `ref = "nixos-<version>"` to set it here
});
in
{
nix = {
package = pkgs.nix;
settings.experimental-features = [ "nix-command" "flakes" ];
};
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "nixolas";
home.homeDirectory = "/home/nixolas";
imports = [
nixvim.homeManagerModules.nixvim
./neovim.nix
];
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "24.05"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = [
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. These will be explicitly sourced when using a
# shell provided by Home Manager. If you don't want to manage your shell
# through Home Manager then you have to manually source 'hm-session-vars.sh'
# located at either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/nixolas/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
# EDITOR = "emacs";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}

281
static/static/neovim.nix Normal file
View file

@ -0,0 +1,281 @@
{ pkgs, lib, ... }:
let
in
{
home.packages = with pkgs; [
# Required clipboard provider
xclip
# Required for find in file
ripgrep
];
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
globals = {
mapleader = " ";
};
filetype.extension = {
templ = "templ";
};
opts = {
autoindent = true;
expandtab = true;
foldlevel=20;
guifont = "MesloLGS\ NF\ 10";
number = true;
shiftwidth = 4;
tabstop = 4;
};
keymaps = [
# Modes: https://superuser.com/questions/1702308/how-can-i-configure-shortcut-keys-in-all-modes-of-vim
# n - normal
# i - insert
# c - cmd
# v - visual select
# x - visual only
# s - selection
# o - oper
# t - terminal
# l - lang
{
# Open new vertical split and starts a new terminal window
mode = "n";
key = "<leader>ot";
action = "<cmd>vs | te<cr>";
}
{
# toggle the left tree panel
mode = "n";
key = "<leader>op";
action = "<cmd>NvimTreeToggle<cr>";
}
{
# Open cwd filename fuzzy search
mode = "n";
key = "<leader>o.";
action = "<cmd>Telescope file_browser<cr>";
}
{
# Open fuzzy filename recursive search
mode = "n";
key = "<leader>.";
action = "<cmd>Telescope find_files<cr>";
}
{
# Search file contents of cwd
mode = "n";
key = "<leader>of";
action = "<cmd>Telescope live_grep<cr>";
}
{
# Keep cursor centered while navigating
mode = "n";
key = "<C-d>";
action = "<C-d>zz";
}
{
# Keep cursor centered while navigating
mode = "n";
key = "<C-u>";
action = "<C-u>zz";
}
{
# Keep cursor centered while skipping to search results
mode = "n";
key = "n";
action = "nzzzv";
}
{
# Keep cursor centered while skipping to search results
mode = "n";
key = "N";
action = "Nzzzv";
}
{
# Yank to system clipboard
mode = "n";
key = "<leader>y";
action = "\"+y";
}
{
# Yank to system clipboard
mode = "n";
key = "<leader>Y";
action = "\"+Y";
}
{
# Delete into the void
mode = "n";
key = "<leader>d";
action = "\"_d";
}
{
# Move visual selection up one row
mode = "v";
key = "J";
action = ":m '>+1<CR>gv=gv";
}
{
# Move visual selection down one row
mode = "v";
key = "K";
action = ":m '<-2<CR>gv=gv";
}
{
mode = "v";
key = ">";
action = ">gv";
}
{
mode = "v";
key = "<";
action = "<gv";
}
{
# Yank selection to system clipboard
mode = "v";
key = "<leader>y";
action = "\"+y";
}
{
# Delete selection into void
mode = "v";
key = "<leader>d";
action = "\"_d";
}
{
# leader+p delete the selection to the void, then paste
mode = "x";
key = "<leader>p";
action = "\"_dP";
}
];
plugins = {
web-devicons.enable = true; # text icons
typescript-tools.enable = true;
zig = {
enable = true;
settings = {
fmt_autosave = 0;
};
};
lsp = {
enable = true;
servers = {
zls = {
enable = true;
# package = zls.packages.${pkgs.system}.zls;
};
# gleam = {
# enable = true;
# autostart = true;
# };
gopls = {
enable = true;
};
templ = {
enable = true;
autostart = true;
};
html.enable = true;
cssls.enable = true;
};
};
nvim-tree = {
enable = true;
openOnSetup = true;
};
# ts-autotag = {
# enable = true;
# filetypes = [ "html" "javascript" "typescript" "javascriptreact" "typescriptreact" "svelte" "vue" "tsx" "jsx" "rescript" "xml" "php" "markdown" "astro" "glimmer" "handlebars" "hbs" "templ" ];
# };
nvim-autopairs = {
enable = true;
settings.check_ts = true;
};
treesitter = {
enable = true;
folding = true;
settings = {
indent.enabled = true;
ensureInstalled = [
"rust"
"toml"
"templ"
"go"
"html"
"json"
"css"
"zig"
];
};
};
rainbow-delimiters.enable = true;
treesitter-refactor = {
enable = true;
#highlightCurrentScope.enable = true;
navigation.enable = true;
smartRename.enable = true;
};
comment = {
enable = true;
settings.toggler = {
line = "<C-/>";
block = "<C-'>";
};
};
floaterm = {
enable = true;
position = "auto";
keymaps = {
toggle = "<leader>t";
};
};
telescope.enable = true;
rust-tools.enable = true;
cmp.enable = true;
cmp-nvim-lsp.enable = true;
# Read settings here: https://github.com/mfussenegger/nvim-dap#Usage
# See :help dap.txt, :help dap-mapping and :help dap-api.
cmp-dap.enable = true;
cmp-buffer.enable = true;
cmp-nvim-lsp-signature-help.enable = true;
cmp-nvim-lua.enable = true;
cmp-path.enable = true;
presence-nvim.enable = true;
nix.enable = true;
airline = {
enable = true;
settings.powerline_fonts = 1;
};
};
extraConfigLua = builtins.readFile ./rsrcs/nvim.lua;
extraPlugins = with pkgs.vimPlugins;
[
telescope-file-browser-nvim
monokai-pro-nvim
nvim-lspconfig
vim-vsnip
hop-nvim
];
};
}

View file

@ -0,0 +1,37 @@
#!/bin/bash
if [ $# -eq 0 ]; then
sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install git
sudo apt-get -y install hailo-all
sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-libav gstreamer1.0-tools gstreamer1.0-x gstreamer1.0-pulseaudio
sh <(curl -L https://nixos.org/nix/install) --daemon
echo "Now exit this shell, and re-run this script with `stage_two` as the arguement"
elif [ "$1" == "stage_two" ]; then
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install
echo "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" >> ~/.bashrc
mkdir -p ~/.config/home-manager/rsrcs
curl -L "https://staticpages.nickiel.net/static/home.nix" >> ~/.config/home-manager/home.nix
curl -L "https://staticpages.nickiel.net/static/neovim.nix" >> ~/.config/home-manager/neovim.nix
curl -L "https://staticpages.nickiel.net/static/rscrs/nvim.lua" >> ~/.config/home-manager/rsrcs/nvim.lua
sudo chmod +x ~/.nix-profile/etc/profile.d/hm-session-vars.sh;
home-manager switch;
echo "[all]\ndtparam=pciex1_gen=3" | sudo tee -a /boot/firmware/config.txt;
sudo sed -i '3a\
kernel=kernel8.img
' /boot/firmware/config.txt
echo "Restart the device, and you should be good to go";
else
echo "Invalid arguments. This script takes no arguments, or `stage_two`"
fi

View file

@ -0,0 +1,186 @@
-- Attached rust-analyzer server
local rt = require("rust-tools")
rt.setup({
server = {
on_attach = function(_, bufnr)
-- Hover actions
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
-- Code action groups
vim.keymap.set("n", "<leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
end,
},
})
-- LSP Diagnostics Options Setup
local sign = function(opts)
vim.fn.sign_define(opts.name, {
texthl = opts.name,
text = opts.text,
numhl = ''
})
end
sign({name = 'DiagnosticSignError', text = ''})
sign({name = 'DiagnosticSignWarn', text = ''})
sign({name = 'DiagnosticSignHint', text = '󰋼'})
sign({name = 'DiagnosticSignInfo', text = '󰋽'})
vim.diagnostic.config({
virtual_text = false,
signs = true,
update_in_insert = true,
underline = true,
severity_sort = false,
float = {
border = 'rounded',
source = 'always',
header = '',
prefix = '',
},
})
vim.cmd([[
set signcolumn=yes
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
]])
--Set completeopt to have a better completion experience
-- :help completeopt
-- menuone: popup even when there's only one match
-- noinsert: Do not insert text until a selection is made
-- noselect: Do not select, force to select one from the menu
-- shortness: avoid showing extra messages when using completion
-- updatetime: set updatetime for CursorHold
vim.opt.shortmess = vim.opt.shortmess + { c = true}
vim.api.nvim_set_option('updatetime', 300)
-- Fixed column for diagnostics to appear
-- Show autodiagnostic popup on cursor hover_range
-- Goto previous / next diagnostic warning / error
-- Show inlay_hints more frequently
vim.cmd([[
set signcolumn=yes
autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false })
]])
-- Completion Plugin Setup
local cmp = require'cmp'
cmp.setup({
-- Enable LSP snippets
snippet = {
expand = function(args)
vim.fn["vsnip#anonymous"](args.body)
end,
},
mapping = {
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-n>'] = cmp.mapping.select_next_item(),
-- Add tab support
['<S-Tab>'] = cmp.mapping.select_prev_item(),
['<Tab>'] = cmp.mapping.select_next_item(),
['<C-S-f>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<CR>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
})
},
-- Installed sources:
sources = {
{ name = 'path' }, -- file paths
{ name = 'nvim_lsp', keyword_length = 3 }, -- from language server
{ name = 'nvim_lsp_signature_help'}, -- display function signatures with current parameter emphasized
{ name = 'nvim_lua', keyword_length = 2}, -- complete neovim's Lua runtime API such vim.lsp.*
{ name = 'buffer', keyword_length = 2 }, -- source current buffer
{ name = 'vsnip', keyword_length = 2 }, -- nvim-cmp source for vim-vsnip
{ name = 'calc'}, -- source for math calculation
},
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 = 'λ',
vsnip = '',
buffer = 'Ω',
path = '',
}
item.menu = menu_icon[entry.source.name]
return item
end,
},
})
-- https://github.com/phaazon/hop.nvim/wiki/Advanced-Hop
local hop = require('hop')
hop.setup {
keys = 'etovxqpdygfblzhckisuran',
}
local directions = require('hop.hint').HintDirection
vim.keymap.set('', '<leader>ff', function()
hop.hint_patterns({ multi_windows = true, current_line_only = false })
end, {remap=true})
vim.opt.scrolloff = 8;
require("telescope").load_extension "file_browser"
-- Themeing
require("monokai-pro").setup({
transparent_background = true,
terminal_colors = true,
devicons = true, -- highlight the icons of `nvim-web-devicons`
styles = {
comment = { italic = true },
keyword = { italic = true }, -- any other keyword
type = { italic = true }, -- (preferred) int, long, char, etc
storageclass = { italic = true }, -- static, register, volatile, etc
structure = { italic = true }, -- struct, union, enum, etc
parameter = { italic = true }, -- parameter pass in function
annotation = { italic = true },
tag_attribute = { italic = true }, -- attribute of tag in reactjs
},
filter = "pro", -- classic | octagon | pro | machine | ristretto | spectrum
-- Enable this will disable filter option
day_night = {
enable = false, -- turn off by default
day_filter = "pro", -- classic | octagon | pro | machine | ristretto | spectrum
night_filter = "spectrum", -- classic | octagon | pro | machine | ristretto | spectrum
},
inc_search = "background", -- underline | background
background_clear = {
-- "float_win",
"toggleterm",
"telescope",
-- "which-key",
"renamer",
"notify",
-- "nvim-tree",
-- "neo-tree",
-- "bufferline", -- better used if background of `neo-tree` or `nvim-tree` is cleared
},-- "float_win", "toggleterm", "telescope", "which-key", "renamer", "neo-tree", "nvim-tree", "bufferline"
plugins = {
bufferline = {
underline_selected = false,
underline_visible = false,
},
indent_blankline = {
context_highlight = "default", -- default | pro
context_start_underline = false,
},
},
---@param c Colorscheme
override = function(c) end,
})
vim.cmd.colorscheme "monokai-pro-spectrum"