WIP: home-manager modules and install tooling (in progress, unreviewed)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J1cugeLkfFLZMpiztQ8TyN
This commit is contained in:
Claude committed 2026-10-11 12:39:07 +00:00
1 parent 0ce9943d56
commit f3660d3505
30 files changed
+2619

No files matched your search

+129
View File
@@ -0,0 +1,129 @@
-- Keybindings. Shell features (launcher, panels, media keys) go through
-- Noctalia's IPC: https://docs.noctalia.dev/noctalia/ipc/
local nix = require("nixvars")
local mainMod = "SUPER"
local ipc = "noctalia msg "
-- Binds act as if the first layout (us) were active, so they also work while
-- the Russian layout is selected.
----------------------
---- APPLICATIONS ----
----------------------
hl.bind(mainMod .. " + Return", hl.dsp.exec_cmd(nix.terminal))
hl.bind(mainMod .. " + E", hl.dsp.exec_cmd(nix.fileManager))
---------------
---- WINDOWS ----
---------------
hl.bind(mainMod .. " + Q", hl.dsp.window.close())
hl.bind(mainMod .. " + F", hl.dsp.window.fullscreen())
hl.bind(mainMod .. " + SHIFT + F", hl.dsp.window.fullscreen({ mode = "maximized" }))
hl.bind(mainMod .. " + SHIFT + Space", hl.dsp.window.float({ action = "toggle" }))
hl.bind(mainMod .. " + P", hl.dsp.window.pseudo())
hl.bind(mainMod .. " + T", hl.dsp.layout("togglesplit")) -- dwindle only
-- Emergency exit if the shell is not running.
hl.bind(mainMod .. " + SHIFT + Escape", hl.dsp.exit())
-- Move focus with mainMod + arrow keys or hjkl
hl.bind(mainMod .. " + left", hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod .. " + right", hl.dsp.focus({ direction = "right" }))
hl.bind(mainMod .. " + up", hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. " + down", hl.dsp.focus({ direction = "down" }))
hl.bind(mainMod .. " + H", hl.dsp.focus({ direction = "left" }))
hl.bind(mainMod .. " + L", hl.dsp.focus({ direction = "right" }))
hl.bind(mainMod .. " + K", hl.dsp.focus({ direction = "up" }))
hl.bind(mainMod .. " + J", hl.dsp.focus({ direction = "down" }))
-- Move the window with mainMod + SHIFT + arrow keys or hjkl
hl.bind(mainMod .. " + SHIFT + left", hl.dsp.window.move({ direction = "left" }))
hl.bind(mainMod .. " + SHIFT + right", hl.dsp.window.move({ direction = "right" }))
hl.bind(mainMod .. " + SHIFT + up", hl.dsp.window.move({ direction = "up" }))
hl.bind(mainMod .. " + SHIFT + down", hl.dsp.window.move({ direction = "down" }))
hl.bind(mainMod .. " + SHIFT + H", hl.dsp.window.move({ direction = "left" }))
hl.bind(mainMod .. " + SHIFT + L", hl.dsp.window.move({ direction = "right" }))
hl.bind(mainMod .. " + SHIFT + K", hl.dsp.window.move({ direction = "up" }))
hl.bind(mainMod .. " + SHIFT + J", hl.dsp.window.move({ direction = "down" }))
-- Resize with mainMod + CTRL + arrow keys or hjkl
local resizeStep = 40
local resizeKeys = {
{ "left", "H", -resizeStep, 0 },
{ "right", "L", resizeStep, 0 },
{ "up", "K", 0, -resizeStep },
{ "down", "J", 0, resizeStep },
}
for _, r in ipairs(resizeKeys) do
local action = hl.dsp.window.resize({ x = r[3], y = r[4], relative = true })
hl.bind(mainMod .. " + CTRL + " .. r[1], action, { repeating = true })
hl.bind(mainMod .. " + CTRL + " .. r[2], action, { repeating = true })
end
-- Move/resize windows with mainMod + LMB/RMB and dragging
hl.bind(mainMod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true })
hl.bind(mainMod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true })
--------------------
---- WORKSPACES ----
--------------------
-- Switch workspaces with mainMod + [0-9]
-- Move active window to a workspace with mainMod + SHIFT + [0-9]
for i = 1, 10 do
local key = i % 10 -- 10 maps to key 0
hl.bind(mainMod .. " + " .. key, hl.dsp.focus({ workspace = i }))
hl.bind(mainMod .. " + SHIFT + " .. key, hl.dsp.window.move({ workspace = i }))
end
-- Scratchpad (special workspace)
hl.bind(mainMod .. " + minus", hl.dsp.workspace.toggle_special("magic"))
hl.bind(mainMod .. " + SHIFT + minus", hl.dsp.window.move({ workspace = "special:magic" }))
-- Scroll through existing workspaces with mainMod + scroll
hl.bind(mainMod .. " + mouse_down", hl.dsp.focus({ workspace = "e+1" }))
hl.bind(mainMod .. " + mouse_up", hl.dsp.focus({ workspace = "e-1" }))
------------------
---- NOCTALIA ----
------------------
hl.bind(mainMod .. " + Space", hl.dsp.exec_cmd(ipc .. "panel-toggle launcher"))
hl.bind(mainMod .. " + S", hl.dsp.exec_cmd(ipc .. "panel-toggle control-center"))
hl.bind(mainMod .. " + comma", hl.dsp.exec_cmd(ipc .. "settings-toggle"))
hl.bind(mainMod .. " + V", hl.dsp.exec_cmd(ipc .. "panel-toggle clipboard"))
hl.bind(mainMod .. " + W", hl.dsp.exec_cmd(ipc .. "panel-toggle wallpaper"))
hl.bind(mainMod .. " + Escape", hl.dsp.exec_cmd(ipc .. "panel-toggle session"))
hl.bind(mainMod .. " + ALT + L", hl.dsp.exec_cmd(ipc .. "session lock"))
hl.bind("ALT + Tab", hl.dsp.exec_cmd(ipc .. "window-switcher hold"))
-- Volume, microphone, brightness and media keys
local held = { locked = true, repeating = true }
hl.bind("XF86AudioRaiseVolume", hl.dsp.exec_cmd(ipc .. "volume-up"), held)
hl.bind("XF86AudioLowerVolume", hl.dsp.exec_cmd(ipc .. "volume-down"), held)
hl.bind("XF86AudioMute", hl.dsp.exec_cmd(ipc .. "volume-mute"), held)
hl.bind("XF86AudioMicMute", hl.dsp.exec_cmd(ipc .. "mic-mute"), held)
hl.bind("XF86MonBrightnessUp", hl.dsp.exec_cmd(ipc .. "brightness-up"), held)
hl.bind("XF86MonBrightnessDown", hl.dsp.exec_cmd(ipc .. "brightness-down"), held)
hl.bind("XF86AudioNext", hl.dsp.exec_cmd(ipc .. "media next"), { locked = true })
hl.bind("XF86AudioPause", hl.dsp.exec_cmd(ipc .. "media toggle"), { locked = true })
hl.bind("XF86AudioPlay", hl.dsp.exec_cmd(ipc .. "media toggle"), { locked = true })
hl.bind("XF86AudioPrev", hl.dsp.exec_cmd(ipc .. "media previous"), { locked = true })
---------------------
---- SCREENSHOTS ----
---------------------
-- grim + slurp, straight to the clipboard. Cancelling slurp aborts the capture.
hl.bind("Print", hl.dsp.exec_cmd('geometry=$(slurp) && grim -g "$geometry" - | wl-copy'))
hl.bind("SHIFT + Print", hl.dsp.exec_cmd("grim - | wl-copy"))
-- Region to ~/Pictures/Screenshots and the clipboard.
hl.bind("CTRL + Print", hl.dsp.exec_cmd(
'dir="$HOME/Pictures/Screenshots"; mkdir -p "$dir" && geometry=$(slurp) && ' ..
'file="$dir/$(date +%F_%H-%M-%S).png" && grim -g "$geometry" "$file" && wl-copy < "$file"'))
-- Noctalia's own region capture with the annotation editor.
hl.bind(mainMod .. " + Print", hl.dsp.exec_cmd(ipc .. "screenshot-region"))
+67
View File
@@ -0,0 +1,67 @@
# Hyprland user configuration. Hyprland 0.56 reads Lua, so the real config lives
# in the plain .lua files next to this module; Nix only passes in the few
# values that come from the system config (keyboard layouts, cursor, apps).
{
config,
lib,
pkgs,
osConfig,
...
}:
let
cfg = config.my.home.hyprland;
cursor = config.home.pointerCursor;
# Exposed to the Lua files as `require("nixvars")`.
nixVars = {
kbLayout = lib.concatStringsSep "," osConfig.my.locale.keyboardLayouts;
kbOptions = lib.concatStringsSep "," osConfig.my.locale.keyboardOptions;
terminal = "wezterm";
fileManager = "nautilus";
cursorSize = if cursor.enable then cursor.size else 24;
cursorTheme = if cursor.enable then cursor.name else "";
};
in
{
options.my.home.hyprland.enable = lib.mkEnableOption "Hyprland user configuration (Lua)";
config = lib.mkIf cfg.enable {
wayland.windowManager.hyprland = {
enable = true;
configType = "lua";
# The NixOS module (programs.hyprland) installs the compositor and the
# portal, built from the flake overlay. Installing them again here would
# put a second copy in the user profile.
package = null;
portalPackage = null;
# UWSM owns the session and graphical-session.target; HM's own
# hyprland-session.target and dbus import would only duplicate that.
systemd.enable = false;
xwayland.enable = true;
# Loaded in name order; `nixvars` is a helper module, not loaded on its own.
extraLuaFiles = {
nixvars = {
content = "return ${lib.generators.toLua { } nixVars}\n";
autoLoad = false;
};
"10-settings" = ./settings.lua;
"20-binds" = ./binds.lua;
"30-rules" = ./rules.lua;
};
};
# Tools the binds call (screenshots, file manager).
home.packages = with pkgs; [
grim
slurp
wl-clipboard
nautilus
];
# Electron and Chromium apps pick Wayland instead of XWayland.
home.sessionVariables.NIXOS_OZONE_WL = "1";
};
}
+89
View File
@@ -0,0 +1,89 @@
-- Window, layer and workspace rules.
-- Ignore maximize requests from all apps.
hl.window_rule({
name = "suppress-maximize-events",
match = { class = ".*" },
suppress_event = "maximize",
})
-- Fix some dragging issues with XWayland.
hl.window_rule({
name = "fix-xwayland-drags",
match = {
class = "^$",
title = "^$",
xwayland = true,
float = true,
fullscreen = false,
pin = false,
},
no_focus = true,
})
-- Hyprland-run windowrule.
hl.window_rule({
name = "move-hyprland-run",
match = { class = "hyprland-run" },
move = "20 monitor_h-120",
float = true,
})
-- Anything fullscreen keeps the screen awake (video players, games, browsers).
hl.window_rule({
name = "idle-inhibit-fullscreen",
match = { class = ".*" },
idle_inhibit = "fullscreen",
})
------------------
---- NOCTALIA ----
------------------
-- Settings window floats at a comfortable size.
hl.window_rule({
name = "noctalia-settings",
match = { class = "dev.noctalia.Noctalia" },
float = true,
size = { 1080, 920 },
})
-- Blur behind the bar, panels, dock and notifications; Hyprland's own layer
-- animations are off so they do not fight Noctalia's.
hl.layer_rule({
name = "noctalia",
match = {
namespace = "^noctalia-(bar-.+|notification|dock|panel|attached-panel|osd|window-switcher)$",
},
no_anim = true,
ignore_alpha = 0.5,
blur = true,
blur_popups = true,
})
----------------
---- GAMING ----
----------------
-- Steam Big Picture games (steam_app_<id>) may tear for lower input latency.
-- This only takes effect in fullscreen with general.allow_tearing enabled.
hl.window_rule({
name = "steam-games-tearing",
match = { class = "^steam_app_\\d+$" },
immediate = true,
})
-- Steam's small utility windows.
hl.window_rule({
name = "steam-utility-windows",
match = { class = "^steam$", title = "^(Friends List|Steam Settings)$" },
float = true,
})
+117
View File
@@ -0,0 +1,117 @@
-- Monitors, environment, look and feel, input.
-- API reference: the official example (hyprland.lua) shipped with Hyprland.
local nix = require("nixvars")
------------------
---- MONITORS ----
------------------
-- Any output, native mode, placed automatically. Use mode = "highrr" to prefer
-- the highest refresh rate instead.
hl.monitor({
output = "",
mode = "preferred",
position = "auto",
scale = "auto",
})
-------------------------------
---- ENVIRONMENT VARIABLES ----
-------------------------------
hl.env("XCURSOR_SIZE", tostring(nix.cursorSize))
hl.env("HYPRCURSOR_SIZE", tostring(nix.cursorSize))
if nix.cursorTheme ~= "" then
hl.env("XCURSOR_THEME", nix.cursorTheme)
end
-----------------------
---- LOOK AND FEEL ----
-----------------------
-- Gaps, rounding, shadow and blur follow the Noctalia documentation so the
-- shell's bar and panels sit well on top of the windows.
hl.config({
general = {
gaps_in = 5,
gaps_out = 10,
border_size = 2,
col = {
-- Catppuccin Mocha: mauve to blue, surface1 when unfocused.
active_border = { colors = { "rgba(cba6f7ee)", "rgba(89b4faee)" }, angle = 45 },
inactive_border = "rgba(45475aaa)",
},
resize_on_border = true,
-- Only windows with the `immediate` rule (see 30-rules.lua) tear.
allow_tearing = true,
layout = "dwindle",
},
decoration = {
rounding = 20,
rounding_power = 2,
shadow = {
enabled = true,
range = 4,
render_power = 3,
color = 0xee1a1a1a,
},
blur = {
enabled = true,
size = 3,
passes = 2,
vibrancy = 0.1696,
},
},
animations = {
enabled = true,
},
dwindle = {
preserve_split = true,
},
master = {
new_status = "master",
},
misc = {
-- Noctalia draws the wallpaper.
force_default_wallpaper = 0,
disable_hyprland_logo = true,
},
ecosystem = {
no_update_news = true,
no_donation_nag = true,
},
})
---------------
---- INPUT ----
---------------
hl.config({
input = {
kb_layout = nix.kbLayout,
kb_options = nix.kbOptions,
numlock_by_default = true,
follow_mouse = 1,
sensitivity = 0,
},
})
-- Persistent workspaces keep the empty ones visible in Noctalia's indicator.
for i = 1, 5 do
hl.workspace_rule({ workspace = tostring(i), persistent = true })
end