Files
NixOsConfig/modules/desktop/hyprland/default.nix
T
Claude af18420fd3 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
2026-10-12 20:55:34 +00:00

136 lines
4.1 KiB
Nix

# 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
];
};
}