nixos/frame12/modules/home-manager/home.nix

381 lines
12 KiB
Nix

{ inputs, config, pkgs, lib, ... }:
let
userName = "nate";
fullName = "Nate Anderson";
email = "n8r@tuta.io";
unstable = import inputs.nixpkgs-unstable { system = "x86_64-linux"; config.allowUnfree = true; };
in
{
imports = [
../../../shared/modules/apps/firefox/firefox.nix
../../../shared/modules/apps/ghostty.nix
../../../shared/modules/apps/helix.nix
../../../shared/modules/home-manager/git-autosync.nix
../../../shared/modules/home-manager/noctalia.nix
../../../shared/modules/home-manager/style-preview.nix
../niri/niri_home.nix
./programs.nix
];
home.username = userName;
home.homeDirectory = "/home/${userName}";
programs.home-manager.enable = true;
home.stateVersion = "25.05"; # Please read the comment before changing.
firefoxApp.enable = true;
ghosttyApp.enable = true;
helixApp.enable = true;
stylePreview.enable = true;
fonts.fontconfig.enable = true;
# OpenCode with Stylix theming (using unstable package)
programs.opencode = {
enable = true;
package = unstable.opencode;
};
# Stylix auto-theming - applies to all programs.<name>.enable apps
stylix.autoEnable = true;
# Enable niri home configuration
nirihome = {
enable = true;
homePackages = [ ];
};
# Enable Noctalia shell (replaces Waybar, SwayNC, SwayOSD, wlsunset)
noctaliaShell = {
enable = true;
barPosition = "top";
darkMode = true;
colorScheme = "Noctalia (default)"; # Or try "Monochrome" to complement woodland theme
locationName = "Denver";
avatarImage = "/home/${userName}/.face";
};
# Additional user packages
# Note: Programs with Stylix theming are in programs.nix
home.packages = with pkgs; [
#
# Dev Tools
#
jq
python3
unstable.claude-code
nodejs_24
docker-compose
### LSP's
nil
nodePackages_latest.bash-language-server
openscad-lsp
vscode-langservers-extracted # provides eslint, markdown, json, css, and html lsp
python313Packages.python-lsp-server
### Misc
usbutils
fw-ectool # framework ectool for key remapping
# Colemak-DH EC remap scripts
# Positions verified through testing on Framework 12
# Format: ectool raw 0x3E0C d1,d1,bROW,bCOL,wSCANCODE
(writeShellScriptBin "colemak-dh" ''
# Apply Colemak-DH layout via EC
# Scancodes: a=1c b=32 c=21 d=23 e=24 f=2b g=34 h=33 i=43 j=3b k=42 l=4b
# m=3a n=31 o=44 p=4d q=15 r=2d s=1b t=2c u=3c v=2a w=1d x=22
# y=35 z=1a ;=4c
# Matrix positions verified via FRAME12_KEY_MATRIX.md scan
# Check if already remapped by reading position (7,8) - should be 0x2b (f) if remapped
CURRENT=$(sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d0,b7,b8,w0 2>/dev/null | grep '|' | head -1 | awk '{print $11}')
if [ "$CURRENT" = "2b" ]; then
echo "Colemak-DH already active, skipping."
exit 0
fi
echo "Applying Colemak-DH layout..."
# Top row remaps (QWERTY Colemak-DH)
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b8,w2b # e(7,8) f
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b9,w4d # r(7,9) p
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b2,b3,w32 # t(2,3) b
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b2,b6,w3b # y(2,6) j
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b1,w4b # u(7,1) l
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b2,w3c # i(7,2) u
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b3,w35 # o(7,3) y
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b4,w4c # p(7,4) ;
# Home row remaps (QWERTY Colemak-DH)
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b3,b4,w2d # s(3,4) r
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b2,w1b # d(4,2) s
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b3,w2c # f(4,3) t
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b1,b6,w3a # h(1,6) m
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b6,w31 # j(4,6) n
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b5,w24 # k(4,5) e
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b9,w43 # l(4,9) i
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b8,w44 # ;(4,8) o
# Bottom row with angle mod (QWERTY Colemak-DH)
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b6,b1,w22 # z(6,1) x
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b5,b8,w21 # x(5,8) c
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b5,b5,w23 # c(5,5) d
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b0,b3,w1a # b(0,3) z
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b0,b5,w42 # n(0,5) k
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b5,bb,w33 # m(5,b) h
echo "Colemak-DH layout applied."
'')
(writeShellScriptBin "qwerty" ''
# Restore QWERTY layout via EC
# Uses same positions as colemak-dh but restores original scancodes
# Scancodes: a=1c b=32 c=21 d=23 e=24 f=2b g=34 h=33 i=43 j=3b k=42 l=4b
# m=3a n=31 o=44 p=4d q=15 r=2d s=1b t=2c u=3c v=2a w=1d x=22
# y=35 z=1a ;=4c
# Matrix positions verified via FRAME12_KEY_MATRIX.md scan
# Check if already QWERTY by reading position (7,8) - should be 0x24 (e) if QWERTY
CURRENT=$(sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d0,b7,b8,w0 2>/dev/null | grep '|' | head -1 | awk '{print $11}')
if [ "$CURRENT" = "24" ]; then
echo "QWERTY already active, skipping."
exit 0
fi
echo "Restoring QWERTY layout..."
# Top row - restore original scancodes
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b8,w24 # e(7,8) e
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b9,w2d # r(7,9) r
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b2,b3,w2c # t(2,3) t
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b2,b6,w35 # y(2,6) y
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b1,w3c # u(7,1) u
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b2,w43 # i(7,2) i
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b3,w44 # o(7,3) o
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b7,b4,w4d # p(7,4) p
# Home row - restore original scancodes
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b3,b4,w1b # s(3,4) s
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b2,w23 # d(4,2) d
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b3,w2b # f(4,3) f
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b1,b6,w33 # h(1,6) h
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b6,w3b # j(4,6) j
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b5,w42 # k(4,5) k
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b9,w4b # l(4,9) l
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b4,b8,w4c # ;(4,8) ;
# Bottom row - restore original scancodes
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b6,b1,w1a # z(6,1) z
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b5,b8,w22 # x(5,8) x
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b5,b5,w21 # c(5,5) c
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b0,b3,w32 # b(0,3) b
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b0,b5,w31 # n(0,5) n
sudo ${fw-ectool}/bin/ectool raw 0x3E0C d1,d1,b5,bb,w3a # m(5,b) m
echo "QWERTY layout restored."
'')
#
# Unix tools
#
duf
dust
fd
lsd
ripgrep
tre-command
gtop
htop # kept alongside btop in programs.nix
neofetch
unzip
nmap
gnupg
pinentry-tty
#
# Photo / Video
#
imv
ffmpeg
yt-dlp
#
# Other
#
keepassxc
yubioath-flutter
#
# Style
#
libsForQt5.qtstyleplugin-kvantum
libsForQt5.qt5ct
# Additional fonts (main fonts managed by Stylix)
unstable.nerd-fonts.hurmit
unstable.nerd-fonts.overpass
recursive
];
#
# Dotfiles
#
# Static symlinks
home.file = lib.mkMerge [
# Shared dotfiles
(let
sharedDotfilesPath = ../../../shared/dotfiles;
in
if builtins.pathExists sharedDotfilesPath then
builtins.listToAttrs (map (name: {
name = "${config.xdg.configHome}/${name}";
value = { source = lib.mkDefault (sharedDotfilesPath + "/${name}"); };
}) (builtins.attrNames (builtins.readDir sharedDotfilesPath)))
else {})
# Add local dotfiles, overriding from local over shared
(let
localDotfilesPath = ../../dotfiles;
in
if builtins.pathExists localDotfilesPath && builtins.readDir localDotfilesPath != {} then
builtins.listToAttrs (map (name: {
name = "${config.xdg.configHome}/${name}";
value = { source = localDotfilesPath + "/${name}"; };
}) (builtins.attrNames (builtins.readDir localDotfilesPath)))
else {})
];
# Active symlinks
xdg.configFile = {
# Active linked dotfiles
"niri".source = config.lib.file.mkOutOfStoreSymlink "/home/nate/nixos/frame12/linked-dotfiles/niri";
};
# Override Flatpak Steam to disable GPU acceleration (fixes black window on Niri)
xdg.desktopEntries."com.valvesoftware.Steam" = {
name = "Steam";
exec = "flatpak run com.valvesoftware.Steam -cef-disable-gpu %U";
icon = "steam";
terminal = false;
categories = [ "Game" ];
mimeType = [ "x-scheme-handler/steam" "x-scheme-handler/steamlink" ];
};
home.sessionVariables = {
EDITOR = "hx";
# For electron apps
NIXOS_OZONE_WL = "1";
};
# Git setup
programs.git = {
enable = true;
settings = {
user.name = fullName;
user.email = email;
init = { defaultBranch = "main"; };
pull = { ff = "only"; };
merge = { conflictStyle="zdiff3"; };
push = { autoSetupRemote="true"; };
};
};
programs = {
direnv = {
enable = true;
enableZshIntegration = true; # see note on other shells below
nix-direnv.enable = true;
};
bash.enable = true; # see note on other shells below
delta = {
enable = true;
enableGitIntegration = true;
};
};
# enable saving ssh secrets (needed for go mod installing private packages)
services.gnome-keyring.enable = true;
services.gnome-keyring.components = [ "ssh" "secrets" ];
# Zsh setup
programs.zsh = {
enable = true;
oh-my-zsh = {
enable = true;
plugins = [ "git" ];
theme = "half-life";
};
initContent = ''
# History
HISTSIZE=10000
SAVEHIST=10000
setopt SHARE_HISTORY
setopt APPEND_HISTORY
# integrate ssh-agent from gnome keyring
export SSH_AUTH_SOCK=/run/user/$UID/gcr/ssh
eval "$(direnv hook zsh)"
yt-audio() {
nix-shell -p yt-dlp --run "yt-dlp -x $1 --audio-format mp3"
}
# Better Unix Aliases
alias ls="lsd"
alias l="lsd --almost-all --long"
alias llm="lsd --timesort --long"
alias lS="lsd --oneline --classic"
alias lt="lsd --tree --depth=2"
alias grep="rg"
alias cat="bat --paging=never"
alias rm="rm -i"
'';
profileExtra = ''
export XDG_DATA_DIRS=$XDG_DATA_DIRS:/usr/share:/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share
'';
syntaxHighlighting = {
enable = true;
};
};
# Stylix handles Qt and GTK theming
# Noctalia has built-in night light, so wlsunset is disabled via noctalia module
# services.wlsunset = {
# enable = true;
# sunrise = "07:00";
# sunset = "17:00";
# temperature.night = 3500;
# };
services.kdeconnect = {
enable = true;
indicator = true;
};
# Enable bluetooth headphone controls
services.mpris-proxy.enable = true;
# Noctalia replaces SwayOSD and SwayNC - disabled via noctalia module
# services.swayosd = {
# enable = true;
# topMargin = 0.9;
# };
# services.swaync = {
# enable = true;
# settings = {
# positionX = "center";
# positionY = "top";
# notification-window-width = 800;
# };
# };
# Git autosync for star-command
services.git-autosync = {
enable = true;
repos.star-command = {
path = "/home/${userName}/source/star-command";
gitName = fullName;
gitEmail = email;
};
};
}