Switch to the dendritic flake-parts layout, with stubs for phase 2

flake.nix now only declares inputs and calls flake-parts with import-tree
over ./modules: every .nix file under modules/ is a flake-parts module.
Features are aspects (flake.modules.nixos.<name> and
flake.modules.homeManager.<name>); importing an aspect enables it, so the
my.* option modules and their enable flags are gone.

- Add the flake-parts glue: modules/flake/ (systems, shared meta data,
  host construction through configurations.nixos, overlays, packages,
  apps, dev shell, formatter, checks), modules/users/faumaray.nix
  (meta.owner) and modules/core/{nixpkgs,home-manager,install-facts}.nix.
  config.my is kept as one read-only derived option so install-system
  keeps working unchanged.
- Add the aspects that are already final: secrets, ssh, hyprland,
  wezterm, git, stylix, proxy-suite, gitea-runner and claude-code, and
  the desktop host (modules/hosts/desktop/{host,hardware,disks}.nix).
- Port the always-on basics to the `core` aspect (nix, boot, locale,
  networking, users), lanzaboote and plain systemd-boot to the
  `secure-boot` and `systemd-boot` aspects, and the installer ISO to
  modules/installer/iso.nix. Behaviour is unchanged; the time zone,
  default locale, XKB layouts and the firewall setting now live in
  modules/hosts/desktop/host.nix.
- Move the Lua files (Hyprland settings, binds, rules; Neovim init.lua)
  with git mv, byte-identical.
- Add bare stubs, marked STUB, for the aspects that the next phase
  ports: amd, rocm, gaming, vpn, docker, noctalia, audio, fonts, xdg,
  apps, shell and neovim. The host evaluates with them, but those
  features are not configured until they are ported.
- Remove lib/, overlays/, apps/, modules/nixos/, modules/home/,
  modules/installer/default.nix and hosts/desktop/{default,disks,home}.nix.
- flake.lock: add flake-parts, import-tree, stylix and serena with their
  transitive inputs (22 new nodes); every existing pin is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZ16yf4acmaSiHq81vyQ6Z
This commit is contained in:
Claude committed 2026-10-12 20:55:34 +00:00
1 parent 7dd6853124
commit af18420fd3
84 files changed
+2121 -1928

No files matched your search

+4
View File
@@ -0,0 +1,4 @@
# STUB (T1): replaced in phase 2
{
flake.modules.homeManager.apps = { };
}
+4
View File
@@ -0,0 +1,4 @@
# STUB (T1): replaced in phase 2
{
flake.modules.nixos.audio = { };
}
+4
View File
@@ -0,0 +1,4 @@
# STUB (T1): replaced in phase 2
{
flake.modules.nixos.fonts = { };
}
+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"))
+135
View File
@@ -0,0 +1,135 @@
# Hyprland desktop, both halves of one feature:
# NixOS UWSM-managed compositor, SDDM with autologin of the owner,
# portals, keyring and the small services a desktop needs.
# home-manager the user configuration. Hyprland reads Lua: the real config
# is in the .lua files next to this file; Nix only passes in the
# values that come from elsewhere (`require("nixvars")`).
# The NixOS half adds the home-manager half to the owner, so a host imports
# `nixos.hyprland` once. Noctalia, audio and fonts are separate aspects.
{ config, ... }:
let
inherit (config.meta) owner;
hmHyprland = config.flake.modules.homeManager.hyprland;
in
{
flake.modules.nixos.hyprland =
{ pkgs, ... }:
{
home-manager.users.${owner.name}.imports = [ hmHyprland ];
# package/portalPackage stay default: the overlay swaps in the flake builds.
programs.hyprland = {
enable = true;
withUWSM = true;
xwayland.enable = true;
};
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
settings.Autologin = {
Session = "hyprland.desktop";
User = owner.name;
};
};
xdg.portal.extraPortals = [
pkgs.xdg-desktop-portal-gtk
pkgs.xdg-desktop-portal-hyprland
];
security.polkit.enable = true;
services.gnome.gnome-keyring.enable = true;
programs.dconf.enable = true;
# Electron/Chromium apps use native Wayland.
environment.sessionVariables.NIXOS_OZONE_WL = "1";
# Removable drives and trash/mounts in the file manager.
services.udisks2.enable = true;
services.gvfs.enable = true;
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
};
environment.systemPackages = with pkgs; [
wl-clipboard
cliphist
grim
slurp
brightnessctl
playerctl
pavucontrol
kdePackages.dolphin
kdePackages.dolphin-plugins
hyprpicker
];
};
flake.modules.homeManager.hyprland =
{
config,
lib,
pkgs,
osConfig,
...
}:
let
cursor = config.home.pointerCursor;
# Exposed to the Lua files as `require("nixvars")`. Keyboard layouts come
# from the NixOS configuration (services.xserver.xkb, set by the host),
# the cursor from home-manager (set by Stylix, theme/stylix.nix).
nixVars = {
kbLayout = osConfig.services.xserver.xkb.layout;
kbOptions = osConfig.services.xserver.xkb.options;
terminal = "wezterm";
fileManager = "dolphin";
cursorSize = if cursor.enable then cursor.size else 24;
cursorTheme = if cursor.enable then cursor.name else "";
};
in
{
wayland.windowManager.hyprland = {
enable = true;
configType = "lua";
# The NixOS half (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. Stylix's colours are rendered after these files (hl.config in
# hyprland.lua), so they override the colours in settings.lua.
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
kdePackages.dolphin
kdePackages.dolphin-plugins
];
};
}
+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,
})
+182
View File
@@ -0,0 +1,182 @@
-- 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.env("AQ_DRM_DEVICES", "/dev/dri/card1:/dev/dri/card0")
hl.monitor({
output = "DP-1",
mode = "preferred",
position = "0x0",
scale = "1",
bitdepth = 10,
supports_wide_color = 1,
supports_hdr = 0,
sdrbrightness = "1.25",
sdrsaturation = "1.2",
vrr = 1,
cm = "auto",
sdr_min_luminance = 0,
sdr_max_luminance = 200,
-- icc = "/home/faumaray/Documents/ICC Profile_20240726/CxxG5xT.icm",
sdr_eotf = "gamma22",
})
-- monitor = DP-2, preferred, -2560x0, 1, bitdepth, 10, vrr, 1, icc, /home/faumaray/Documents/ICC Profile_20240726/ASUS_Display_sRGB.icc
hl.monitor({
output = "DP-2",
mode = "2560x1440@144",
position = "-2560x0",
-- position = -1440x0
scale = "1",
-- transform = 1
bitdepth = 10,
supports_wide_color = 1,
supports_hdr = 0,
-- sdrbrightness = 1.0,
-- sdrsaturation = 1.1,
vrr = 1,
sdr_eotf = "gamma22",
cm = "auto",
-- icc = "/home/faumaray/Documents/ICC Profile_20240726/ASUS_Display_sRGB.icm",
-- sdr_min_luminance = 0,
-- sdr_max_luminance = 50
})
-------------------------------
---- 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({
cursor = {
no_hardware_cursors = 0,
},
xwayland = {
force_zero_scaling = false,
create_abstract_socket = true,
},
render = {
send_content_type = true,
direct_scanout = 0,
-- cm_fs_passthrough = 1,
cm_auto_hdr = 0,
cm_sdr_eotf = 1,
},
quirks = {
prefer_hdr = 0,
},
general = {
gaps_in = 5,
gaps_out = 10,
border_size = 2,
col = {
-- Catppuccin Mocha: mauve to blue, surface1 when unfocused.
active_border = "rgba(33ccffee)",
inactive_border = "rgba(595959aa)",
},
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
for i = 1, 10 do
if i % 2 == 0 then
if i <= 5 then
hl.workspace_rule({ workspace = tostring(i), persistent = true, monitor = "DP-2" })
else
hl.workspace_rule({ workspace = tostring(i), persistent = false, monitor = "DP-2" })
end
else
if i <= 5 then
hl.workspace_rule({ workspace = tostring(i), persistent = true, monitor = "DP-1" })
else
hl.workspace_rule({ workspace = tostring(i), persistent = false, monitor = "DP-1" })
end
end
end
+5
View File
@@ -0,0 +1,5 @@
# STUB (T1): replaced in phase 2
{
flake.modules.nixos.noctalia = { };
flake.modules.homeManager.noctalia = { };
}
+50
View File
@@ -0,0 +1,50 @@
# WezTerm terminal (SUPER+Return in Hyprland). Colours and the font come from
# Stylix (theme/stylix.nix: scheme "stylix", Monaspace Krypton + Noto Color
# Emoji, size 12); this file holds the rest of the configuration.
{
flake.modules.homeManager.wezterm =
{ lib, ... }:
let
action = lib.generators.mkLuaInline;
in
{
programs.wezterm = {
enable = true;
settings = {
# Wayland-native, no client-side titlebar (Hyprland draws the borders).
enable_wayland = true;
window_decorations = "NONE";
window_padding = {
left = 8;
right = 8;
top = 8;
bottom = 8;
};
# A tab bar only when there is more than one tab.
hide_tab_bar_if_only_one_tab = true;
use_fancy_tab_bar = false;
scrollback_lines = 20000;
audible_bell = "Disabled";
check_for_updates = false;
# Hyprland owns SUPER and ALT+Tab, so splits live on CTRL+SHIFT.
# phys: keys are layout independent and work with the ru layout.
keys = [
{
key = "phys:D";
mods = "CTRL|SHIFT";
action = action "wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' }";
}
{
key = "phys:E";
mods = "CTRL|SHIFT";
action = action "wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' }";
}
];
};
};
};
}
+4
View File
@@ -0,0 +1,4 @@
# STUB (T1): replaced in phase 2
{
flake.modules.homeManager.xdg = { };
}