feat: initialize repo with NixOS and Home Manager configs

- Add .gitignore for common languages, tools, and OS/editor artifacts
- Configure .gitattributes for Git LFS (fonts, images, archives, ISOs)
- Add README with repo description
- Add flake.nix defining inputs and outputs for NixOS, Home Manager, and related modules
- Introduce home-manager configs:
  - Base home.nix with packages, services, and programs
  - Hyprland WM configuration (waybar, fuzzel, keybindings, theming)
  - Vim (nixvim) setup with LSP and plugins
  - Zsh setup with aliases, Oh My Zsh, clipboard helpers
  - Systemd user services (e.g., librespot)
- Add scripts (GPU monitor, RAM build helper, install automation)
- Add host configurations:
  - Nixbook (Apple laptop) with hardware, disko, and install script
  - Nixstation (desktop) with firewall, virtualization, Btrfs scrub timer
  - Nixtest (test VM) with QEMU + Alpine-based install test harness
  - Common modules (network, NVIDIA, rclone, screen, keychron, users)
- Include statix config for linting
This commit is contained in:
Thiago Sposito 2025-08-20 21:55:46 -03:00 committed by Thiago Sposito
commit d0b63ce601
Signed by: thiago
GPG key ID: 3065EA73A976D430
34 changed files with 1954 additions and 0 deletions

149
home-manager/home.nix Normal file
View file

@ -0,0 +1,149 @@
{ config
, inputs
, lib
, pkgs
, ...
}:
{
imports = [
./hyprland
./vim.nix
./zsh.nix
];
nixpkgs = {
config = {
allowUnfree = true;
config.permittedInsecurePackages = [
"libsoup-2.74.3"
];
# Workaround for https://github.com/nix-community/home-manager/issues/2942
# nixpkgs.config.allowUnfreePredicate =
# pkg:
# builtins.elem (lib.getName pkg) [
# "steam"
# "steam-original"
# "steam-run"
# "steamtinkerlaunch"
# ];
};
};
home = {
homeDirectory = "/home/thiago";
packages = with pkgs; [
bambu-studio
direnv
fira-code
firefox
heroic
hwinfo
hydralauncher
inkscape
keymapp
lazygit
libinput
librespot
luarocks
nil
nixpkgs-fmt
nordic
obsidian
python3
python3Packages.pip
rclone
ripgrep
shfmt
statix
stylua
sysbench
transmission_4
uget
unzip
];
username = "thiago";
};
programs = {
git = {
aliases = {
br = "branch";
ca = "commit --amend";
can = "commit --amend --no-edit";
ci = "commit";
co = "checkout";
lg = "log --oneline --graph --decorate --all";
st = "status";
};
enable = true;
extraConfig = {
color.ui = "auto";
core = {
editor = "nvim";
autocrlf = "input";
};
init.defaultBranch = "main";
pull.rebase = true;
};
lfs.enable = true;
signing = {
key = "3065EA73A976D430";
signByDefault = true;
};
userEmail = "th.spo@pm.me";
userName = "Thiago Sposito";
};
home-manager.enable = true;
kitty = {
enable = true;
keybindings = {
"ctrl+alt+left" = "resize_window narrower";
"ctrl+alt+right" = "resize_window wider";
"ctrl+alt+up" = "resize_window taller";
"ctrl+alt+down" = "resize_window shorter";
};
settings = {
hide_window_decorations = "titlebar-only";
font_size = 16;
font = "ComicShannsMono Nerd Font Mono";
inactive_text_alpha = "0.6";
background_blur = 16;
background_opacity = 0.0;
};
themeFile = "Nord";
};
vscode = {
enable = true;
};
};
systemd.user.services.librespot-connect = {
Unit = {
Description = "Librespot (Spotify Connect) bound to LAN interface";
After = [ "network.target" ];
};
Service = {
ExecStart = "${pkgs.librespot}/bin/librespot \
--name LS-TEST \
--backend pulseaudio \
--device default \
--bitrate 320 \
--disable-audio-cache \
--enable-volume-normalisation \
--initial-volume 75 \
--zeroconf-port 17005";
Restart = "on-failure";
BindToDevice = "wlp7s0"; # Force binding to LAN interface
};
Install = {
WantedBy = [ "default.target" ];
};
};
systemd.user.startServices = "sd-switch";
home.stateVersion = "24.05";
}

View file

@ -0,0 +1,48 @@
[main]
font=JetBrainsMono Nerd Font:size=12
icon-theme=Papirus
icon-size=16
layer=overlay
anchor=top
margin-top=10
margin-left=10
margin-right=10
width=40
height=30
background-color=#2e3440
text-color=#eceff4
selection-color=#5e81ac
selection-text-color=#eceff4
border-width=1
border-color=#4c566a
corner-radius=8
padding-left=12
padding-right=12
padding-top=8
padding-bottom=8
horizontal-pad=8
vertical-pad=4
dpi-aware=yes
prompt-text=>
log-level=warning
log-no-syslog=yes
log-file=
[keybindings]
scroll-up=ctrl+k,Up,scroll-0
scroll-down=ctrl+j,Down,scroll-1
page-up=Page_Up,scroll-page-0
page-down=Page_Down,scroll-page-1
beginning-of-list=Home
end-of-list=End
cancel=ctrl+g,Escape
select=Return,KP_Enter
select-1=1
select-2=2
select-3=3
select-4=4
select-5=5
select-6=6
select-7=7
select-8=8
select-9=9

View file

@ -0,0 +1,194 @@
_: {
home.sessionVariables = {
fileManager = "thunar";
menu = "fuzzel --show drun";
run = "fuzzel --show run";
file = "fuzzel --show file";
};
programs = {
waybar = {
enable = true;
systemd.enable = true;
};
};
home.file = {
".config/fuzzel/fuzzel.ini".text = builtins.readFile ./config/fuzzel.ini;
".config/waybar/config".text = builtins.readFile ./config/waybar_config.json;
".config/waybar/style.css".text = builtins.readFile ./config/waybar_style.css;
};
wayland.windowManager.hyprland = {
enable = true;
settings = {
"$mod" = "SUPER";
layerrule = "ignorezero, waybar";
bind = [
"$mod, q, exec, kitty"
"$mod, c, killactive,"
"$mod, m, exit,"
"$mod, e, exec, $fileManager"
"$mod, v, togglefloating"
"$mod, r, exec, $menu"
"$mod, p, pseudo,"
"$mod, j, togglesplit,"
"$mod, d, exec, $run"
"$mod, f, exec, $file"
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
"$mod SHIFT, 1, movetoworkspace, 1"
"$mod SHIFT, 2, movetoworkspace, 2"
"$mod SHIFT, 3, movetoworkspace, 3"
"$mod SHIFT, 4, movetoworkspace, 4"
"$mod SHIFT, 5, movetoworkspace, 5"
"$mod SHIFT, 6, movetoworkspace, 6"
"$mod SHIFT, 7, movetoworkspace, 7"
"$mod SHIFT, 8, movetoworkspace, 8"
"$mod SHIFT, 9, movetoworkspace, 9"
"$mod SHIFT, 0, movetoworkspace, 10"
"$mod, S, togglespecialworkspace, magic"
"$mod SHIFT, S, movetoworkspace, special:magic"
"$mod, mouse_down, workspace, e+1"
"$mod, mouse_up, workspace, e-1"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
];
bindel = [
",XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
",XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
",XF86MonBrightnessUp, exec, brightnessctl s 10%+"
",XF86MonBrightnessDown, exec, brightnessctl s 10%-"
];
bindl = [
", XF86AudioNext, exec, playerctl next"
", XF86AudioPause, exec, playerctl play-pause"
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioPrev, exec, playerctl previous"
];
env = [
"XCURSOR_SIZE,24"
"HYPRCURSOR_SIZE,24"
];
monitor = [
",preferred,auto,auto"
"HDMI-A-2,1920x1080@50,0x0,1"
"eDP-1,2560x1600@60,1920x0,2"
];
general = {
gaps_in = 2;
gaps_out = 3;
border_size = 1;
resize_on_border = true;
allow_tearing = false;
layout = "dwindle";
};
decoration = {
rounding = 2;
active_opacity = 1.0;
inactive_opacity = 0.9;
shadow = {
enabled = true;
range = 4;
render_power = 3;
color = "rgba(1a1a1aee)";
};
blur = {
enabled = true;
size = 17;
passes = 1;
vibrancy = 0.1696;
};
};
animations = {
enabled = "yes, please :)";
bezier = [
"easeOutQuint,0.23,1,0.32,1"
"easeInOutCubic,0.65,0.05,0.36,1"
"linear,0,0,1,1"
"almostLinear,0.5,0.5,0.75,1.0"
"quick,0.15,0,0.1,1"
];
animation = [
"global, 1, 10, default"
"border, 1, 5.39, easeOutQuint"
"windows, 1, 4.79, easeOutQuint"
"windowsIn, 1, 4.1, easeOutQuint, popin 87%"
"windowsOut, 1, 1.49, linear, popin 87%"
"fadeIn, 1, 1.73, almostLinear"
"fadeOut, 1, 1.46, almostLinear"
"fade, 1, 3.03, quick"
"layers, 1, 3.81, easeOutQuint"
"layersIn, 1, 4, easeOutQuint, fade"
"layersOut, 1, 1.5, linear, fade"
"fadeLayersIn, 1, 1.79, almostLinear"
"fadeLayersOut, 1, 1.39, almostLinear"
"workspaces, 1, 1.94, almostLinear, fade"
"workspacesIn, 1, 1.21, almostLinear, fade"
"workspacesOut, 1, 1.94, almostLinear, fade"
];
};
dwindle = {
pseudotile = true;
preserve_split = true;
};
master = {
new_status = "master";
};
misc = {
force_default_wallpaper = -1;
disable_hyprland_logo = true;
vfr = true;
vrr = 0;
};
input = {
kb_layout = "us";
follow_mouse = 1;
sensitivity = -0.1;
touchpad = {
"tap-to-click" = true;
"tap-and-drag" = true;
"natural_scroll" = true;
"middle_button_emulation" = true;
"clickfinger_behavior" = true;
"tap_button_map" = "lmr";
};
};
gestures = {
workspace_swipe = true;
};
device = {
name = "epic-mouse-v1";
sensitivity = -0.5;
};
};
};
}

37
home-manager/scripts/lsgpu.sh Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env bash
########################################################################
# 🄯 2025 Thiago Sposito — All rights reversed #
# This script is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License v3.0. #
# See https://www.gnu.org/licenses/gpl-3.0.html for full details. #
########################################################################
clear
if ! command -v nvidia-smi >/dev/null 2>&1; then
echo "non compatible gpu"
exit 1
fi
tput civis
stty -echo -icanon time 0 min 0
trap 'stty sane; tput cnorm; exit' INT TERM EXIT
while true; do
nvidia-smi \
--query-gpu=index,name,temperature.gpu,memory.used,memory.total,utilization.gpu \
--format=csv,noheader,nounits |
awk -F", " '{printf "GPU %s (%s): Temp: %s°C | Mem: %s/%s MiB | Util: %s%%\033[K\n", $1, $2, $3, $4, $5, $6}'
echo
read -n 1 -t 1 first
read -n 1 -t 0.1 second
key="${first}${second}"
if [[ "$key" == "q" || "$key" == ":q" ]]; then
break
fi
echo -en "\033[${LINES}A"
done

View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e
RAMDISK_PATH="/mnt/ramdisk"
SIZE="16G"
FLAKE_NAME=".#thiago@Nixstation"
echo "[+] Creating RAM disk at $RAMDISK_PATH ($SIZE)"
sudo mkdir -p "$RAMDISK_PATH"
sudo mount -t tmpfs -o size=$SIZE tmpfs "$RAMDISK_PATH"
echo "[+] Running home-manager switch with TMPDIR=$RAMDISK_PATH"
TMPDIR="$RAMDISK_PATH" home-manager switch --flake "$FLAKE_NAME"
echo "[+] Cleaning up RAM disk"
sudo umount "$RAMDISK_PATH"

99
home-manager/vim.nix Normal file
View file

@ -0,0 +1,99 @@
{ pkgs, inputs, ... }:
{
imports = [
inputs.nixvim.homeManagerModules.nixvim
];
home.packages = with pkgs; [
ripgrep
];
programs.nixvim = {
enable = true;
colorschemes.nord.enable = true;
opts = {
clipboard = "unnamedplus";
number = true;
relativenumber = true;
shiftwidth = 2;
tabstop = 2;
expandtab = true;
smartindent = true;
};
plugins = {
lsp.enable = true;
lsp.servers = {
lua_ls.enable = true;
rust_analyzer = {
enable = true;
installRustc = true;
installCargo = true;
};
pyright.enable = true;
clangd.enable = true;
zls.enable = true;
nixd.enable = true;
};
cmp.enable = true;
cmp-nvim-lsp.enable = true;
cmp-buffer.enable = true;
cmp-path.enable = true;
lspkind.enable = true;
lsp-lines.enable = true;
none-ls = {
enable = true;
sources = {
formatting = {
stylua.enable = true;
shfmt.enable = true;
};
diagnostics = {
# luacheck.enable = true;
};
code_actions = {
statix.enable = true;
};
};
};
conform-nvim.enable = true;
};
extraConfigLua = ''
local cmp = require'cmp'
cmp.setup({
mapping = {
['<C-Space>'] = cmp.mapping.complete(), -- trigger manually
['<CR>'] = cmp.mapping.confirm({ select = true }), -- confirm with Enter
['<Tab>'] = cmp.mapping.select_next_item(),
['<S-Tab>'] = cmp.mapping.select_prev_item(),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'buffer' },
{ name = 'path' },
},
vim.api.nvim_create_autocmd("LspAttach", {
callback = function(args)
local buf = args.buf
local opts = { buffer = buf }
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
vim.keymap.set("n", "<leader>ca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>f", function() vim.lsp.buf.format({ async = true }) end, opts)
vim.keymap.set("n", "<A-j>", ":m .+1<CR>==")
vim.keymap.set("n", "<A-k>", ":m .-2<CR>==")
end
})
})
'';
};
}

63
home-manager/zsh.nix Normal file
View file

@ -0,0 +1,63 @@
{ config
, lib
, pkgs
, ...
}:
let
isWayland = config.custom.sessionType == "wayland";
in
{
options.custom.sessionType = lib.mkOption {
type = lib.types.str;
default = "x11";
description = "The X session type: 'wayland' or 'x11'";
};
config = {
home.file."scripts/lsgpu.sh" = {
source = ./scripts/lsgpu.sh;
executable = true;
};
programs.zsh = {
enable = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
initContent = ''
eval "$(direnv hook zsh)"
export GPG_TTY=$(tty)
'';
shellAliases = lib.mkMerge [
{
"vi" = "nvim";
"vim" = "nvim";
"ll" = "ls -l";
"lsgpu" = "$HOME/scripts/lsgpu.sh";
"gedit" = "gnome-text-editor";
}
(lib.mkIf isWayland {
"pbcopy" = "wl-copy";
"pbpaste" = "wl-paste";
})
(lib.mkIf (!isWayland) {
"pbcopy" = "xclip -selection clipboard -i";
"pbpaste" = "xclip -selection clipboard -o";
})
];
oh-my-zsh = {
enable = true;
theme = "bureau";
plugins = [
"git"
"history"
];
};
};
home.packages = with pkgs; [ xclip ];
};
}