Compare commits
10 Commits
36ca5d8d34
...
0dd32db094
Author | SHA1 | Date | |
---|---|---|---|
0dd32db094 | |||
bb8e2171ce | |||
901cc03d80 | |||
9f2afd652c | |||
3df937bb3f | |||
a9abbb6786 | |||
30f1b8b7d5 | |||
c1716eac5c | |||
94d07a8b87 | |||
f9d0194783 |
56
README.md
56
README.md
@ -1,37 +1,43 @@
|
||||
# Nix Home Manager Configuration
|
||||
# Deploy NixOS
|
||||
|
||||
## Upgrade
|
||||
## Copy Config
|
||||
|
||||
```bash
|
||||
# Update System Channels
|
||||
sudo nix-channel --add https://nixos.org/channels/nixpkgs-24.05-darwin nixpkgs
|
||||
sudo nix-channel --update
|
||||
|
||||
# Update Home Manager
|
||||
nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz home-manager
|
||||
nix-channel --update
|
||||
|
||||
# Build Home Manager
|
||||
home-manager switch
|
||||
scp -r * nixos@10.10.10.10:/tmp/
|
||||
```
|
||||
|
||||
## Clean Garbage
|
||||
|
||||
NOTE: This will remove previous generations
|
||||
## Partition Drives
|
||||
|
||||
```bash
|
||||
sudo nix-collect-garbage --delete-old
|
||||
nix-collect-garbage --delete-old
|
||||
# WARNING: Be sure to check drive mappings
|
||||
sudo fdisk -l
|
||||
|
||||
# Partition Disk
|
||||
sudo nix \
|
||||
--experimental-features "nix-command flakes" \
|
||||
run github:nix-community/disko -- \
|
||||
--mode disko \
|
||||
--flake /tmp#lin-va-llama1
|
||||
```
|
||||
|
||||
## OS Update
|
||||
|
||||
`/etc/bashrc` may get overridden. To properly load Nix, prepend the following:
|
||||
## Install NixOS
|
||||
|
||||
```bash
|
||||
# Nix
|
||||
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
|
||||
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
|
||||
fi
|
||||
# End Nix
|
||||
# Install
|
||||
sudo nixos-install --flake /tmp#lin-va-llama1
|
||||
|
||||
# Reboot
|
||||
sudo reboot
|
||||
```
|
||||
|
||||
## Copy Config to Host
|
||||
|
||||
```bash
|
||||
scp -r * nixos@10.10.10.10:/etc/nixos
|
||||
```
|
||||
|
||||
## Rebuild NixOS
|
||||
|
||||
```bash
|
||||
sudo nixos-rebuild switch
|
||||
```
|
||||
|
32
flake.nix
Normal file
32
flake.nix
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
description = "NixOS Hosts";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
disko.url = "github:nix-community/disko";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, disko }: {
|
||||
nixosConfigurations.lin-va-llama1 = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
disko.nixosModules.disko
|
||||
./hosts/llama-server.nix
|
||||
{
|
||||
networking.hostName = "lin-va-llama1";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
nixosConfigurations.lin-va-k3s1 = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
disko.nixosModules.disko
|
||||
./hosts/k3s.nix
|
||||
{
|
||||
networking.hostName = "lin-va-k3s1";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
40
home-manager/README.md
Normal file
40
home-manager/README.md
Normal file
@ -0,0 +1,40 @@
|
||||
# Nix Home Manager Configuration
|
||||
|
||||
## Upgrade
|
||||
|
||||
```bash
|
||||
# Update System Channels
|
||||
sudo nix-channel --add https://nixos.org/channels/nixpkgs-24.11-darwin nixpkgs
|
||||
sudo nix-channel --update
|
||||
|
||||
# Update Home Manager
|
||||
nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz home-manager
|
||||
nix-channel --update
|
||||
|
||||
# Link Repo
|
||||
ln -s /Users/evanreichard/Development/git/personal/nix/home-manager ~/.config/home-manager
|
||||
|
||||
# Build Home Manager
|
||||
home-manager switch
|
||||
```
|
||||
|
||||
## Clean Garbage
|
||||
|
||||
NOTE: This will remove previous generations
|
||||
|
||||
```bash
|
||||
sudo nix-collect-garbage --delete-old
|
||||
nix-collect-garbage --delete-old
|
||||
```
|
||||
|
||||
## OS Update
|
||||
|
||||
`/etc/bashrc` may get overridden. To properly load Nix, prepend the following:
|
||||
|
||||
```bash
|
||||
# Nix
|
||||
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
|
||||
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
|
||||
fi
|
||||
# End Nix
|
||||
```
|
@ -14,7 +14,7 @@
|
||||
eval "$(thefuck --alias)"
|
||||
set -o vi
|
||||
bind "set show-mode-in-prompt on"
|
||||
neofetch
|
||||
fastfetch
|
||||
'';
|
||||
};
|
||||
|
93
home-manager/fastfetch/config/config.jsonc
Normal file
93
home-manager/fastfetch/config/config.jsonc
Normal file
@ -0,0 +1,93 @@
|
||||
{
|
||||
"modules": [
|
||||
{
|
||||
"type": "separator",
|
||||
"string": "",
|
||||
"length": 35,
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
"format": "Hardware Information",
|
||||
},
|
||||
{
|
||||
"type": "cpu",
|
||||
"key": " ",
|
||||
},
|
||||
{
|
||||
"type": "memory",
|
||||
"key": " ",
|
||||
},
|
||||
{
|
||||
"type": "display",
|
||||
"key": " ",
|
||||
},
|
||||
{
|
||||
"type": "separator",
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
"format": "Software Information",
|
||||
},
|
||||
{
|
||||
"type": "os",
|
||||
"key": " ",
|
||||
},
|
||||
{
|
||||
"type": "kernel",
|
||||
"key": " ",
|
||||
},
|
||||
{
|
||||
"type": "terminal",
|
||||
"key": " ",
|
||||
},
|
||||
{
|
||||
"type": "packages",
|
||||
"key": " ",
|
||||
},
|
||||
{
|
||||
"type": "terminalfont",
|
||||
"key": " ",
|
||||
},
|
||||
{
|
||||
"type": "separator",
|
||||
},
|
||||
{
|
||||
"type": "title",
|
||||
"format": "Network Information",
|
||||
},
|
||||
{
|
||||
"type": "publicip",
|
||||
"key": " ",
|
||||
},
|
||||
{
|
||||
"type": "localip",
|
||||
"key": " ",
|
||||
},
|
||||
{
|
||||
"type": "separator",
|
||||
},
|
||||
{
|
||||
"type": "custom",
|
||||
"format": " {#white} {#red} {#green} {#yellow} {#blue} {#magenta} {#cyan} {#white}\n",
|
||||
},
|
||||
],
|
||||
"display": {
|
||||
"separator": " ",
|
||||
"key": {
|
||||
"width": 7,
|
||||
},
|
||||
"color": {
|
||||
"keys": "yellow",
|
||||
"title": "blue",
|
||||
},
|
||||
},
|
||||
"settings": {
|
||||
"kernelFormat": "minimal",
|
||||
"memoryUnit": "gib",
|
||||
"temperatureUnit": "celsius",
|
||||
"publicIpTimeout": 2000,
|
||||
"publicIpHost": "http://ident.me",
|
||||
"diskUnit": "gib",
|
||||
"showDisks": ["/"],
|
||||
},
|
||||
}
|
8
home-manager/fastfetch/default.nix
Normal file
8
home-manager/fastfetch/default.nix
Normal file
@ -0,0 +1,8 @@
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
xdg.configFile = {
|
||||
"fastfetch/config.jsonc" = {
|
||||
source = ./config/config.jsonc;
|
||||
};
|
||||
};
|
||||
}
|
26
home-manager/ghostty/config/ghostty.conf
Normal file
26
home-manager/ghostty/config/ghostty.conf
Normal file
@ -0,0 +1,26 @@
|
||||
command = /Users/evanreichard/.nix-profile/bin/bash --login
|
||||
macos-titlebar-style = tabs
|
||||
auto-update = off
|
||||
font-family = "MesloLGM Nerd Font Mono"
|
||||
|
||||
# Melange Dark - Adapted From: https://github.com/savq/melange-nvim/blob/master/term/kitty/melange_dark.conf
|
||||
palette = 0=#34302C
|
||||
palette = 1=#BD8183
|
||||
palette = 2=#78997A
|
||||
palette = 3=#E49B5D
|
||||
palette = 4=#7F91B2
|
||||
palette = 5=#B380B0
|
||||
palette = 6=#7B9695
|
||||
palette = 7=#C1A78E
|
||||
palette = 8=#867462
|
||||
palette = 9=#D47766
|
||||
palette = 10=#85B695
|
||||
palette = 11=#EBC06D
|
||||
palette = 12=#A3A9CE
|
||||
palette = 13=#CF9BC2
|
||||
palette = 14=#89B3B6
|
||||
palette = 15=#ECE1D7
|
||||
background = 292522
|
||||
foreground = ECE1D7
|
||||
selection-background = 403A36
|
||||
selection-foreground = ECE1D7
|
8
home-manager/ghostty/default.nix
Normal file
8
home-manager/ghostty/default.nix
Normal file
@ -0,0 +1,8 @@
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
xdg.configFile = {
|
||||
"ghostty/config" = {
|
||||
source = ./config/ghostty.conf;
|
||||
};
|
||||
};
|
||||
}
|
@ -8,10 +8,10 @@ in
|
||||
imports = [
|
||||
./bash
|
||||
./direnv
|
||||
./ghostty
|
||||
./git
|
||||
./htop
|
||||
./kitty
|
||||
./neofetch
|
||||
./fastfetch
|
||||
./nvim
|
||||
./powerline
|
||||
./readline
|
||||
@ -20,31 +20,43 @@ in
|
||||
# Home Manager Config
|
||||
home.username = "evanreichard";
|
||||
home.homeDirectory = "/Users/evanreichard";
|
||||
home.stateVersion = "24.05";
|
||||
home.stateVersion = "24.11";
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
# Global Packages
|
||||
home.packages = with pkgs; [
|
||||
(nerdfonts.override { fonts = [ "Meslo" ]; })
|
||||
# ghostty - Pending Darwin @ https://github.com/NixOS/nixpkgs/pull/369788
|
||||
android-tools
|
||||
awscli2
|
||||
bashInteractive
|
||||
cw
|
||||
fastfetch
|
||||
gitAndTools.gh
|
||||
google-cloud-sdk
|
||||
imagemagick
|
||||
kubectl
|
||||
kubernetes-helm
|
||||
(llama-cpp.overrideAttrs {
|
||||
version = "b4539";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "ggerganov";
|
||||
repo = "llama.cpp";
|
||||
tag = "b4539";
|
||||
hash = "sha256-zPWx8gdai8OfoBCr2X2oJYg45ipLselYZMrL+MbQ1AY=";
|
||||
leaveDotGit = true;
|
||||
};
|
||||
})
|
||||
mosh
|
||||
neofetch
|
||||
pre-commit
|
||||
python311
|
||||
ssm-session-manager-plugin
|
||||
texliveSmall # Pandoc PDF Dep
|
||||
thefuck
|
||||
tldr
|
||||
] ++ optionals isDarwin [
|
||||
kitty
|
||||
] ++ optionals isLinux [ ];
|
||||
]
|
||||
++ optionals isDarwin [ ]
|
||||
++ optionals isLinux [ ];
|
||||
|
||||
# GitHub CLI
|
||||
programs.gh = {
|
||||
@ -73,28 +85,28 @@ in
|
||||
'';
|
||||
|
||||
# Darwin Spotlight Indexing Hack
|
||||
home.activation = mkIf isDarwin {
|
||||
copyApplications =
|
||||
let
|
||||
apps = pkgs.buildEnv {
|
||||
name = "home-manager-applications";
|
||||
paths = config.home.packages;
|
||||
pathsToLink = "/Applications";
|
||||
};
|
||||
in
|
||||
lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
baseDir="$HOME/Applications/Home Manager Apps"
|
||||
if [ -d "$baseDir" ]; then
|
||||
rm -rf "$baseDir"
|
||||
fi
|
||||
mkdir -p "$baseDir"
|
||||
for appFile in ${apps}/Applications/*; do
|
||||
target="$baseDir/$(basename "$appFile")"
|
||||
$DRY_RUN_CMD cp ''${VERBOSE_ARG:+-v} -fHRL "$appFile" "$baseDir"
|
||||
$DRY_RUN_CMD chmod ''${VERBOSE_ARG:+-v} -R +w "$target"
|
||||
done
|
||||
'';
|
||||
};
|
||||
# home.activation = mkIf isDarwin {
|
||||
# copyApplications =
|
||||
# let
|
||||
# apps = pkgs.buildEnv {
|
||||
# name = "home-manager-applications";
|
||||
# paths = config.home.packages;
|
||||
# pathsToLink = "/Applications";
|
||||
# };
|
||||
# in
|
||||
# lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||
# baseDir="$HOME/Applications/Home Manager Apps"
|
||||
# if [ -d "$baseDir" ]; then
|
||||
# rm -rf "$baseDir"
|
||||
# fi
|
||||
# mkdir -p "$baseDir"
|
||||
# for appFile in ${apps}/Applications/*; do
|
||||
# target="$baseDir/$(basename "$appFile")"
|
||||
# $DRY_RUN_CMD cp ''${VERBOSE_ARG:+-v} -fHRL "$appFile" "$baseDir"
|
||||
# $DRY_RUN_CMD chmod ''${VERBOSE_ARG:+-v} -R +w "$target"
|
||||
# done
|
||||
# '';
|
||||
# };
|
||||
|
||||
# Darwin Spotlight Indexing Hack
|
||||
disabledModules = [ "targets/darwin/linkapps.nix" ];
|
20
home-manager/nvim/config/lua/llm.lua
Normal file
20
home-manager/nvim/config/lua/llm.lua
Normal file
@ -0,0 +1,20 @@
|
||||
-- Configure LLama LLM
|
||||
vim.g.llama_config = {
|
||||
endpoint = "http://10.0.20.158:8080/infill",
|
||||
api_key = "",
|
||||
n_prefix = 256,
|
||||
n_suffix = 64,
|
||||
n_predict = 256,
|
||||
t_max_prompt_ms = 500,
|
||||
t_max_predict_ms = 500,
|
||||
show_info = 2,
|
||||
auto_fim = true,
|
||||
max_line_suffix = 8,
|
||||
max_cache_keys = 256,
|
||||
ring_n_chunks = 8,
|
||||
ring_chunk_size = 32,
|
||||
ring_scope = 512,
|
||||
ring_update_ms = 1000,
|
||||
}
|
||||
|
||||
-- require("gen").setup({ model = "codegemma" })
|
@ -8,6 +8,12 @@ vim.api.nvim_create_autocmd("FileType", {
|
||||
end,
|
||||
})
|
||||
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
templ = "templ",
|
||||
},
|
||||
})
|
||||
|
||||
------------------------------------------------------
|
||||
-------------------- Built-in LSP --------------------
|
||||
------------------------------------------------------
|
||||
@ -101,7 +107,7 @@ nvim_lsp.cssls.setup({
|
||||
})
|
||||
|
||||
-- Typescript / Javascript LSP Configuration
|
||||
nvim_lsp.tsserver.setup({
|
||||
nvim_lsp.ts_ls.setup({
|
||||
on_attach = on_attach_no_formatting,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
@ -124,6 +130,13 @@ nvim_lsp.lua_ls.setup({
|
||||
cmd = { nix_vars.luals },
|
||||
})
|
||||
|
||||
-- Templ LSP Configuration
|
||||
nvim_lsp.templ.setup({
|
||||
on_attach = on_attach,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
||||
-- Go LSP Configuration
|
||||
nvim_lsp.gopls.setup({
|
||||
on_attach = function(client, bufnr)
|
||||
@ -137,6 +150,11 @@ nvim_lsp.gopls.setup({
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
cmd = { nix_vars.gopls },
|
||||
settings = {
|
||||
gopls = {
|
||||
buildFlags = { "-tags=e2e" },
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Go LSP Linting
|
47
home-manager/nvim/config/lua/which-key-config.lua
Normal file
47
home-manager/nvim/config/lua/which-key-config.lua
Normal file
@ -0,0 +1,47 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.setup({})
|
||||
|
||||
wk.add({
|
||||
{ "<C-k>", desc = "Signature Help" },
|
||||
{ "<leader>a", desc = "Aerial" },
|
||||
{ "<leader>d", group = "Debug" },
|
||||
{ "<leader>db", desc = "Toggle Breakpoint" },
|
||||
{ "<leader>dc", desc = "Continue" },
|
||||
{ "<leader>dt", desc = "Run Test" },
|
||||
{ "<leader>du", desc = "Toggle UI" },
|
||||
{ "<leader>f", group = "Find - Telescope" },
|
||||
{ "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Find Buffer" },
|
||||
{ "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find File" },
|
||||
{ "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live Grep" },
|
||||
{ "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Help Tags" },
|
||||
{ "<leader>fj", "<cmd>Telescope jumplist<cr>", desc = "Jump List" },
|
||||
{ "<leader>g", group = "DiffView" },
|
||||
{ "<leader>gB", desc = "Git Blame Full" },
|
||||
{ "<leader>gH", "<cmd>DiffviewFileHistory --range=origin..HEAD<cr>", desc = "Diff History - Main" },
|
||||
{ "<leader>gO", "<cmd>DiffviewOpen origin/main...HEAD<cr>", desc = "Open Diff - Main" },
|
||||
{ "<leader>gb", desc = "Git Blame Line" },
|
||||
{ "<leader>gc", "<cmd>DiffviewClose<cr>", desc = "Close Diff" },
|
||||
{ "<leader>gh", "<cmd>DiffviewFileHistory<cr>", desc = "Diff History" },
|
||||
{ "<leader>go", "<cmd>DiffviewOpen<cr>", desc = "Open Diff - Current" },
|
||||
{ "<leader>l", group = "LSP" },
|
||||
{ "<leader>lD", desc = "Declaration" },
|
||||
{ "<leader>ld", desc = "Definition" },
|
||||
{ "<leader>lf", desc = "Format" },
|
||||
{ "<leader>li", desc = "Implementation" },
|
||||
{ "<leader>ln", desc = "Rename" },
|
||||
{ "<leader>lr", desc = "References" },
|
||||
{ "<leader>lt", desc = "Type Definition" },
|
||||
{ "<leader>q", group = "Diagnostics" },
|
||||
{ "<leader>qN", desc = "Previous Diagnostic" },
|
||||
{ "<leader>qe", desc = "Open Diagnostic Float" },
|
||||
{ "<leader>qn", desc = "Next Diagnostic" },
|
||||
{ "<leader>qq", desc = "Toggle Diagnostic List" },
|
||||
{ "<leader>qt", desc = "Toggle Inline Diagnostics" },
|
||||
{ "<leader>sv", desc = "Visual Screenshot" },
|
||||
{ "<leader>t", desc = "NeoTree" },
|
||||
{ "K", desc = "Definition Hover" },
|
||||
{ "<leader>ss", desc = "Selected Screenshot", mode = "v" },
|
||||
{ "<leader>s", group = "Screenshot", mode = { "n", "v" } },
|
||||
{ "<leader>sb", desc = "Buffer Screenshot", mode = { "n", "v" } },
|
||||
})
|
@ -1,6 +1,7 @@
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
inherit (pkgs.lib.lists) subtractLists;
|
||||
unstable = import <nixpkgs-unstable> { };
|
||||
in
|
||||
{
|
||||
programs.neovim = {
|
||||
@ -119,6 +120,23 @@ in
|
||||
}
|
||||
)
|
||||
|
||||
# -------------------
|
||||
# ---- LLAMA.VIM ----
|
||||
# -------------------
|
||||
(
|
||||
pkgs.vimUtils.buildVimPlugin {
|
||||
pname = "llama.vim";
|
||||
version = "2025-01-23";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "ggml-org";
|
||||
repo = "llama.vim";
|
||||
rev = "143fe910b8d47a054ed464c38d8b7c17d5354468";
|
||||
sha256 = "sha256-PW0HKzhSxcZiWzpDOuy98rl/X0o2nE7tMjZjwwh0qLE=";
|
||||
};
|
||||
meta.homepage = "https://github.com/ggml-org/llama.vim/";
|
||||
}
|
||||
)
|
||||
|
||||
];
|
||||
|
||||
extraPackages = with pkgs; [
|
||||
@ -134,12 +152,12 @@ in
|
||||
gopls
|
||||
lua-language-server
|
||||
nodePackages.eslint
|
||||
nodePackages.eslint_d
|
||||
nodePackages.pyright
|
||||
nodePackages.svelte-language-server
|
||||
nodePackages.typescript
|
||||
nodePackages.typescript-language-server
|
||||
nodePackages.vscode-langservers-extracted
|
||||
pyright
|
||||
unstable.eslint_d
|
||||
|
||||
# Formatters
|
||||
luaformatter
|
119
hosts/k3s.nix
Normal file
119
hosts/k3s.nix
Normal file
@ -0,0 +1,119 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
# Enable Flakes
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# System Configuration
|
||||
boot.kernelModules = [ "nvme_tcp" ]; # OpenEBS Mayastor Requirement
|
||||
boot.kernel.sysctl = {
|
||||
"vm.nr_hugepages" = 1024;
|
||||
};
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.loader.efi.efiSysMountPoint = "/boot";
|
||||
|
||||
# Disk Configuration
|
||||
disko.devices = {
|
||||
disk = {
|
||||
sda = {
|
||||
type = "disk";
|
||||
device = "/dev/sda";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "512M";
|
||||
type = "EF00"; # EFI
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# Network Configuration
|
||||
networking = {
|
||||
networkmanager.enable = true;
|
||||
firewall = {
|
||||
enable = true;
|
||||
|
||||
# Single Node Required Ports
|
||||
allowedTCPPorts = [ 6443 ];
|
||||
|
||||
# Multi Node Required Ports
|
||||
# allowedTCPPorts = [ 6443 2379 2380 10250 ];
|
||||
# allowedUDPPorts = [ 8472 ];
|
||||
};
|
||||
};
|
||||
|
||||
# Enable K3s
|
||||
services.k3s = {
|
||||
enable = true;
|
||||
role = "server";
|
||||
extraFlags = toString [
|
||||
"--disable=traefik" # Should we enable?
|
||||
"--disable=servicelb"
|
||||
];
|
||||
};
|
||||
|
||||
# Enable SSH Server
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PasswordAuthentication = false; # Disable Password Login
|
||||
PermitRootLogin = "prohibit-password"; # Disable Password Login
|
||||
};
|
||||
};
|
||||
|
||||
# User Configuration
|
||||
users.users.root = {
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA8P84lWL/p13ZBFNwITm/dLWWL8s9pVmdOImM5gaJAiTLY+DheUvG6YsveB2/5STseiJ34g7Na9TW1mtTLL8zDqPvj3NbprQiYlLJKMbCk6dtfdD4nLMHl8B48e1h699XiZDp2/c+jJb0MkLOFrps+FbPqt7pFt1Pj29tFy8BCg0LGndu6KO+HqYS+aM5tp5hZESo1RReiJ8aHsu5X7wW46brN4gfyyu+8X4etSZAB9raWqlln9NKK7G6as6X+uPypvSjYGSTC8TSePV1iTPwOxPk2+1xBsK7EBLg3jNrrYaiXLnZvBOOhm11JmHzqEJ6386FfQO+0r4iDVxmvi+ojw== rsa-key-20141114"
|
||||
];
|
||||
hashedPassword = null; # Disable Password Login
|
||||
};
|
||||
|
||||
# System Packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
k9s
|
||||
kubectl
|
||||
kubernetes-helm
|
||||
nfs-utils
|
||||
vim
|
||||
];
|
||||
|
||||
# Enable Container Features
|
||||
virtualisation = {
|
||||
docker.enable = false;
|
||||
containerd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
version = 2;
|
||||
plugins."io.containerd.grpc.v1.cri" = {
|
||||
containerd.runtimes.runc = {
|
||||
runtime_type = "io.containerd.runc.v2";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# System State Version
|
||||
system.stateVersion = "24.11";
|
||||
}
|
187
hosts/llama-server.nix
Normal file
187
hosts/llama-server.nix
Normal file
@ -0,0 +1,187 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
cuda-llama = (pkgs.llama-cpp.override {
|
||||
cudaSupport = true;
|
||||
}).overrideAttrs (oldAttrs: {
|
||||
cmakeFlags = oldAttrs.cmakeFlags ++ [
|
||||
"-DGGML_CUDA_ENABLE_UNIFIED_MEMORY=ON"
|
||||
|
||||
# Disable CPU Instructions - Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz
|
||||
"-DLLAMA_FMA=OFF"
|
||||
"-DLLAMA_AVX2=OFF"
|
||||
"-DLLAMA_AVX512=OFF"
|
||||
"-DGGML_FMA=OFF"
|
||||
"-DGGML_AVX2=OFF"
|
||||
"-DGGML_AVX512=OFF"
|
||||
];
|
||||
});
|
||||
|
||||
# Define Model Vars
|
||||
modelDir = "/models";
|
||||
modelName = "qwen2.5-coder-7b-q8_0.gguf";
|
||||
modelPath = "${modelDir}/${modelName}";
|
||||
modelUrl = "https://huggingface.co/ggml-org/Qwen2.5-Coder-7B-Q8_0-GGUF/resolve/main/${modelName}?download=true";
|
||||
in
|
||||
|
||||
{
|
||||
# Enable Flakes
|
||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||
|
||||
# System Configuration
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
boot.loader.efi.efiSysMountPoint = "/boot";
|
||||
|
||||
# Allow Nvidia & CUDA
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# Enable Graphics
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
extraPackages = [ pkgs.cudatoolkit ];
|
||||
};
|
||||
|
||||
# Load Nvidia Driver Module
|
||||
services.xserver.videoDrivers = [ "nvidia" ];
|
||||
|
||||
# Nvidia Package Configuration
|
||||
hardware.nvidia = {
|
||||
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = true;
|
||||
open = false;
|
||||
nvidiaSettings = true;
|
||||
};
|
||||
|
||||
# Disk Configuration
|
||||
disko.devices = {
|
||||
disk = {
|
||||
sda = {
|
||||
type = "disk";
|
||||
device = "/dev/sda";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
boot = {
|
||||
size = "512M";
|
||||
type = "EF00"; # EFI
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "vfat";
|
||||
mountpoint = "/boot";
|
||||
mountOptions = [ "umask=0077" ];
|
||||
};
|
||||
};
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "filesystem";
|
||||
format = "ext4";
|
||||
mountpoint = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
# Network Configuration
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
# Download Model
|
||||
systemd.services.download-model = {
|
||||
description = "Download Model";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
before = [ "llama-cpp.service" ];
|
||||
path = [ pkgs.curl pkgs.coreutils ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
User = "root";
|
||||
Group = "root";
|
||||
};
|
||||
script = ''
|
||||
set -euo pipefail
|
||||
|
||||
if [ ! -f "${modelPath}" ]; then
|
||||
mkdir -p "${modelDir}"
|
||||
# Add -f flag to follow redirects and -L for location
|
||||
# Add --fail flag to exit with error on HTTP errors
|
||||
# Add -C - to resume interrupted downloads
|
||||
curl -f -L -C - \
|
||||
-H "Accept: application/octet-stream" \
|
||||
--retry 3 \
|
||||
--retry-delay 5 \
|
||||
--max-time 1800 \
|
||||
"${modelUrl}" \
|
||||
-o "${modelPath}.tmp" && \
|
||||
mv "${modelPath}.tmp" "${modelPath}"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
# Setup LLama API Service
|
||||
systemd.services.llama-cpp = {
|
||||
after = [ "download-model.service" ];
|
||||
requires = [ "download-model.service" ];
|
||||
};
|
||||
|
||||
# Enable LLama API
|
||||
services.llama-cpp = {
|
||||
enable = true;
|
||||
host = "0.0.0.0";
|
||||
package = cuda-llama;
|
||||
model = modelPath;
|
||||
port = 8080;
|
||||
openFirewall = true;
|
||||
extraFlags = [
|
||||
"-ngl"
|
||||
"99"
|
||||
"-fa"
|
||||
"-ub"
|
||||
"512"
|
||||
"-b"
|
||||
"512"
|
||||
"-dt"
|
||||
"0.1"
|
||||
"--ctx-size"
|
||||
"4096"
|
||||
"--cache-reuse"
|
||||
"256"
|
||||
];
|
||||
};
|
||||
|
||||
# Enable SSH Server
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
PasswordAuthentication = false; # Disable Password Login
|
||||
PermitRootLogin = "prohibit-password"; # Disable Password Login
|
||||
};
|
||||
};
|
||||
|
||||
# User Configuration
|
||||
users.users.root = {
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA8P84lWL/p13ZBFNwITm/dLWWL8s9pVmdOImM5gaJAiTLY+DheUvG6YsveB2/5STseiJ34g7Na9TW1mtTLL8zDqPvj3NbprQiYlLJKMbCk6dtfdD4nLMHl8B48e1h699XiZDp2/c+jJb0MkLOFrps+FbPqt7pFt1Pj29tFy8BCg0LGndu6KO+HqYS+aM5tp5hZESo1RReiJ8aHsu5X7wW46brN4gfyyu+8X4etSZAB9raWqlln9NKK7G6as6X+uPypvSjYGSTC8TSePV1iTPwOxPk2+1xBsK7EBLg3jNrrYaiXLnZvBOOhm11JmHzqEJ6386FfQO+0r4iDVxmvi+ojw== rsa-key-20141114"
|
||||
];
|
||||
hashedPassword = null; # Disable Password Login
|
||||
};
|
||||
|
||||
# System Packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
htop
|
||||
nvtop
|
||||
tmux
|
||||
vim
|
||||
wget
|
||||
];
|
||||
|
||||
# System State Version
|
||||
system.stateVersion = "24.11";
|
||||
}
|
@ -1,132 +0,0 @@
|
||||
# -------------------------------------------------------
|
||||
# ------------------ Generic Settings -------------------
|
||||
# -------------------------------------------------------
|
||||
|
||||
font_family MesloLGM Nerd Font Mono
|
||||
font_size 18.0
|
||||
hide_window_decorations titlebar-only
|
||||
shell /Users/evanreichard/.nix-profile/bin/bash --login
|
||||
tab_bar_style powerline
|
||||
|
||||
# -------------------------------------------------------
|
||||
# ----------------------- Hotkeys -----------------------
|
||||
# -------------------------------------------------------
|
||||
|
||||
# Tab Switching
|
||||
map cmd+, set_tab_title
|
||||
map cmd+0 goto_tab 10
|
||||
map cmd+1 goto_tab 1
|
||||
map cmd+2 goto_tab 2
|
||||
map cmd+3 goto_tab 3
|
||||
map cmd+4 goto_tab 4
|
||||
map cmd+5 goto_tab 5
|
||||
map cmd+6 goto_tab 6
|
||||
map cmd+7 goto_tab 7
|
||||
map cmd+8 goto_tab 8
|
||||
map cmd+9 goto_tab 9
|
||||
|
||||
# Window Switching
|
||||
map alt+0 tenth_window
|
||||
map alt+1 first_window
|
||||
map alt+2 second_window
|
||||
map alt+3 third_window
|
||||
map alt+4 fourth_window
|
||||
map alt+5 fifth_window
|
||||
map alt+6 sixth_window
|
||||
map alt+7 seventh_window
|
||||
map alt+8 eighth_window
|
||||
map alt+9 ninth_window
|
||||
map shift+enter new_window_with_cwd
|
||||
|
||||
# Layout Specific Shortcuts
|
||||
map alt+f toggle_layout stack
|
||||
map alt+s toggle_layout horizontal
|
||||
map alt+v toggle_layout vertical
|
||||
|
||||
# Active Window Relative Movement
|
||||
map shift+down move_window down
|
||||
map shift+left move_window left
|
||||
map shift+right move_window right
|
||||
map shift+up move_window up
|
||||
|
||||
# Focus Window Relative
|
||||
map alt+down neighboring_window down
|
||||
map alt+left neighboring_window left
|
||||
map alt+right neighboring_window right
|
||||
map alt+up neighboring_window up
|
||||
|
||||
# -------------------------------------------------------
|
||||
# ----------------- 1984 Orwellian Theme ----------------
|
||||
# -------------------------------------------------------
|
||||
|
||||
foreground #f1f1f1
|
||||
background #2e2923
|
||||
selection_foreground #000000
|
||||
selection_background #3fc4ce
|
||||
color0 #000000
|
||||
color1 #e74946
|
||||
color2 #4cb605
|
||||
color3 #fcd395
|
||||
color4 #356fe4
|
||||
color5 #fcbe95
|
||||
color6 #3fc4ce
|
||||
color7 #f1f1f1
|
||||
color8 #000000
|
||||
color9 #e74946
|
||||
color10 #4cb605
|
||||
color11 #fcd395
|
||||
color12 #356fe4
|
||||
color13 #fcbe95
|
||||
color14 #3fc4ce
|
||||
color15 #f1f1f1
|
||||
|
||||
# URL styles
|
||||
url_color #e74946
|
||||
url_style single
|
||||
|
||||
# Cursor styles
|
||||
cursor #3fc4ce
|
||||
|
||||
|
||||
# -------------------------------------------------------
|
||||
# ------------------ Nord Color Scheme ------------------
|
||||
# -------------------------------------------------------
|
||||
#
|
||||
# foreground #D8DEE9
|
||||
# background #2E3440
|
||||
# selection_foreground #000000
|
||||
# selection_background #FFFACD
|
||||
# url_color #0087BD
|
||||
# cursor #81A1C1
|
||||
#
|
||||
# # Black
|
||||
# color0 #3B4252
|
||||
# color8 #4C566A
|
||||
#
|
||||
# # Red
|
||||
# color1 #BF616A
|
||||
# color9 #BF616A
|
||||
#
|
||||
# # Green
|
||||
# color2 #A3BE8C
|
||||
# color10 #A3BE8C
|
||||
#
|
||||
# # Yellow
|
||||
# color3 #EBCB8B
|
||||
# color11 #EBCB8B
|
||||
#
|
||||
# # Blue
|
||||
# color4 #81A1C1
|
||||
# color12 #81A1C1
|
||||
#
|
||||
# # Magenta
|
||||
# color5 #B48EAD
|
||||
# color13 #B48EAD
|
||||
#
|
||||
# # Cyan
|
||||
# color6 #88C0D0
|
||||
# color14 #8FBCBB
|
||||
#
|
||||
# # White
|
||||
# color7 #E5E9F0
|
||||
# color15 #ECEFF4
|
@ -1,12 +0,0 @@
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
inherit (pkgs.lib) mkIf;
|
||||
inherit (pkgs.stdenv) isDarwin;
|
||||
in
|
||||
{
|
||||
xdg.configFile = mkIf isDarwin {
|
||||
"kitty/kitty.conf" = {
|
||||
source = ./config/kitty.conf;
|
||||
};
|
||||
};
|
||||
}
|
@ -1,127 +0,0 @@
|
||||
print_info() {
|
||||
prin ""
|
||||
prin "Hardware Information"
|
||||
info " " model
|
||||
info " " cpu
|
||||
info " " memory
|
||||
info " " resolution
|
||||
prin ""
|
||||
prin "Software Information"
|
||||
info " " distro
|
||||
info " " kernel
|
||||
info " " term
|
||||
info " " packages
|
||||
prin ""
|
||||
prin "Network Information"
|
||||
info " " public_ip
|
||||
info " " local_ip
|
||||
prin ""
|
||||
prin "\n \n \n ${cl3} \n \n ${cl5} \n \n ${cl2} \n \n ${cl6} \n \n ${cl4} \n \n ${cl1} \n \n ${cl7} \n \n ${cl0}"
|
||||
}
|
||||
|
||||
# Details
|
||||
kernel_shorthand="on"
|
||||
distro_shorthand="tiny"
|
||||
os_arch="on"
|
||||
uptime_shorthand="on"
|
||||
memory_percent="on"
|
||||
package_managers="on"
|
||||
shell_path="off"
|
||||
shell_version="on"
|
||||
memory_percent="off"
|
||||
|
||||
# CPU
|
||||
speed_type="bios_limit"
|
||||
speed_shorthad="on"
|
||||
cpu_brand="on"
|
||||
cpu_speed="off"
|
||||
cpu_cores="off"
|
||||
cpu_temp="off"
|
||||
|
||||
# GPU
|
||||
gpu_brand="on"
|
||||
gpu_type="dedicated"
|
||||
refresh_rate="on"
|
||||
|
||||
# Theme
|
||||
gtk_shorthand="on"
|
||||
gtk2="on"
|
||||
gtk3="on"
|
||||
|
||||
# IP
|
||||
public_ip_host="http://ident.me"
|
||||
public_ip_timeout=2
|
||||
|
||||
# Disk
|
||||
disk_show=('/')
|
||||
|
||||
# Text
|
||||
colors=(distro)
|
||||
bold="on"
|
||||
underline_enabled="on"
|
||||
underline_char="-"
|
||||
separator=" "
|
||||
|
||||
# Color Blocks
|
||||
block_height=1
|
||||
block_range=(1 7)
|
||||
block_width=4
|
||||
color_blocks="on"
|
||||
|
||||
# Colors for custom colorblocks
|
||||
magenta="\033[1;35m"
|
||||
green="\033[1;32m"
|
||||
white="\033[1;37m"
|
||||
blue="\033[1;34m"
|
||||
red="\033[1;31m"
|
||||
black="\033[1;40;30m"
|
||||
yellow="\033[1;33m"
|
||||
cyan="\033[1;36m"
|
||||
reset="\033[0m"
|
||||
bgyellow="\033[1;43;33m"
|
||||
bgwhite="\033[1;47;37m"
|
||||
cl0="${reset}"
|
||||
cl1="${magenta}"
|
||||
cl2="${green}"
|
||||
cl3="${white}"
|
||||
cl4="${blue}"
|
||||
cl5="${red}"
|
||||
cl6="${yellow}"
|
||||
cl7="${cyan}"
|
||||
cl8="${black}"
|
||||
cl9="${bgyellow}"
|
||||
cl10="${bgwhite}"
|
||||
|
||||
# Progress Bars
|
||||
bar_char_elapsed="-"
|
||||
bar_char_total="="
|
||||
bar_border="on"
|
||||
bar_length=15
|
||||
bar_color_elapsed="distro"
|
||||
bar_color_total="distro"
|
||||
|
||||
# Info display
|
||||
cpu_display="on"
|
||||
memory_display="on"
|
||||
battery_display="on"
|
||||
disk_display="on"
|
||||
|
||||
# Backend Settings
|
||||
image_backend="ascii"
|
||||
ascii_distro="auto"
|
||||
ascii_colors=(distro)
|
||||
ascii_bold="on"
|
||||
|
||||
# Image Options
|
||||
image_loop="off"
|
||||
thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch"
|
||||
crop_mode="fit"
|
||||
crop_offset="center"
|
||||
image_size="auto"
|
||||
gap=2
|
||||
yoffset=0
|
||||
xoffset=0
|
||||
background_color=
|
||||
|
||||
# Misc Options
|
||||
stdout="off"
|
@ -1,8 +0,0 @@
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
xdg.configFile = {
|
||||
"neofetch/config.conf" = {
|
||||
source = ./config/config.conf;
|
||||
};
|
||||
};
|
||||
}
|
@ -1 +0,0 @@
|
||||
require('gen').setup({model = "codegemma"})
|
@ -1,65 +0,0 @@
|
||||
local wk = require("which-key")
|
||||
|
||||
wk.setup({})
|
||||
|
||||
wk.register({
|
||||
K = { "Definition Hover" },
|
||||
["<C-k>"] = { "Signature Help" },
|
||||
["<leader>"] = {
|
||||
a = { "Aerial" },
|
||||
t = { "NeoTree" },
|
||||
q = {
|
||||
name = "Diagnostics",
|
||||
q = { "Toggle Diagnostic List" },
|
||||
t = { "Toggle Inline Diagnostics" },
|
||||
n = { "Next Diagnostic" },
|
||||
N = { "Previous Diagnostic" },
|
||||
e = { "Open Diagnostic Float" },
|
||||
},
|
||||
d = {
|
||||
name = "Debug",
|
||||
b = { "Toggle Breakpoint" },
|
||||
u = { "Toggle UI" },
|
||||
c = { "Continue" },
|
||||
t = { "Run Test" },
|
||||
},
|
||||
g = {
|
||||
name = "DiffView",
|
||||
o = { "<cmd>DiffviewOpen<cr>", "Open Diff - Current" },
|
||||
O = { "<cmd>DiffviewOpen origin/main...HEAD<cr>", "Open Diff - Main" },
|
||||
h = { "<cmd>DiffviewFileHistory<cr>", "Diff History" },
|
||||
H = {
|
||||
"<cmd>DiffviewFileHistory --range=origin..HEAD<cr>",
|
||||
"Diff History - Main",
|
||||
},
|
||||
c = { "<cmd>DiffviewClose<cr>", "Close Diff" },
|
||||
b = { "Git Blame Line" },
|
||||
B = { "Git Blame Full" },
|
||||
},
|
||||
f = {
|
||||
name = "Find - Telescope",
|
||||
f = { "<cmd>Telescope find_files<cr>", "Find File" },
|
||||
g = { "<cmd>Telescope live_grep<cr>", "Live Grep" },
|
||||
b = { "<cmd>Telescope buffers<cr>", "Find Buffer" },
|
||||
j = { "<cmd>Telescope jumplist<cr>", "Jump List" },
|
||||
h = { "<cmd>Telescope help_tags<cr>", "Help Tags" },
|
||||
},
|
||||
l = {
|
||||
name = "LSP",
|
||||
D = { "Declaration" },
|
||||
d = { "Definition" },
|
||||
f = { "Format" },
|
||||
i = { "Implementation" },
|
||||
n = { "Rename" },
|
||||
r = { "References" },
|
||||
t = { "Type Definition" },
|
||||
},
|
||||
s = {
|
||||
name = "Screenshot",
|
||||
mode = { "v", "n" },
|
||||
b = { "Buffer Screenshot", mode = { "v", "n" } },
|
||||
s = { "Selected Screenshot", mode = "v" },
|
||||
v = { "Visual Screenshot", mode = "n" },
|
||||
},
|
||||
},
|
||||
})
|
Loading…
x
Reference in New Issue
Block a user