commit f610209affbc014323403755292f06b410a07b42 Author: fred <> Date: Fri Jun 20 11:59:24 2025 -0700 gitea repo diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2991fdc --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/dotfiles/ssh/ +/dotfiles/i3blocks/config +.sops.yaml diff --git a/dotfiles/bash_files/all_hosts/bashrc b/dotfiles/bash_files/all_hosts/bashrc new file mode 100644 index 0000000..c8c36ca --- /dev/null +++ b/dotfiles/bash_files/all_hosts/bashrc @@ -0,0 +1,23 @@ +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +#dont put duplicate lines or lines starting with space in the history +# See bash(1) for more options +HISTCONTROL=ignoreboth +HISTFILESIZE=-1 +HISTSIZE=-1 +export PROMPT_COMMAND='history -a' + +if [ -f ~/.bash_local ]; then + . ~/.bash_local +fi + + +PS1="\[\e[32m\][\[\e[m\]\[\e[32m\]\u\[\e[m\]\[\e[32m\]@\[\e[m\]\[\e[32m\]\h\[\e[m\]\[\e[32m\]]\[\e[m\]\[\e[34m\]\W\[\e[m\]\[\e[36m\]\\$\[\e[m\] " +if [ ! -z "$SSH_CLIENT" ] +then + PS1="\[\e[32m\][\[\e[m\]\[\e[31m\]\u\[\e[m\]\[\e[31m\]@\[\e[m\]\[\e[31m\]\h\[\e[m\]\[\e[32m\]]\[\e[m\]\[\e[34m\]\W\[\e[m\]\[\e[36m\]\\$\[\e[m\] " +fi + +export PATH=$PATH:$HOME/bin + diff --git a/dotfiles/bash_files/all_hosts/config b/dotfiles/bash_files/all_hosts/config new file mode 100644 index 0000000..662512f --- /dev/null +++ b/dotfiles/bash_files/all_hosts/config @@ -0,0 +1,19 @@ +alias cp="cp -i" # confirm before overwriting something +alias df='df -h' # human-readable sizes +alias free='free -m' # show sizes in MB +alias du='du -h' +alias diff='diff --color=auto' +alias grep='grep --color=auto' +alias ip='ip -color=auto' +alias ls='ls --color=auto' +alias vm='mv' +alias cat='bat -pp' +alias ll="ls -lhA" + +rnd() { + echo $((RANDOM%10000+1000)) +} + +### NIX ### +alias rebuild="sudo nixos-rebuild switch --flake ~/nixos#$NIXHOST" +alias search="nix search nixpkgs" diff --git a/dotfiles/bash_files/desk/docker b/dotfiles/bash_files/desk/docker new file mode 100644 index 0000000..d622b16 --- /dev/null +++ b/dotfiles/bash_files/desk/docker @@ -0,0 +1,38 @@ +### Docker ### +alias dps="docker ps --format '{{.Names}}'" + +d_term(){ + docker exec -it $1 /bin/bash +} + +d_up(){ + path=~/docker + if [[ -z "$1" && $(pwd) == "$path/"* ]]; then + docker compose up -d + elif [[ -z "$1" && $(pwd) != "$path/"* ]]; then + echo "not in compose folder" + elif [[ -n "$1" ]]; then + if ls "$path" | grep -q "$1"; then + (cd "$path/$1" && docker compose up -d) + else + echo "container $1 not found" + ls "$path" + fi + fi +} +d_down(){ + path=~/docker + if [[ -z "$1" && $(pwd) == "$path/"* ]]; then + docker compose down + elif [[ -z "$1" && $(pwd) != "$path/"* ]]; then + echo "not in compose folder" + elif [[ -n "$1" ]]; then + if ls "$path" | grep -q "$1"; then + (cd "$path/$1" && docker compose down) + else + echo "container $1 not found" + ls "$path" + fi + fi +} + diff --git a/dotfiles/bash_files/desk/methods b/dotfiles/bash_files/desk/methods new file mode 100644 index 0000000..705d939 --- /dev/null +++ b/dotfiles/bash_files/desk/methods @@ -0,0 +1,23 @@ +mp(){ + nohup mousepad $1 /dev/null 2>&1 & + disown +} + +cs(){ + # cp -l fullpath fullpath/Documents/cheatsheet + # path=~/Documents/cheatsheet + path=/solid/dir/reference/cheatsheet/ + if [[ -z "$1" ]]; then + ls $path + else + if [[ $2 = "-e" ]]; then + vim $path/$1 + else + bat -pp $path/$1 + fi + fi +} + +timer(){ + while true; do printf '%s\r' "$(date)"; done +} diff --git a/dotfiles/bash_files/desk/shortcuts b/dotfiles/bash_files/desk/shortcuts new file mode 100644 index 0000000..114cf0d --- /dev/null +++ b/dotfiles/bash_files/desk/shortcuts @@ -0,0 +1,7 @@ +alias ctllist="systemctl --type=service" +alias esc='setxkbmap -option "caps:swapescape"' +alias checkip="curl ipinfo.io" +alias hold='hold=$(pwd)' + +alias ollama_up="./scripts/VM/VMmanager.sh macvtap; sudo virsh start ollama_vm" + diff --git a/dotfiles/gtk-3.0/bookmarks b/dotfiles/gtk-3.0/bookmarks new file mode 100644 index 0000000..b0435a0 --- /dev/null +++ b/dotfiles/gtk-3.0/bookmarks @@ -0,0 +1,10 @@ +file:///home/fred/Downloads +file:///home/fred/Documents +file:///home/fred/scripts +file:///nfs +file:///solid/dir/reference/cheatsheet +file:///solid +file:///solid/dir/reference/scratch +file:///docker/compose docker +file:///solid/job +file:///home/fred/nixos diff --git a/dotfiles/i3/config b/dotfiles/i3/config new file mode 100644 index 0000000..393aab1 --- /dev/null +++ b/dotfiles/i3/config @@ -0,0 +1,217 @@ +font pango:monospace 8 +exec --no-startup-id dex --autostart --environment i3 +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork + +# applets +exec --no-startup-id nm-applet +exec volumeicon +# Use pactl to adjust volume in PulseAudio. +set $refresh_i3status killall -SIGUSR1 i3status +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status + +# use these keys for focus, movement, and resize directions when reaching for +# the arrows is not convenient +set $up k +set $down j +set $left h +set $right l + +# use Mouse+Mod1 to drag floating windows to their wanted position +floating_modifier Mod1 +#floating_modifier Mod4 +# change focus +bindsym Mod4+$left focus left +bindsym Mod4+$down focus down +bindsym Mod4+$up focus up +bindsym Mod4+$right focus right + +# alternatively, you can use the cursor keys: +bindsym Mod4+Left focus left +bindsym Mod4+Down focus down +bindsym Mod4+Up focus up +bindsym Mod4+Right focus right + +# move focused window +bindsym Control+Shift+$left move left +bindsym Control+Shift+$down move down +bindsym Control+Shift+$up move up +bindsym Control+Shift+$right move right + +# alternatively, you can use the cursor keys: +bindsym Mod4+Shift+Left move left +bindsym Mod4+Shift+Down move down +bindsym Mod4+Shift+Up move up +bindsym Mod4+Shift+Right move right + +# split in horizontal orientation +bindsym Mod4+period split h +bindsym Mod4+c split h + +# split in vertical orientation +bindsym Mod4+comma split v +bindsym Mod4+x split v + +# enter fullscreen mode for the focused container +bindsym Mod4+g fullscreen toggle + +# toggle tiling / floating +bindsym Control+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym Control+space focus mode_toggle + +# move the currently focused window to the scratchpad +bindsym Control+Shift+0 move scratchpad + +# Show the next scratchpad window or hide the focused scratchpad window. +# If there are multiple scratchpad windows, this command cycles through them. +bindsym Control+0 scratchpad show + +# Define scripts folder +set $scripts "/home/fred/scripts" + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +#set $ws10 "10" + +# switch to workspace +bindsym Control+1 workspace number $ws1 +bindsym Control+2 workspace number $ws2 +bindsym Control+3 workspace number $ws3 +bindsym Control+4 workspace number $ws4 +bindsym Control+5 workspace number $ws5 +bindsym Control+6 workspace number $ws6 +bindsym Control+7 workspace number $ws7 +bindsym Control+8 workspace number $ws8 +bindsym Control+9 workspace number $ws9 +#bindsym Control+0 workspace number $ws10 + +# move focused container to workspace +bindsym Control+Shift+1 move container to workspace number $ws1 +bindsym Control+Shift+2 move container to workspace number $ws2 +bindsym Control+Shift+3 move container to workspace number $ws3 +bindsym Control+Shift+4 move container to workspace number $ws4 +bindsym Control+Shift+5 move container to workspace number $ws5 +bindsym Control+Shift+6 move container to workspace number $ws6 +bindsym Control+Shift+7 move container to workspace number $ws7 +bindsym Control+Shift+8 move container to workspace number $ws8 +bindsym Control+Shift+9 move container to workspace number $ws9 +#bindsym Control+Shift+0 move container to workspace number $ws10 + + +# resize window (you can also use the mouse for that) +bindsym Control+Mod4+h resize shrink width 10 px or 10 ppt +bindsym Control+Mod4+j resize grow height 10 px or 10 ppt +bindsym Control+Mod4+k resize shrink height 10 px or 10 ppt +bindsym Control+Mod4+l resize grow width 10 px or 10 ppt + +bindsym Mod4+Button4 resize shrink width 10 px or 10 ppt +bindsym Mod4+Button5 resize grow height 10 px or 10 ppt +bindsym Mod4+Button6 resize shrink height 10 px or 10 ppt +bindsym Mod4+Button7 resize grow width 10 px or 10 ppt + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + status_command i3blocks + tray_output HDMI-A-0 + +} + +####session management +bindsym Mod4+grave exec screens 4 +bindsym Control+Shift+q kill +#bindsym Control+Shift+c reload +bindsym Control+Shift+r restart +#bindsym Control+Mod1+p exec i3-msg exit +bindsym Control+Mod1+p exec xfce4-session-logout --logout +bindsym Control+Mod1+bracketright exec i3lock -c 000000 +bindsym Control+Mod1+Delete exec i3-sensible-terminal -e 'sh $scripts/setup.sh off' +bindsym Control+Shift+Delete exec i3-sensible-terminal -e 'sh $scripts/setup.sh reboot' +bindsym Control+Mod4+F12 exec i3-sensible-terminal -e 'sh $scripts/VM/VMmanager.sh toggle' +bindsym Control+Shift+F12 exec i3-sensible-terminal -e 'sh $scripts/VM/VMmanager.sh reboot' +bindsym --release Control+Mod4+v exec "xdotool keyup Control keyup Super click 2" +bindsym --release Control+Mod4+d exec "xdotool keyup Control keyup Super type $(date +%y.%m.%d.)" + +####Screenshots +bindsym Control+Shift+Print exec xfce4-screenshooter -r +bindsym Control+Mod1+Print exec xfce4-screenshooter -w +bindsym Print exec xfce4-screenshooter + +####program shortcuts +bindsym Mod4+r exec "rofi -modi drun,run -show drun" +bindsym Mod1+c exec --no-startup-id rofi -show calc -modi calc -no-show-match -no-sort +bindsym Mod4+f exec firefox +bindsym Mod4+v exec thunar +bindsym Mod4+t exec i3-sensible-terminal +bindsym Mod4+a exec xterm -e "ssh -t mf" +bindsym Mod4+d workspace number $ws2; exec discord +bindsym Mod4+w exec deluge +bindsym Mod4+b exec mousepad + +bindsym --release Mod4+u exec sh $scripts/shortcuts.sh searchbar + +####Function keys +#bindsym F1 exec playerctl play-pause +#bindsym F2 exec playerctl stop +#bindsym F3 exec playerctl previous +#bindsym F4 exec playerctl next +#bindsym F5 exec --no-startup-id pactl set-sink-mute 0 toggle +#bindsym F6 exec --no-startup-id pactl set-sink-volume 0 -5% +#bindsym F7 exec --no-startup-id pactl set-sink-volume 0 +5% +#bindsym --release F8 exec xdotool key Shift+Alt+b +#bindsym --release F8 exec xdotool key s +#bindsym --release F3 exec xdotool key p +#bindsym --release F4 exec xdotool key n +#bindsym --release F1 exec xdotool key space + +#########XP-pen +#bindsym Mod1+Up exec sh $scripts/remote/xp.sh q_up +#bindsym Mod1+Down exec sh $scripts/remote/xp.sh q_down +bindsym --release Mod1+1 exec sh $scripts/remote/xp.sh k1 +bindsym --release Mod1+2 exec sh $scripts/remote/xp.sh k2 +bindsym --release Mod1+3 exec sh $scripts/remote/xp.sh k3 +bindsym --release Mod1+4 exec sh $scripts/remote/xp.sh k4 +bindsym --release Mod1+5 exec sh $scripts/remote/xp.sh k5 +bindsym --release Mod1+6 exec sh $scripts/remote/xp.sh k6 +bindsym --release Mod1+7 exec sh $scripts/remote/xp.sh k7 +bindsym --release Mod1+8 exec sh $scripts/remote/xp.sh k8 +bindsym --release Mod1+9 exec sh $scripts/remote/xp.sh k9 +bindsym --release Mod1+0 exec sh $scripts/remote/xp.sh k10 + + +####startup +exec --no-startup-id sh $scripts/init.sh +#workspace 1 output HDMI-2 +#workspace 2 output DP-5 +#workspace 3 output DP-6 + +workspace 1 output HDMI-A-0 +workspace 2 output DisplayPort-1 +workspace 3 output DisplayPort-2 + +exec_always --no-startup-id feh --bg-scale /home/fred/Pictures/wallpaper/800252.png +exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & + +exec --no-startup-id xset dpms 0 0 600 & +exec --no-startup-id xss-lock -- i3lock -c 000000 & +#exec --no-startup-id numlockx o +exec_always --no-startup-id exec sh $scripts/setup.sh sync +exec --no-startup-id xbindkeys +exec --no-startup-id i3-msg 'workspace 3; exec firefox' +exec --no-startup-id solaar --window=hide +exec --no-startup-id input-remapper-control --command autoload +#exec --no-startup-id /usr/lib/pentablet/PenTablet +#for_window [class="PenTablet"] move scratchpad diff --git a/dotfiles/i3blocks/clean b/dotfiles/i3blocks/clean new file mode 100644 index 0000000..a4dfcd3 --- /dev/null +++ b/dotfiles/i3blocks/clean @@ -0,0 +1,23 @@ +# i3blocks configuration file +# +# The i3blocks man page describes the usage of the binary, +# and its website describes the configuration: +# +# https://vivien.github.io/i3blocks + + +# Global properties +separator=true +separator_block_width=15 + +[public-ip] +command=wget -qO - icanhazip.com +interval=once + + +[time] +command=date '+%m-%d %H:%M' +#command=date '+%Y-%m-%d %I:%M' +interval=1 + + diff --git a/dotfiles/i3blocks/guest b/dotfiles/i3blocks/guest new file mode 100644 index 0000000..c693ec9 --- /dev/null +++ b/dotfiles/i3blocks/guest @@ -0,0 +1,27 @@ +# i3blocks configuration file +# +# The i3blocks man page describes the usage of the binary, +# and its website describes the configuration: +# +# https://vivien.github.io/i3blocks + + +# Global properties +separator=true +separator_block_width=15 + +[public-ip] +command=wget -qO - icanhazip.com +interval=once + + +[time] +command=date '+%m-%d %H:%M' +#command=date '+%Y-%m-%d %I:%M' +interval=1 + +[click] +full_text=[Keyboard] +command=sh /home/fred/scripts/VM/keyboard_vm.sh +color=#FF0000 + diff --git a/dotfiles/i3blocks/host b/dotfiles/i3blocks/host new file mode 100644 index 0000000..b1c7ee1 --- /dev/null +++ b/dotfiles/i3blocks/host @@ -0,0 +1,27 @@ +# i3blocks configuration file +# +# The i3blocks man page describes the usage of the binary, +# and its website describes the configuration: +# +# https://vivien.github.io/i3blocks + + +# Global properties +separator=true +separator_block_width=15 + +[public-ip] +command=wget -qO - icanhazip.com +interval=once + + +[time] +command=date '+%m-%d %H:%M' +#command=date '+%Y-%m-%d %I:%M' +interval=1 + +[click] +full_text=[Keyboard] +command=sh /home/fred/scripts/VM/keyboard_vm.sh +color=#00FF00 + diff --git a/dotfiles/nvim/.neoconf.json b/dotfiles/nvim/.neoconf.json new file mode 100644 index 0000000..2d7a81f --- /dev/null +++ b/dotfiles/nvim/.neoconf.json @@ -0,0 +1,20 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + }, + "lspconfig": { + "lua_ls": { + "Lua.format.enable": false + } + } +} diff --git a/dotfiles/nvim/.stylua.toml b/dotfiles/nvim/.stylua.toml new file mode 100644 index 0000000..bfcffff --- /dev/null +++ b/dotfiles/nvim/.stylua.toml @@ -0,0 +1,7 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" +collapse_simple_statement = "Always" diff --git a/dotfiles/nvim/README.md b/dotfiles/nvim/README.md new file mode 100644 index 0000000..71d48de --- /dev/null +++ b/dotfiles/nvim/README.md @@ -0,0 +1,34 @@ +# AstroNvim Template + +**NOTE:** This is for AstroNvim v5+ + +A template for getting started with [AstroNvim](https://github.com/AstroNvim/AstroNvim) + +## πŸ› οΈ Installation + +#### Make a backup of your current nvim and shared folder + +```shell +mv ~/.config/nvim ~/.config/nvim.bak +mv ~/.local/share/nvim ~/.local/share/nvim.bak +mv ~/.local/state/nvim ~/.local/state/nvim.bak +mv ~/.cache/nvim ~/.cache/nvim.bak +``` + +#### Create a new user repository from this template + +Press the "Use this template" button above to create a new repository to store your user configuration. + +You can also just clone this repository directly if you do not want to track your user configuration in GitHub. + +#### Clone the repository + +```shell +git clone https://github.com// ~/.config/nvim +``` + +#### Start Neovim + +```shell +nvim +``` diff --git a/dotfiles/nvim/init.lua b/dotfiles/nvim/init.lua new file mode 100644 index 0000000..2ce1cdd --- /dev/null +++ b/dotfiles/nvim/init.lua @@ -0,0 +1,19 @@ +-- This file simply bootstraps the installation of Lazy.nvim and then calls other files for execution +-- This file doesn't necessarily need to be touched, BE CAUTIOUS editing this file and proceed at your own risk. +local lazypath = vim.env.LAZY or vim.fn.stdpath "data" .. "/lazy/lazy.nvim" +if not (vim.env.LAZY or (vim.uv or vim.loop).fs_stat(lazypath)) then + -- stylua: ignore + vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath }) +end +vim.opt.rtp:prepend(lazypath) + +-- validate that lazy is available +if not pcall(require, "lazy") then + -- stylua: ignore + vim.api.nvim_echo({ { ("Unable to load lazy from: %s\n"):format(lazypath), "ErrorMsg" }, { "Press any key to exit...", "MoreMsg" } }, true, {}) + vim.fn.getchar() + vim.cmd.quit() +end + +require "lazy_setup" +require "polish" diff --git a/dotfiles/nvim/lua/community.lua b/dotfiles/nvim/lua/community.lua new file mode 100644 index 0000000..c842899 --- /dev/null +++ b/dotfiles/nvim/lua/community.lua @@ -0,0 +1,12 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroCommunity: import any community modules here +-- We import this file in `lazy_setup.lua` before the `plugins/` folder. +-- This guarantees that the specs are processed before any user plugins. + +---@type LazySpec +return { + "AstroNvim/astrocommunity", + { import = "astrocommunity.pack.lua" }, + -- import/override with your plugins folder +} diff --git a/dotfiles/nvim/lua/lazy_setup.lua b/dotfiles/nvim/lua/lazy_setup.lua new file mode 100644 index 0000000..4d9552f --- /dev/null +++ b/dotfiles/nvim/lua/lazy_setup.lua @@ -0,0 +1,32 @@ +require("lazy").setup({ + { + "AstroNvim/AstroNvim", + version = "^5", -- Remove version tracking to elect for nightly AstroNvim + import = "astronvim.plugins", + opts = { -- AstroNvim options must be set here with the `import` key + mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up + maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up + icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available) + pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override + update_notifications = true, -- Enable/disable notification about running `:Lazy update` twice to update pinned plugins + }, + }, + { import = "community" }, + { import = "plugins" }, +} --[[@as LazySpec]], { + -- Configure any other `lazy.nvim` configuration options here + install = { colorscheme = { "astrotheme", "habamax" } }, + ui = { backdrop = 100 }, + performance = { + rtp = { + -- disable some rtp plugins, add more to your liking + disabled_plugins = { + "gzip", + "netrwPlugin", + "tarPlugin", + "tohtml", + "zipPlugin", + }, + }, + }, +} --[[@as LazyConfig]]) diff --git a/dotfiles/nvim/lua/plugins/astrocore.lua b/dotfiles/nvim/lua/plugins/astrocore.lua new file mode 100644 index 0000000..03d7441 --- /dev/null +++ b/dotfiles/nvim/lua/plugins/astrocore.lua @@ -0,0 +1,85 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more! +-- Configuration documentation can be found with `:h astrocore` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astrocore", + ---@type AstroCoreOpts + opts = { + -- Configure core features of AstroNvim + features = { + large_buf = { size = 1024 * 256, lines = 10000 }, -- set global limits for large files for disabling features like treesitter + autopairs = true, -- enable autopairs at start + cmp = true, -- enable completion at start + diagnostics = { virtual_text = true, virtual_lines = false }, -- diagnostic settings on startup + highlighturl = true, -- highlight URLs at start + notifications = true, -- enable notifications at start + }, + -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on + diagnostics = { + virtual_text = true, + underline = true, + }, + -- passed to `vim.filetype.add` + filetypes = { + -- see `:h vim.filetype.add` for usage + extension = { + foo = "fooscript", + }, + filename = { + [".foorc"] = "fooscript", + }, + pattern = { + [".*/etc/foo/.*"] = "fooscript", + }, + }, + -- vim options can be configured here + options = { + opt = { -- vim.opt. + relativenumber = true, -- sets vim.opt.relativenumber + number = true, -- sets vim.opt.number + spell = false, -- sets vim.opt.spell + signcolumn = "yes", -- sets vim.opt.signcolumn to yes + wrap = false, -- sets vim.opt.wrap + }, + g = { -- vim.g. + -- configure global vim variables (vim.g) + -- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup` + -- This can be found in the `lua/lazy_setup.lua` file + }, + }, + -- Mappings can be configured through AstroCore as well. + -- NOTE: keycodes follow the casing in the vimdocs. For example, `` must be capitalized + mappings = { + -- first key is the mode + n = { + -- second key is the lefthand side of the map + + -- navigate buffer tabs + ["]b"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" }, + ["[b"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" }, + + -- mappings seen under group name "Buffer" + ["bd"] = { + function() + require("astroui.status.heirline").buffer_picker( + function(bufnr) require("astrocore.buffer").close(bufnr) end + ) + end, + desc = "Close buffer from tabline", + }, + + -- tables with just a `desc` key will be registered with which-key if it's installed + -- this is useful for naming menus + -- ["b"] = { desc = "Buffers" }, + + -- setting a mapping to false will disable it + -- [""] = false, + }, + }, + }, +} diff --git a/dotfiles/nvim/lua/plugins/astrolsp.lua b/dotfiles/nvim/lua/plugins/astrolsp.lua new file mode 100644 index 0000000..720b9d3 --- /dev/null +++ b/dotfiles/nvim/lua/plugins/astrolsp.lua @@ -0,0 +1,105 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine +-- Configuration documentation can be found with `:h astrolsp` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astrolsp", + ---@type AstroLSPOpts + opts = { + -- Configuration table of features provided by AstroLSP + features = { + codelens = true, -- enable/disable codelens refresh on start + inlay_hints = false, -- enable/disable inlay hints on start + semantic_tokens = true, -- enable/disable semantic token highlighting + }, + -- customize lsp formatting options + formatting = { + -- control auto formatting on save + format_on_save = { + enabled = true, -- enable or disable format on save globally + allow_filetypes = { -- enable format on save for specified filetypes only + -- "go", + }, + ignore_filetypes = { -- disable format on save for specified filetypes + -- "python", + }, + }, + disabled = { -- disable formatting capabilities for the listed language servers + -- disable lua_ls formatting capability if you want to use StyLua to format your lua code + -- "lua_ls", + }, + timeout_ms = 1000, -- default format timeout + -- filter = function(client) -- fully override the default formatting function + -- return true + -- end + }, + -- enable servers that you already have installed without mason + servers = { + -- "pyright" + }, + -- customize language server configuration options passed to `lspconfig` + ---@diagnostic disable: missing-fields + config = { + -- clangd = { capabilities = { offsetEncoding = "utf-8" } }, + }, + -- customize how language servers are attached + handlers = { + -- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server + -- function(server, opts) require("lspconfig")[server].setup(opts) end + + -- the key is the server that is being setup with `lspconfig` + -- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server + -- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed + }, + -- Configure buffer local auto commands to add when attaching a language server + autocmds = { + -- first key is the `augroup` to add the auto commands to (:h augroup) + lsp_codelens_refresh = { + -- Optional condition to create/delete auto command group + -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` + -- condition will be resolved for each client on each execution and if it ever fails for all clients, + -- the auto commands will be deleted for that buffer + cond = "textDocument/codeLens", + -- cond = function(client, bufnr) return client.name == "lua_ls" end, + -- list of auto commands to set + { + -- events to trigger + event = { "InsertLeave", "BufEnter" }, + -- the rest of the autocmd options (:h nvim_create_autocmd) + desc = "Refresh codelens (buffer)", + callback = function(args) + if require("astrolsp").config.features.codelens then vim.lsp.codelens.refresh { bufnr = args.buf } end + end, + }, + }, + }, + -- mappings to be set up on attaching of a language server + mappings = { + n = { + -- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean + gD = { + function() vim.lsp.buf.declaration() end, + desc = "Declaration of current symbol", + cond = "textDocument/declaration", + }, + ["uY"] = { + function() require("astrolsp.toggles").buffer_semantic_tokens() end, + desc = "Toggle LSP semantic highlight (buffer)", + cond = function(client) + return client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens ~= nil + end, + }, + }, + }, + -- A custom `on_attach` function to be run after the default `on_attach` function + -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) + on_attach = function(client, bufnr) + -- this would disable semanticTokensProvider for all clients + -- client.server_capabilities.semanticTokensProvider = nil + end, + }, +} diff --git a/dotfiles/nvim/lua/plugins/astroui.lua b/dotfiles/nvim/lua/plugins/astroui.lua new file mode 100644 index 0000000..737a2fb --- /dev/null +++ b/dotfiles/nvim/lua/plugins/astroui.lua @@ -0,0 +1,39 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroUI provides the basis for configuring the AstroNvim User Interface +-- Configuration documentation can be found with `:h astroui` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astroui", + ---@type AstroUIOpts + opts = { + -- change colorscheme + colorscheme = "astrodark", + -- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes + highlights = { + init = { -- this table overrides highlights in all themes + -- Normal = { bg = "#000000" }, + }, + astrodark = { -- a table of overrides/changes when applying the astrotheme theme + -- Normal = { bg = "#000000" }, + }, + }, + -- Icons can be configured throughout the interface + icons = { + -- configure the loading of the lsp in the status line + LSPLoading1 = "β ‹", + LSPLoading2 = "β ™", + LSPLoading3 = "β Ή", + LSPLoading4 = "β Έ", + LSPLoading5 = "β Ό", + LSPLoading6 = "β ΄", + LSPLoading7 = "β ¦", + LSPLoading8 = "β §", + LSPLoading9 = "β ‡", + LSPLoading10 = "⠏", + }, + }, +} diff --git a/dotfiles/nvim/lua/plugins/mason.lua b/dotfiles/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..2d79b5f --- /dev/null +++ b/dotfiles/nvim/lua/plugins/mason.lua @@ -0,0 +1,28 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize Mason + +---@type LazySpec +return { + -- use mason-tool-installer for automatically installing Mason packages + { + "WhoIsSethDaniel/mason-tool-installer.nvim", + -- overrides `require("mason-tool-installer").setup(...)` + opts = { + -- Make sure to use the names found in `:Mason` + ensure_installed = { + -- install language servers + "lua-language-server", + + -- install formatters + "stylua", + + -- install debuggers + "debugpy", + + -- install any other package + "tree-sitter-cli", + }, + }, + }, +} diff --git a/dotfiles/nvim/lua/plugins/none-ls.lua b/dotfiles/nvim/lua/plugins/none-ls.lua new file mode 100644 index 0000000..2b0ed18 --- /dev/null +++ b/dotfiles/nvim/lua/plugins/none-ls.lua @@ -0,0 +1,24 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize None-ls sources + +---@type LazySpec +return { + "nvimtools/none-ls.nvim", + opts = function(_, opts) + -- opts variable is the default configuration table for the setup function call + -- local null_ls = require "null-ls" + + -- Check supported formatters and linters + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics + + -- Only insert new sources, do not replace the existing ones + -- (If you wish to replace, use `opts.sources = {}` instead of the `list_insert_unique` function) + opts.sources = require("astrocore").list_insert_unique(opts.sources, { + -- Set a formatter + -- null_ls.builtins.formatting.stylua, + -- null_ls.builtins.formatting.prettier, + }) + end, +} diff --git a/dotfiles/nvim/lua/plugins/treesitter.lua b/dotfiles/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..94436aa --- /dev/null +++ b/dotfiles/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,15 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize Treesitter + +---@type LazySpec +return { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "lua", + "vim", + -- add more arguments for adding more treesitter parsers + }, + }, +} diff --git a/dotfiles/nvim/lua/plugins/user.lua b/dotfiles/nvim/lua/plugins/user.lua new file mode 100644 index 0000000..b7de6df --- /dev/null +++ b/dotfiles/nvim/lua/plugins/user.lua @@ -0,0 +1,88 @@ +if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- You can also add or configure plugins by creating files in this `plugins/` folder +-- PLEASE REMOVE THE EXAMPLES YOU HAVE NO INTEREST IN BEFORE ENABLING THIS FILE +-- Here are some examples: + +---@type LazySpec +return { + + -- == Examples of Adding Plugins == + + "andweeb/presence.nvim", + { + "ray-x/lsp_signature.nvim", + event = "BufRead", + config = function() require("lsp_signature").setup() end, + }, + + -- == Examples of Overriding Plugins == + + -- customize dashboard options + { + "folke/snacks.nvim", + opts = { + dashboard = { + preset = { + header = table.concat({ + " β–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ ", + "β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ", + "β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ", + "β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ", + "β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆ β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ ", + "", + "β–ˆβ–ˆβ–ˆβ€ β–ˆβ–ˆβ€β–ˆβ–ˆβ€ β–ˆβ–ˆβ€β–ˆβ–ˆβ€β–ˆβ–ˆβ–ˆβ€ β–ˆβ–ˆβ–ˆ", + "β–ˆβ–ˆβ–ˆβ–ˆβ€ β–ˆβ–ˆβ€β–ˆβ–ˆβ€ β–ˆβ–ˆβ€β–ˆβ–ˆβ€β–ˆβ–ˆβ–ˆβ–ˆβ€ β–ˆβ–ˆβ–ˆβ–ˆ", + "β–ˆβ–ˆβ€β–ˆβ–ˆβ€ β–ˆβ–ˆβ€β–ˆβ–ˆβ€ β–ˆβ–ˆβ€β–ˆβ–ˆβ€β–ˆβ–ˆβ€β–ˆβ–ˆβ–ˆβ–ˆβ€β–ˆβ–ˆ", + "β–ˆβ–ˆβ€β€β–ˆβ–ˆβ€β–ˆβ–ˆβ€β€β–ˆβ–ˆβ€ β–ˆβ–ˆβ€β€β–ˆβ–ˆβ€β–ˆβ–ˆβ€β€β–ˆβ–ˆβ€β€β–ˆβ–ˆ", + "β–ˆβ–ˆβ€ β€β–ˆβ–ˆβ–ˆβ–ˆβ€ β€β–ˆβ–ˆβ–ˆβ–ˆβ€β€ β–ˆβ–ˆβ€β–ˆβ–ˆβ€     β–ˆβ–ˆ", + }, "\n"), + }, + }, + }, + }, + + -- You can disable default plugins as follows: + { "max397574/better-escape.nvim", enabled = false }, + + -- You can also easily customize additional setup of plugins that is outside of the plugin's setup call + { + "L3MON4D3/LuaSnip", + config = function(plugin, opts) + require "astronvim.plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call + -- add more custom luasnip configuration such as filetype extend or custom snippets + local luasnip = require "luasnip" + luasnip.filetype_extend("javascript", { "javascriptreact" }) + end, + }, + + { + "windwp/nvim-autopairs", + config = function(plugin, opts) + require "astronvim.plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call + -- add more custom autopairs configuration such as custom rules + local npairs = require "nvim-autopairs" + local Rule = require "nvim-autopairs.rule" + local cond = require "nvim-autopairs.conds" + npairs.add_rules( + { + Rule("$", "$", { "tex", "latex" }) + -- don't add a pair if the next character is % + :with_pair(cond.not_after_regex "%%") + -- don't add a pair if the previous character is xxx + :with_pair( + cond.not_before_regex("xxx", 3) + ) + -- don't move right when repeat character + :with_move(cond.none()) + -- don't delete if the next character is xx + :with_del(cond.not_after_regex "xx") + -- disable adding a newline when you press + :with_cr(cond.none()), + }, + -- disable for .vim files, but it work for another filetypes + Rule("a", "a", "-vim") + ) + end, + }, +} diff --git a/dotfiles/nvim/lua/polish.lua b/dotfiles/nvim/lua/polish.lua new file mode 100644 index 0000000..642719f --- /dev/null +++ b/dotfiles/nvim/lua/polish.lua @@ -0,0 +1,5 @@ +if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- This will run last in the setup process. +-- This is just pure lua so anything that doesn't +-- fit in the normal config locations above can go here diff --git a/dotfiles/nvim/neovim.yml b/dotfiles/nvim/neovim.yml new file mode 100644 index 0000000..b9235ab --- /dev/null +++ b/dotfiles/nvim/neovim.yml @@ -0,0 +1,6 @@ +--- +base: lua51 + +globals: + vim: + any: true diff --git a/dotfiles/nvim/selene.toml b/dotfiles/nvim/selene.toml new file mode 100644 index 0000000..e7005c3 --- /dev/null +++ b/dotfiles/nvim/selene.toml @@ -0,0 +1,8 @@ +std = "neovim" + +[rules] +global_usage = "allow" +if_same_then_else = "allow" +incorrect_standard_library_use = "allow" +mixed_table = "allow" +multiple_statements = "allow" diff --git a/dotfiles/qemu/qemu-hooks b/dotfiles/qemu/qemu-hooks new file mode 100755 index 0000000..8579b0b --- /dev/null +++ b/dotfiles/qemu/qemu-hooks @@ -0,0 +1,16 @@ +#!/bin/bash + +# note 25/5/31 these exports were included from my arch install, not sure why. disabling for now, if they arent needed the next time I look at this feel free to remove them +export XAUTHORITY=/home/fred/.Xauthority +export DISPLAY=:0 +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus + +#guest_name="$1" +#libvirt_task="$2" +if [[ $2 = "started" ]]; then + # on_hook runs inline on VMmanager + echo "no-op" +elif [[ $2 = "stopped" ]]; then + bash /home/fred/scripts/VM/VMmanager.sh off_hook +fi + diff --git a/dotfiles/solaar/config.yaml b/dotfiles/solaar/config.yaml new file mode 100644 index 0000000..0e15608 --- /dev/null +++ b/dotfiles/solaar/config.yaml @@ -0,0 +1,52 @@ +- 1.1.14 +- _NAME: MX Master 3S + _absent: [hi-res-scroll, lowres-scroll-mode, onboard_profiles, report_rate, report_rate_extended, pointer_speed, dpi_extended, speed-change, backlight, + backlight_level, backlight_duration_hands_out, backlight_duration_hands_in, backlight_duration_powered, backlight-timed, led_control, led_zone_, rgb_control, + rgb_zone_, brightness_control, per-key-lighting, fn-swap, persistent-remappable-keys, disable-keyboard-keys, crown-smooth, divert-crown, divert-gkeys, + m-key-leds, mr-key-led, multiplatform, gesture2-gestures, gesture2-divert, gesture2-params, sidetone, equalizer, adc_power_management] + _battery: 4100 + _modelId: B03400000000 + _sensitive: {change-host: false, divert-keys: false, reprogrammable-keys: false, scroll-ratchet: true, thumb-scroll-invert: false, thumb-scroll-mode: false} + _serial: 51EA2265 + _unitId: 51EA2265 + _wpid: B034 + change-host: null + divert-keys: {82: 0, 83: 0, 86: 0, 195: 1, 196: 1} + dpi: 1000 + hires-scroll-mode: false + hires-smooth-invert: false + hires-smooth-resolution: false + reprogrammable-keys: {80: 80, 81: 81, 82: 82, 83: 83, 86: 86, 195: 195, 196: 196} + scroll-ratchet: 1 + smart-shift: 1 + thumb-scroll-invert: true + thumb-scroll-mode: false +- _NAME: Wireless Keyboard MK270 + _modelId: Wireless Keyboard MK270 + _sensitive: {hires-scroll-mode: ignore, hires-smooth-invert: ignore, hires-smooth-resolution: ignore} + _serial: '00000000' + _unitId: '00000000' + _wpid: '4023' + fn-swap: false +- _NAME: Wireless Mouse M185 new + _sensitive: {hires-scroll-mode: ignore, hires-smooth-invert: ignore, hires-smooth-resolution: ignore} + _serial: '00000000' + _wpid: '4054' + divert-keys: {82: 0} + lowres-scroll-mode: false + pointer_speed: 256 + reprogrammable-keys: {80: 80, 81: 81, 82: 82} +- _NAME: MX Master 3 Wireless Mouse + _modelId: B02340820000 + _sensitive: {hires-scroll-mode: ignore, hires-smooth-invert: ignore, hires-smooth-resolution: ignore} + _serial: 73738B2B + _unitId: 73738B2B + _wpid: '4082' + change-host: null + divert-keys: {82: 0, 83: 0, 86: 0, 195: 0, 196: 0} + dpi: 1000 + reprogrammable-keys: {80: 80, 81: 81, 82: 82, 83: 83, 86: 86, 195: 195, 196: 196} + scroll-ratchet: 1 + smart-shift: 1 + thumb-scroll-invert: false + thumb-scroll-mode: false diff --git a/dotfiles/solaar/rules.yaml b/dotfiles/solaar/rules.yaml new file mode 100644 index 0000000..4591116 --- /dev/null +++ b/dotfiles/solaar/rules.yaml @@ -0,0 +1,20 @@ +%YAML 1.3 +--- +- Rule: + - KeyIsDown: Mouse Gesture Button + - KeyPress: + - Alt_L + - depress + - MouseClick: [left, depress] +- Rule: + - Key: [Mouse Gesture Button, released] + - KeyPress: + - Alt_L + - release + - MouseClick: [left, release] +- Rule: + - Key: [Smart Shift, pressed] + - KeyPress: + - [Control_L, Shift_L, Q] + - click +... diff --git a/dotfiles/thunar/uca.xml b/dotfiles/thunar/uca.xml new file mode 100644 index 0000000..7c72a7b --- /dev/null +++ b/dotfiles/thunar/uca.xml @@ -0,0 +1,90 @@ + + + + utilities-terminal + Open Terminal Here + + 1665544021585627-1 + cd %f && i3-sensible-terminal -hold + Example for a custom action + + * + + + + + + Open root here + + 1665876753058215-1 + sudo thunar %f + + + * + + + + inode-symlink + Symlink + + 1699833063931640-1 + ln -Ts %f "$(basename %n | sed "s/\(.*\)\.\(.*\)/\1-sl.\2/")" + Create a symlink + * + * + + + + + + + + + drive-harddisk + Hardlink + + 1699833176600678-2 + ln %f "$(basename %n | sed "s/\(.*\)\.\(.*\)/\1-hl.\2/")" + Create a hardlink + * + * + + + + + + + + + applications-utilities + batch hardlinks + + 1732821951376075-1 + bash -c 'for file in "$@"; do ln "$file" "$(dirname "$file")/hl-$(basename "$file")"; done' -- %F + + * + * + + + + + + + + + edit-paste + timestamp copy + + 1746467825367729-1 + ~/scripts/copy_with_timestamp.sh %f + create copy of file prepended with timestamp + * + * + + + + + + + + diff --git a/dotfiles/volumeicon/volumeicon b/dotfiles/volumeicon/volumeicon new file mode 100644 index 0000000..697cd75 --- /dev/null +++ b/dotfiles/volumeicon/volumeicon @@ -0,0 +1,26 @@ +[Alsa] +card=default +channel=Master + +[Notification] +show_notification=true +notification_type=0 + +[StatusIcon] +stepsize=5 +onclick=pavucontrol +theme=Default +use_panel_specific_icons=false +lmb_slider=false +mmb_mute=false +use_horizontal_slider=false +show_sound_level=false +use_transparent_background=false + +[Hotkeys] +up_enabled=false +down_enabled=false +mute_enabled=false +up=XF86AudioRaiseVolume +down=XF86AudioLowerVolume +mute=XF86AudioMute diff --git a/dotfiles/xbindkeys/xbindkeysrc b/dotfiles/xbindkeys/xbindkeysrc new file mode 100644 index 0000000..e4e3026 --- /dev/null +++ b/dotfiles/xbindkeys/xbindkeysrc @@ -0,0 +1,84 @@ +# For the benefit of emacs users: -*- shell-script -*- +########################### +# xbindkeys configuration # +########################### +# +# Version: 1.8.7 +# +# If you edit this file, do not forget to uncomment any lines +# that you change. +# The pound(#) symbol may be used anywhere for comments. +# +# To specify a key, you can use 'xbindkeys --key' or +# 'xbindkeys --multikey' and put one of the two lines in this file. +# +# The format of a command line is: +# "command to start" +# associated key +# +# +# A list of keys is in /usr/include/X11/keysym.h and in +# /usr/include/X11/keysymdef.h +# The XK_ is not needed. +# +# List of modifier: +# Release, Control, Shift, Mod1 (Alt), Mod2 (NumLock), +# Mod3 (CapsLock), Mod4 (win), Mod5 (Scroll). +# + +# The release modifier is not a standard X modifier, but you can +# use it if you want to catch release events instead of press events + +# By defaults, xbindkeys does not pay attention with the modifiers +# NumLock, CapsLock and ScrollLock. +# Uncomment the lines above if you want to pay attention to them. + +#keystate_numlock = enable +#keystate_capslock = enable +#keystate_scrolllock= enable + +#alias reset = "killall xbindkeys; sleep .2; xbindkeys" + +################################ +# Start of keybinds # +################################ + +### resize windows with super key + scroll +"xdotool key --clearmodifiers Super_L+ctrl+h" +Mod4 + b:7 + +"xdotool key --clearmodifiers Super_L+ctrl+l" +Mod4 + b:6 + +"xdotool key --clearmodifiers Super_L+ctrl+j" +Mod4 + b:4 + +"xdotool key --clearmodifiers Super_L+ctrl+k" +Mod4 + b:5 + + +### left and right with scroll wheel +#"xdotool key --clearmodifiers Left" +#b:7 + +#"xdotool key --clearmodifiers Right" +#b:6 + + +### switch workspaces with thumbbuttons +"sh ~/scripts/workspace_switcher.sh next" +b:9 + +"sh ~/scripts/workspace_switcher.sh prev" +b:8 + +"sh ~/scripts/workspace_switcher.sh send_next" +Mod4 + b:9 + +"sh ~/scripts/workspace_switcher.sh send_prev" +Mod4 + b:8 + + +################################## +# End of xbindkeys configuration # +################################## diff --git a/dotfiles/xfce-perchannel-xml/xsettings.xml b/dotfiles/xfce-perchannel-xml/xsettings.xml new file mode 100644 index 0000000..cc17916 --- /dev/null +++ b/dotfiles/xfce-perchannel-xml/xsettings.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dotfiles/xprofile/xprofile b/dotfiles/xprofile/xprofile new file mode 100644 index 0000000..b2d7a1b --- /dev/null +++ b/dotfiles/xprofile/xprofile @@ -0,0 +1,2 @@ +# give i3 config access to path +export PATH=$PATH:$HOME/bin diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0236e25 --- /dev/null +++ b/flake.lock @@ -0,0 +1,92 @@ +{ + "nodes": { + "firefox-addons": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "dir": "pkgs/firefox-addons", + "lastModified": 1747973023, + "narHash": "sha256-v2OgykASspKAyL+hYKlfa9PM4cwlFZ7/WQ1uvd256ko=", + "owner": "rycee", + "repo": "nur-expressions", + "rev": "c7ee05a5dc9b52ba7a6a660537fabaf711b7790a", + "type": "gitlab" + }, + "original": { + "dir": "pkgs/firefox-addons", + "owner": "rycee", + "repo": "nur-expressions", + "type": "gitlab" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1747978958, + "narHash": "sha256-pQQnbxWpY3IiZqgelXHIe/OAE/Yv4NSQq7fch7M6nXQ=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "7419250703fd5eb50e99bdfb07a86671939103ea", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1747744144, + "narHash": "sha256-W7lqHp0qZiENCDwUZ5EX/lNhxjMdNapFnbErcbnP11Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2795c506fe8fb7b03c36ccb51f75b6df0ab2553f", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "firefox-addons": "firefox-addons", + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "sops-nix": "sops-nix" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749592509, + "narHash": "sha256-VunQzfZFA+Y6x3wYi2UE4DEQ8qKoAZZCnZPUlSoqC+A=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "50754dfaa0e24e313c626900d44ef431f3210138", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..54d8504 --- /dev/null +++ b/flake.nix @@ -0,0 +1,72 @@ +{ + description = "Nixos config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + sops-nix.url = "github:Mic92/sops-nix"; + sops-nix.inputs.nixpkgs.follows = "nixpkgs"; + + firefox-addons.url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; + firefox-addons.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, firefox-addons, home-manager, sops-nix, ... }@inputs: { + nixosConfigurations = { + desk = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + firefox-addons = firefox-addons.packages.x86_64-linux; + }; + modules = [ + ./hosts/desk + ]; + }; + vm_ollama = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + ./hosts/vm_ollama + ]; + }; + vps_fz = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + }; + modules = [ + ./hosts/vps_fz + ]; + }; + # wip + lap = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + firefox-addons = firefox-addons.packages.x86_64-linux; + }; + modules = [ + ./hosts/laptop + ]; + }; + # wip + htpc = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { + inherit inputs; + firefox-addons = firefox-addons.packages.x86_64-linux; + }; + modules = [ + ./hosts/htpc + ]; + }; + }; + }; +} + diff --git a/hosts/desk/boot.nix b/hosts/desk/boot.nix new file mode 100644 index 0000000..995e793 --- /dev/null +++ b/hosts/desk/boot.nix @@ -0,0 +1,12 @@ +{ + boot.initrd.luks.devices = { + "luks-c14a978c-5752-4d1b-beb9-57fb710cd409" = { + device = "/dev/disk/by-uuid/c14a978c-5752-4d1b-beb9-57fb710cd409"; + allowDiscards = true; + keyFileSize = 4096; + keyFile = "/dev//disk/by-id/usb-Generic_Flash_Disk_C94D5655-0:0"; + fallbackToPassword = true; + preLVM = false; + }; + }; +} diff --git a/hosts/desk/default.nix b/hosts/desk/default.nix new file mode 100644 index 0000000..e0cae19 --- /dev/null +++ b/hosts/desk/default.nix @@ -0,0 +1,97 @@ +{ pkgs, inputs, config, lib, ... }: + +let + nfs_opts = [ "x-systemd.automount" "noauto" "x-systemd.idle-timeout=600" ]; + hdd_opts = [ "nosuid" "nodev" "nofail" ]; +in + +{ + + imports = + [ + ./boot.nix + ./hardware.nix + ./kvm.nix + ./desk_apps.nix + ../../modules/common/default.nix + ../../modules/common/system-d_boot.nix + ../../modules/networking/ssh.nix + ../../modules/networking/hosts.nix + ../../modules/user + ../../modules/apps/99_i3_config.nix + ../../modules/dev/docker.nix + ../../modules/dev/ruby.nix + ../../modules/misc/polkit.nix + inputs.home-manager.nixosModules.default + inputs.sops-nix.nixosModules.sops + ]; + + + config = { + user = "fred"; + host = "desk"; + sops_file = "home.yaml"; + + time.timeZone = "America/Los_Angeles"; + i18n.defaultLocale = "en_US.UTF-8"; + + environment.systemPackages = with pkgs; [ nfs-utils ddcutil input-remapper ]; + + #### NFS's ### + services.autofs = { + enable = true; + timeout = 60; + autoMaster = '' + /- /etc/autofs/auto.nfs_server --timeout=60 + ''; + }; + environment.etc."autofs/auto.nfs_server" = { + text = '' + /nfs -rw,soft,rsize=8192,wsize=8192 nfs:/nfs + /solid -rw,soft,rsize=8192,wsize=8192 nfs:/solid + /docker -rw,soft,rsize=8192,wsize=8192 nfs:/docker + ''; + mode = "0644"; + }; + + ### HDD's ### + fileSystems."/run/media/fred/2tb" = + { device = "/dev/disk/by-uuid/2967e82b-a83c-4357-9939-1fbcc2618a9a"; + fsType = "ext4"; + options = hdd_opts; + }; + + fileSystems."/run/media/fred/arch_home" = + { device = "/dev/disk/by-uuid/122e2d4f-3512-4077-a5ee-f80ac6e32300"; + fsType = "ext4"; + options = hdd_opts; + }; + fileSystems."/run/media/fred/arch_root" = + { device = "/dev/disk/by-uuid/56a64ba1-5ffa-426d-bca2-ede62c7b2498"; + fsType = "ext4"; + options = hdd_opts; + }; + + # ddcutil detect # get I2C bus # + # ddcutil capabilities --bus=7 + # ddcutil --bus=7 setvcp 60 0x0f + hardware.i2c.enable = true; + users.users.${config.user} = { + extraGroups = [ "i2c" ]; + }; + + services.tcsd.enable = false; # prevent sysinit-reactiviation.target hang when rebuilding flake + services.xserver.displayManager.lightdm.extraSeatDefaults = "display-setup-script = ${pkgs.ddcutil}/bin/ddcutil --bus=7 setvcp 60 0x0f"; + + networking.firewall.allowedUDPPorts = [ 11357 ]; # ollama-docker + networking.firewall.allowedTCPPorts = [ 11357 ]; # ollama-docker + networking.enableIPv6 = false; + security.pki.certificates = [ (builtins.readFile ../../dotfiles/certs/mfCA.crt) ]; + + hardware.bluetooth.enable = true; + hardware.bluetooth.powerOnBoot = true; + services.blueman.enable = true; + + system.stateVersion = "25.05"; + }; +} diff --git a/hosts/desk/desk_apps.nix b/hosts/desk/desk_apps.nix new file mode 100644 index 0000000..21ea2c4 --- /dev/null +++ b/hosts/desk/desk_apps.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: { + + config = { + home-manager.users.${config.user} = { pkgs, ... }: { + home.packages = with pkgs; [ + yt-dlp + freetube + ]; + }; + }; +} diff --git a/hosts/desk/hardware.nix b/hosts/desk/hardware.nix new file mode 100644 index 0000000..dd8403e --- /dev/null +++ b/hosts/desk/hardware.nix @@ -0,0 +1,47 @@ +# Do not modify this file! It was generated by β€˜nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + config = { + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "amdgpu" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/aa4561b3-a61d-4ed9-8847-b88c6fc06525"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/6FD4-7839"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [{ + device = "/var/lib/swapfile"; + size = 8*1024; + }]; + + networking.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + hardware = { + graphics = { + enable = true; + enable32Bit = true; + extraPackages = with pkgs; [ amdvlk ]; + extraPackages32 = with pkgs; [ driversi686Linux.amdvlk ]; + }; + }; + }; +} diff --git a/hosts/desk/kvm.nix b/hosts/desk/kvm.nix new file mode 100644 index 0000000..69d49b9 --- /dev/null +++ b/hosts/desk/kvm.nix @@ -0,0 +1,43 @@ +{ config, lib, pkgs, ... }: { + + environment.systemPackages = with pkgs; [ virt-manager ]; + + virtualisation.libvirtd = { + enable = true; + qemu.ovmf.enable = true; + qemu.runAsRoot = false; + onBoot = "ignore"; + onShutdown = "shutdown"; + qemu.vhostUserPackages = with pkgs; [ virtiofsd ]; + hooks.qemu."qemu-hooks" = pkgs.writeShellScript "qemu-hooks" '' + export PATH="${lib.makeBinPath [ + pkgs.bash + pkgs.xorg.xset + pkgs.coreutils + pkgs.util-linux + pkgs.i3 + pkgs.xorg.xrandr + pkgs.ddcutil + ]}:''$PATH" + ${builtins.readFile ../../dotfiles/qemu/qemu-hooks } + ''; + }; + + virtualisation.spiceUSBRedirection.enable = true; + programs.virt-manager.enable = true; + users.groups.libvirtd.members = [ "${config.user}" ]; + + boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelParams = [ "amd_iommu=on" "pcie_aspm=off" ]; + boot.kernelModules = [ "kvm-amd" ]; + + boot.initrd.availableKernelModules = [ "amdgpu" "vfio-pci" ]; + boot.initrd.preDeviceCommands = '' + DEVS="0000:06:00.0 0000:06:00.1" + for DEV in $DEVS; do + echo "vfio-pci" > /sys/bus/pci/devices/$DEV/driver_override + done + modprobe -i vfio-pci + ''; +} + diff --git a/hosts/htpc/default.nix b/hosts/htpc/default.nix new file mode 100644 index 0000000..4640904 --- /dev/null +++ b/hosts/htpc/default.nix @@ -0,0 +1 @@ +# TODO diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix new file mode 100644 index 0000000..4640904 --- /dev/null +++ b/hosts/laptop/default.nix @@ -0,0 +1 @@ +# TODO diff --git a/hosts/vm_ollama/boot.nix b/hosts/vm_ollama/boot.nix new file mode 100644 index 0000000..d39e4ca --- /dev/null +++ b/hosts/vm_ollama/boot.nix @@ -0,0 +1,4 @@ +{ + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; +} diff --git a/hosts/vm_ollama/default.nix b/hosts/vm_ollama/default.nix new file mode 100644 index 0000000..bfe929e --- /dev/null +++ b/hosts/vm_ollama/default.nix @@ -0,0 +1,28 @@ +{ pkgs, inputs, config, lib, ... }: + +{ + imports = + [ + ./boot.nix + ./hardware.nix + ./ollama.nix + ../../modules/common/default.nix + ../../modules/common/system-d_boot.nix + ../../modules/networking/ssh.nix + ../../modules/networking/hosts.nix + ../../modules/user + ../../modules/apps/00_tui_base.nix + inputs.home-manager.nixosModules.default + inputs.sops-nix.nixosModules.sops + ]; + + config = { + user = "ollama"; + host = "vm_ollama"; + sops_file = "home.yaml"; + + system.stateVersion = "25.05"; + security.pki.certificates = [ (builtins.readFile ../../dotfiles/certs/mfCA.crt) ]; + }; +} + diff --git a/hosts/vm_ollama/hardware.nix b/hosts/vm_ollama/hardware.nix new file mode 100644 index 0000000..a2060d4 --- /dev/null +++ b/hosts/vm_ollama/hardware.nix @@ -0,0 +1,38 @@ +# Do not modify this file! It was generated by β€˜nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ahci" "virtio_pci" "xhci_pci" "virtio_scsi" "sr_mod" "virtio_blk" "amdgpu" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + services.qemuGuest.enable = true; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/a1324d7d-aa2d-4fc8-9ec7-797ef1537c30"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/69C2-3355"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/hosts/vm_ollama/ollama.nix b/hosts/vm_ollama/ollama.nix new file mode 100644 index 0000000..4a581d0 --- /dev/null +++ b/hosts/vm_ollama/ollama.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: { + config = { + + fileSystems."/mnt/ollama_models" = + { device = "ollama_models"; + fsType = "virtiofs"; + options = [ "nosuid" "nodev" "nofail" ]; + }; + + hardware.enableRedistributableFirmware = true; + + environment.systemPackages = with pkgs; [ + rocmPackages_6.clr.icd + rocmPackages_6.rocminfo + rocmPackages_6.rocm-smi + rocmPackages_6.rocm-device-libs + radeontop + clinfo + amdvlk + ]; + + users.users.ollama.extraGroups = [ "render" "video" ]; + + services.ollama = { + enable = true; + acceleration = "rocm"; + host = "0.0.0.0"; + port = 11357; + openFirewall = true; + models = "/mnt/ollama_models/"; + rocmOverrideGfx = "10.3.0"; + environmentVariables = { + OLLAMA_KEEP_ALIVE="15m"; + }; + }; + + environment.variables.OLLAMA_HOST = "0.0.0.0:11357"; + }; +} diff --git a/hosts/vps_fz/boot.nix b/hosts/vps_fz/boot.nix new file mode 100644 index 0000000..9f2c8fe --- /dev/null +++ b/hosts/vps_fz/boot.nix @@ -0,0 +1,18 @@ +{ + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/vda"; + boot.loader.grub.useOSProber = false; + + boot.initrd.luks.devices."luks-c2ab1085-f8ec-49df-a26b-ece597abc3b7".device = "/dev/disk/by-uuid/c2ab1085-f8ec-49df-a26b-ece597abc3b7"; + # Setup keyfile + boot.initrd.secrets = { + "/boot/crypto_keyfile.bin" = null; + }; + + boot.loader.grub.enableCryptodisk = true; + + boot.initrd.luks.devices."luks-938c9dc1-9c55-4152-bc69-4d8770518c90".keyFile = "/boot/crypto_keyfile.bin"; + boot.initrd.luks.devices."luks-c2ab1085-f8ec-49df-a26b-ece597abc3b7".keyFile = "/boot/crypto_keyfile.bin"; +# boot.loader.systemd-boot.enable = true; +# boot.loader.efi.canTouchEfiVariables = true; +} diff --git a/hosts/vps_fz/default.nix b/hosts/vps_fz/default.nix new file mode 100644 index 0000000..69d23f7 --- /dev/null +++ b/hosts/vps_fz/default.nix @@ -0,0 +1,35 @@ +{ pkgs, inputs, config, lib, ... }: + +{ + imports = + [ + ./boot.nix + ./hardware.nix + ./server_config.nix + ../../modules/common + ../../modules/networking/ssh.nix + ../../modules/user + ../../modules/apps/00_tui_base.nix + inputs.home-manager.nixosModules.default + inputs.sops-nix.nixosModules.sops + ]; + + config = { + + ### USER ### + user = "vps_fz"; + host = "vps_fz"; + sops_file = "vps_fz.yaml"; + + + ### NETWORKING ### + networking.enableIPv6 = false; + networking.firewall = { + enable = true; + allowedTCPPorts = [ 80 443 ]; + }; + + system.stateVersion = "25.05"; + }; +} + diff --git a/hosts/vps_fz/hardware.nix b/hosts/vps_fz/hardware.nix new file mode 100644 index 0000000..1142f41 --- /dev/null +++ b/hosts/vps_fz/hardware.nix @@ -0,0 +1,35 @@ +# Do not modify this file! It was generated by β€˜nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0b1c3bc9-4332-4950-bc20-20e7eb8aa003"; + fsType = "ext4"; + }; + + boot.initrd.luks.devices."luks-938c9dc1-9c55-4152-bc69-4d8770518c90".device = "/dev/disk/by-uuid/938c9dc1-9c55-4152-bc69-4d8770518c90"; + + swapDevices = + [ { device = "/dev/disk/by-uuid/7961b651-0b10-4fbf-a429-8e53a2b67b34"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.ens3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/hosts/vps_fz/server_config.nix b/hosts/vps_fz/server_config.nix new file mode 100644 index 0000000..d6b20c0 --- /dev/null +++ b/hosts/vps_fz/server_config.nix @@ -0,0 +1,40 @@ +{ pkgs, inputs, config, lib, ... }: { + + config = { + + # fail2ban + services.fail2ban.enable = true; + services.openssh.settings.LogLevel = "VERBOSE"; + + + # caddy + services.caddy = { + enable = true; + configFile = ../../dotfiles/caddy/Caddyfile; + }; + networking.firewall.allowedTCPPorts = [ 80 443 ]; + + # gitea + sops.secrets."gitea_dbpass" = { + owner = "gitea"; + group = "gitea"; + }; + + services.gitea = { + enable = true; + database = { + type = "postgres"; + passwordFile = config.sops.secrets."gitea_dbpass".path; + }; + settings = { + server = { + DOMAIN = "gitea.fredzernia.com"; + ROOT_URL = "https://gitea.fredzernia.com"; + HTTP_PORT = 7904; + }; + service.DISABLE_REGISTRATION = true; + }; + }; + }; +} + diff --git a/modules/apps/00_tui_base.nix b/modules/apps/00_tui_base.nix new file mode 100644 index 0000000..c4a0a23 --- /dev/null +++ b/modules/apps/00_tui_base.nix @@ -0,0 +1,94 @@ +# basic tui apps and configs for headless setup +{ config, pkgs, ... }: +let + mergedBashFiles = pkgs.symlinkJoin { + name = "merged-bash-files"; + paths = [ + ../../dotfiles/bash_files/all_hosts + ../../dotfiles/bash_files/${config.host} + ]; + }; +in +{ + config = { + environment.variables = { + NIXHOST = "${config.host}"; + EDITOR = "nvim"; + BAT_THEME = "gruvbox-dark"; + }; + system.tools.nixos-option.enable = true; + + home-manager.users.${config.user} = { pkgs, ... }: { + home.packages = with pkgs; [ + bat + git + htop + nixpkgs-fmt + nodejs # astronvim ls, formatters, etc + ripgrep # text search in nvim + jq + file + wget + unzip + rclone + killall + tree + lm_sensors + autogen + ]; + + programs.neovim = { + enable = true; + vimAlias = true; + viAlias = true; + }; + + programs.tmux = { + enable = true; + plugins = with pkgs; [ + tmuxPlugins.continuum + tmuxPlugins.resurrect + tmuxPlugins.sensible + ]; + }; + xdg.configFile.nvim = { + recursive = true; + source = ../../dotfiles/nvim; + }; + + home.file = { + ".profile" = { + text = '' + source ~/.bashrc + ''; + }; + }; + home.file = { + ".bashrc" = { + text = '' + BASH_DIR=~/.bash_files + + # Check if the directory exists + if [ -d "$BASH_DIR" ]; then + # Loop through each file in the directory + for file in "$BASH_DIR"/*; do + # Check if it's a regular file (not a directory) + if [ -f "$file" ]; then + # Source the file + . "$file" + fi + done + fi + + ''; + }; + }; + home.file.".bash_files" = { + recursive = true; + source = mergedBashFiles; + }; + }; + }; +} + + diff --git a/modules/apps/01_tui_advance.nix b/modules/apps/01_tui_advance.nix new file mode 100644 index 0000000..1d1c1ff --- /dev/null +++ b/modules/apps/01_tui_advance.nix @@ -0,0 +1,17 @@ +# advanced tui apps beyond the scope of basic headless +{ config, ... }: { + + imports = [ ./00_tui_base.nix ]; + + config = { + home-manager.users.${config.user} = { pkgs, ... }: { + home.packages = with pkgs; [ + tealdeer + gocryptfs + pciutils + usbutils + ]; + }; + }; +} + diff --git a/modules/apps/02_gui_base_apps.nix b/modules/apps/02_gui_base_apps.nix new file mode 100644 index 0000000..b5b7a18 --- /dev/null +++ b/modules/apps/02_gui_base_apps.nix @@ -0,0 +1,51 @@ +# normal gui apps for any DE +{ config, pkgs, ... }: { + + imports = [ ./55_firefox.nix ./01_tui_advance.nix ]; + + config = { + environment.variables = { + GTK_THEME = "Adwaita:dark"; + QT_STYLE_OVERRIDE = "adwaita-dark"; + }; + + home-manager.users.${config.user} = { pkgs, ... }: { + home.packages = with pkgs; [ + keepassxc + solaar + obsidian + signal-desktop + discord + steam + vlc + mpv + tigervnc + deluge-gtk + libreoffice + hunspell + hunspellDicts.en_US + ungoogled-chromium + ]; + + xdg.configFile.solaar = { + recursive = true; + source = ../../dotfiles/solaar; + }; + }; + + environment.systemPackages = with pkgs; [ + input-remapper + gparted + ]; + + services.input-remapper.enable = true; + hardware.logitech.wireless.enable = true; + + fonts.packages = with pkgs; [ + nerd-fonts.droid-sans-mono + hack-font + ]; + + }; +} + diff --git a/modules/apps/55_firefox.nix b/modules/apps/55_firefox.nix new file mode 100644 index 0000000..b7997f6 --- /dev/null +++ b/modules/apps/55_firefox.nix @@ -0,0 +1,93 @@ +{ config, pkgs, firefox-addons, ... }: + +let + autoconfigCfg = pkgs.writeText "autoconfig.cfg" '' + var {classes:Cc,interfaces:Ci,utils:Cu} = Components; + /* set new tab page */ + try { + ChromeUtils.defineESModuleGetters(this, { + AboutNewTab: "resource:///modules/AboutNewTab.sys.mjs", + }); + var newTabURL = "https://mainframe.local/mainframe.html"; + AboutNewTab.newTabURL = newTabURL; + } catch(e){Cu.reportError(e);} // report errors in the Browser Console + ''; + + autoconfigJs = pkgs.writeText "autoconfig.js" '' + pref("general.config.filename", "autoconfig.cfg"); + pref("general.config.obscure_value", 0); + pref("general.config.sandbox_enabled", false); + ''; + + firefoxWithAutoconfig = pkgs.firefox.overrideAttrs (oldAttrs: { + buildCommand = oldAttrs.buildCommand + '' + # Copy autoconfig files to the Firefox installation + cp ${autoconfigJs} $out/lib/firefox/defaults/pref/autoconfig.js + cp ${autoconfigCfg} $out/lib/firefox/autoconfig.cfg + ''; + }); + +in { + config = { + home-manager.users.${config.user} = { pkgs, ... }: { + programs.firefox = { + enable = true; + package = firefoxWithAutoconfig; + profiles.default = { + settings = { + "browser.startup.homepage" = "https://mainframe.local/mainframe.html"; + "sidebar.verticalTabs" = true; + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; + "browser.contentblocking.category" = { Value = "strict"; Status = "locked"; }; + "toolkit.telemetry.server" = "127.0.0.1"; + "toolkit.telemetry.server_owner" = "localhost"; + "extensions.pocket.enabled" = false; + "extensions.screenshots.disabled" = true; + "browser.topsites.contile.enabled" = false; + "browser.formfill.enable" = false; + "browser.search.suggest.enabled" = false; + "browser.search.suggest.enabled.private" = false; + "browser.urlbar.suggest.searches" = false; + "browser.urlbar.showSearchSuggestionsFirst" = false; + "browser.newtabpage.activity-stream.feeds.section.topstories" = false; + "browser.newtabpage.activity-stream.feeds.snippets" = false; + "browser.newtabpage.activity-stream.section.highlights.includePocket" = false; + "browser.newtabpage.activity-stream.section.highlights.includeBookmarks" = false; + "browser.newtabpage.activity-stream.section.highlights.includeDownloads" = false; + "browser.newtabpage.activity-stream.section.highlights.includeVisited" = false; + "browser.newtabpage.activity-stream.showSponsored" = false; + "browser.newtabpage.activity-stream.system.showSponsored" = false; + "browser.newtabpage.activity-stream.showSponsoredTopSites" = false; + + }; + extensions.packages = with firefox-addons; [ + noscript + ublock-origin + sponsorblock + ]; + }; + policies = { + DisableTelemetry = true; + DisableFirefoxStudies = true; + EnableTrackingProtection = { + Value = true; + Locked = true; + Cryptomining = true; + Fingerprinting = true; + }; + DisablePocket = true; + DisableFirefoxAccounts = true; + DisableAccounts = true; + DisableFirefoxScreenshots = true; + OverrideFirstRunPage = ""; + OverridePostUpdatePage = ""; + DontCheckDefaultBrowser = true; + DisplayBookmarksToolbar = "never"; # alternatives: "always" or "newtab" + DisplayMenuBar = "default-off"; # alternatives: "always", "never" or "default-on" + SearchBar = "unified"; # alternative: "separate" + }; + }; + }; + }; +} + diff --git a/modules/apps/99_i3_config.nix b/modules/apps/99_i3_config.nix new file mode 100644 index 0000000..984fa3d --- /dev/null +++ b/modules/apps/99_i3_config.nix @@ -0,0 +1,119 @@ +# i3 config +{ config, pkgs, lib, ... }: { + + imports = [ ./02_gui_base_apps.nix ]; + + config = { + + users.users.${config.user} = { + extraGroups = [ "networkmanager" ]; + }; + + security.pam.services.i3lock.enable = true; + networking.networkmanager.enable = true; + home-manager.users.${config.user} = { pkgs, config, ... }: { + home.packages = with pkgs; [ + xorg.setxkbmap + xbindkeys + xdotool + networkmanagerapplet + arandr + volumeicon + xclip + feh + xorg.xev + xfce.xfce4-screenshooter + ]; + + programs.rofi = { + enable = true; + plugins = with pkgs; [ + rofi-calc + ]; + }; + + xdg.configFile.i3 = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos/dotfiles/i3"; + }; + + xdg.configFile.i3blocks = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos/dotfiles/i3blocks"; + }; + + xdg.configFile.volumeicon = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos/dotfiles/volumeicon"; + }; + + home.file.".xbindkeysrc" = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos/dotfiles/xbindkeys/xbindkeysrc"; + }; + + xdg.configFile."gtk-3.0" = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos/dotfiles/gtk-3.0"; + }; + + home.file.".xprofile" = { + source = ../../dotfiles/xprofile/xprofile; + }; + + home.file.".config/Thunar/uca.xml" = { + source = ../../dotfiles/thunar/uca.xml; + }; + + home.file.".config/xfce4/xfconf/xfce-perchannel-xml" = { + recursive = true; + source = ../../dotfiles/xfce-perchannel-xml; + }; + + home.file = { + ".Xresources" = { + text = '' + Xcursor.size: 16 + ''; + }; + }; + }; + + services = { + displayManager = { + defaultSession = "xfce+i3"; # move this to host specific config? + }; + + xserver = { + enable = true; + videoDrivers = [ "amdgpu" ]; + xkb.layout = "us"; + + desktopManager = { + xterm.enable = false; + xfce = { + enable = true; + noDesktop = true; + enableXfwm = false; + }; + }; + + windowManager = { + i3 = { + enable = true; + extraPackages = with pkgs; [ + i3status + i3lock + i3blocks + rofi + ]; + }; + }; + }; + pulseaudio.enable = false; + pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + }; + security.rtkit.enable = true; # needed for pipewire/PA + }; +} + diff --git a/modules/common/default.nix b/modules/common/default.nix new file mode 100644 index 0000000..7601069 --- /dev/null +++ b/modules/common/default.nix @@ -0,0 +1,34 @@ +{ config, pkgs, lib, ... }: { + + options = { + user = lib.mkOption { + default = "${config.user}"; + description = "user"; + }; + + host = lib.mkOption { + type = lib.types.str; + description = "host"; + }; + + sops_file = lib.mkOption { + type = lib.types.str; + description = "SOPS filename"; + }; + }; + + config = { + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nixpkgs.config.allowUnfree = true; + home-manager.useGlobalPkgs = true; + services.cron.enable = true; + + # sops + environment.systemPackages = with pkgs; [ sops ]; + sops.age.keyFile = "${config.users.users.${config.user}.home}/.config/sops/age/keys.txt"; + sops.defaultSopsFile = ../../secrets/${config.sops_file}; + + }; +} + diff --git a/modules/common/system-d_boot.nix b/modules/common/system-d_boot.nix new file mode 100644 index 0000000..5bf3682 --- /dev/null +++ b/modules/common/system-d_boot.nix @@ -0,0 +1,5 @@ +{ + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; +} + diff --git a/modules/dev/docker.nix b/modules/dev/docker.nix new file mode 100644 index 0000000..f237550 --- /dev/null +++ b/modules/dev/docker.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: { + + config = { + + home-manager.users.${config.user} = { pkgs, ... }: { + home.packages = with pkgs; [ + docker-compose + ctop + ]; + }; + users.extraUsers.${config.user}.extraGroups = [ "docker" ]; + virtualisation.docker = { + enable = true; + rootless = { + #enable = false; + enable = true; + setSocketVariable = true; + }; + }; + }; +} diff --git a/modules/dev/ruby.nix b/modules/dev/ruby.nix new file mode 100644 index 0000000..a94d9d0 --- /dev/null +++ b/modules/dev/ruby.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: { + + config = { + + home-manager.users.${config.user} = { pkgs, ... }: { + home.packages = with pkgs; [ + ruby_3_4 + #bundler + ]; + }; + environment.variables = { + RUBY_VERSION = "3.4"; + }; + }; +} diff --git a/modules/misc/polkit.nix b/modules/misc/polkit.nix new file mode 100644 index 0000000..627d106 --- /dev/null +++ b/modules/misc/polkit.nix @@ -0,0 +1,16 @@ +{ config, ... }: +{ + security.polkit.enable = true; + security.polkit.extraConfig = '' + polkit.addRule(function(action, subject) { + if ((action.id == "org.xfce.thunar" || + action.id == "org.freedesktop.policykit.exec" || + action.id == "org.gnome.gparted" || + action.id == "org.freedesktop.udisks2.filesystem-mount-system") && + subject.isInGroup("wheel")) + { + return polkit.Result.YES; + } + }); + ''; +} diff --git a/modules/networking/ssh.nix b/modules/networking/ssh.nix new file mode 100644 index 0000000..cd3f10b --- /dev/null +++ b/modules/networking/ssh.nix @@ -0,0 +1,28 @@ +{ config, lib, ... }: +{ + config = { + services.openssh = { + enable = true; + ports = [ 1876 ]; + settings = { + PasswordAuthentication = false; + PermitRootLogin = "no"; + }; + }; + + sops.secrets."ssh_pubkeys" = { + path = "/home/${config.user}/.ssh/authorized_keys"; + owner = "${config.user}"; + group = "users"; + mode = "0600"; + }; + + home-manager.users.${config.user} = { pkgs, config, ... }: { + home.file.".ssh/config" = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/nixos/dotfiles/ssh/${config.home.username}"; + }; + }; + }; + +} + diff --git a/modules/user/default.nix b/modules/user/default.nix new file mode 100644 index 0000000..ebebc5c --- /dev/null +++ b/modules/user/default.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: { + config = { + home-manager.users.${config.user} = { pkgs, ... }: { + home.stateVersion = "25.05"; + }; + + users.users.${config.user} = { + isNormalUser = true; + description = "${config.user}"; + extraGroups = [ "wheel" ]; + }; + + }; +} + diff --git a/secrets/home.yaml b/secrets/home.yaml new file mode 100644 index 0000000..217f9f9 --- /dev/null +++ b/secrets/home.yaml @@ -0,0 +1,25 @@ +ssh_pubkeys: ENC[AES256_GCM,data:nw/z2/N5NH2qHw5uBod388wxWBu4Xr8ntaOyDQxsktlL4liNtDlb9DtW2E8GNqxuqp8KvI4bkrfZSRW1pqL6uNwp136kpLow3x6qH4EOJMqMnuSyLvM3xW7C367v//w2xRse++iwxe9d9nFPpvN+BGyir4JgRoWPeJk65bvA82IZr5BQYU7icKSPxrvBTO0EJk3A2Te1U9K9AZ3/geulQgBWr6XTXa6DIh2dRlG0bsH9WvrG9z60WAUpC27wqVg2KZymkDHeBppszCkkYQwsmdQU2zokjlHB15iEf9Y4OWQROUYMkwjUsy7SOm/9GabOtun2lgnxTzIAqH7S81pymMvPgqlxXi9zoozWO2RE25ypczTLW4HE6OKTnRbJvaPT,iv:o4g6VBjgXVfYdmqihqiVcqcZwAnswN9tVgkwm51ksIY=,tag:LxV9Nc/J7W+TA/kFMWKzOA==,type:str] +sops: + age: + - recipient: age1e5f5y457qf8v47f8zef0xk60hvxnljkun00em9f24m2r74lfgumsf89lm8 + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAzbzlyTmpvU09IZUwvMVNp + NlgzQlRsWk9QbnU5djgyUGxjS3JBeDh1aWdZCjBjeUE2Nnl1aDlPeFEvaFhsTHRF + K0dRZTVBV3c1aXoxbitwaG1hWE1pM3cKLS0tIDZ4Y1RwM1VSQ3lpdVN5Y0YwUVc2 + NHpXTGx5NThKZjdWU2c5QWYrelZidjQKxoY2YwzxcJKUR+1MViB6xzrrbUrZKWbF + k7d0DQfC070T5Qja4l4EaZprYYVY28eXMBtZdkf/dLn463qk5AS+Vw== + -----END AGE ENCRYPTED FILE----- + - recipient: age1wssgsgxq52nwx9wely9xlzf4g0dplpe04gfrwxz6rxdjn9lyzq8sxfzt3r + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBnUVRSdFBUMnJnSytXK2Rt + RHpQWVVCK2k0dE5xejU1TUQrYWExUTJnckV3Ckl3UlorYmE5d0lRNUpjVE9XbnJu + UWFXbFViNDlDV0RPVmQrTzkyZGR6OFEKLS0tIE1lQmVjTWdDRTZsOVJUalJQYzMy + cE5VcS85SzB4K3RKVDFKVEhZR2tPYUkKZ1Lj92EQ6kgoNJQvpTDLoKdufzWqCDZp + WGtSglrYX4D/z/M0p2U+JJOfPQqsjo9KYWfxMmv4mNztOnKW1iG0xg== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2025-06-11T18:49:56Z" + mac: ENC[AES256_GCM,data:kbrjaEdFa5WJG72pFx6cBO/nkzqyxp2yVzH/liShU7FBcD1KgLu003gmVVdS8zZEUyE0GffZMsfp+zOy+vQt04rDm1Awa+dSAGyqXK+vWvphCcqFGgMy6I64D25NBKkpRM1lWGZ3vXOd+OO6B98Wh+zV2JY9KuO+Kf4pYcfu/I8=,iv:wIHAii+nQdaD/mVKq8cAg6HRdxPhA5LsJ8+YRX4jvn8=,tag:KMOBLAO49bBMqbBly97x/A==,type:str] + unencrypted_suffix: _unencrypted + version: 3.10.2 diff --git a/secrets/vps_fz.yaml b/secrets/vps_fz.yaml new file mode 100644 index 0000000..392b260 --- /dev/null +++ b/secrets/vps_fz.yaml @@ -0,0 +1,17 @@ +gitea_dbpass: ENC[AES256_GCM,data:fCr60VtS0NaLaZb0baj5aS7ZFqAgcoCK0/QaCuI6,iv:JK3NmhXptiGGEydC6G8gKcHWKphTIQe29Ljfxgd3gC0=,tag:UzVLAz8n/H37LBjL3nYcaw==,type:str] +ssh_pubkeys: ENC[AES256_GCM,data:+zh43NXbTTaHuhk9CkK3vHXc3yJabxGU9gKs3LXWIqO91oeO4jNRYJzjKtp9pFCz9tUzIwMEurNexA2Xf6lC+D58LbVbC+zqZTH4OEa4eolmYn+LtkU=,iv:J4kHaO5fyIKvydFYrkfSQblDJqdMO4y3h27dRsvt1wk=,tag:me8BuYv/os31f7Yfw62/tQ==,type:str] +sops: + age: + - recipient: age10my3wq83rrm6eqn3t37nxfjhzg5rpqr56laze6uf5zqqdwvwcylsafsuer + enc: | + -----BEGIN AGE ENCRYPTED FILE----- + YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBQVVY2Ky9OTTZCdU01MjhE + UUxYM3h1TUtNU0hNd0MzSlNYM1VBbXBCcjBzCkQzK2RuYXNzTHh4dEZ5MHEzL3Bm + YTZKQ1lnbjJOU2h6K1A4aXkzbUcyTUkKLS0tIEFRd3ZXLzdZTWZMRFJ1ajZvR3lB + R0Z0d1Q5WmlMais5S3REWUg5TlAxeEUKuuzMJrqqCd4yTC13969FCtT9bgl9Xtqe + hF/omw/YfEqRDfLmDxXrQnVwir+Az8n37qhrS67CqSLdHqALQlRLMA== + -----END AGE ENCRYPTED FILE----- + lastmodified: "2025-06-11T22:27:06Z" + mac: ENC[AES256_GCM,data:5jgaAWW7NeuJGujWBvPxFqtweYOyq3PnhxLa/8KkKsMSWqN6r9zEskR8yFsnWs67HTlqn0gH2h0LZHxXUF587p7dDNLFopCI6j/MNkYLAPENuG7cU17Wl/ygbtM/3MIH/Dhvqt4Ldr9cbDnlZdF50Zug9mD24vfXWqgy1uJvzvA=,iv:qnJTuZtLZAH6TzgpLxvLnmPv8m7lQat974IU8GbWos8=,tag:TAvdhmC9vK7O+1PpqqTvSQ==,type:str] + unencrypted_suffix: _unencrypted + version: 3.10.2