diff --git a/configs/ABOUTME.md b/configs/ABOUTME.md index 986a2ca..fea87b9 100644 --- a/configs/ABOUTME.md +++ b/configs/ABOUTME.md @@ -16,6 +16,7 @@ these cases where the source subdir and `~/.config` target differ. |---|---| | `niri/` | Niri Wayland compositor config | | `fwbook/hypr/` | Hyprland config for `fwbook` (scrolling layout + noctalia); linked to `~/.config/hypr` | +| `hl-fwdesk/hypr/` | Hyprland config for `hl-fwdesk` (Steam console); **baked into the build** via `mountAsSource`, linked to `~/.config/hypr` | | `fwbook/quickshell/` | Quickshell configs for `fwbook` (scrolling overview); linked to `~/.config/quickshell` | | `extra.nu` | Extra NuShell config sourced at shell startup | | `fwbook.knsv` | fwbook-specific Kanshi display profile | @@ -26,3 +27,7 @@ these cases where the source subdir and `~/.config` target differ. - Changes here take effect on next login or when the activation script runs - These are **not** NixOS options — they are plain config files managed as repo content - The symlink mechanism is defined in `modules/skyg-utils.nix` +- Hosts can embed their config in the build by setting + `configLink.mountAsSource = true`; the dir is then read from the flake's + store path (`skyg.rootDir`) instead of the live `~/nixos-setup/configs` + checkout. See `modules/nixos/desktop/tiler/hyprland.nix`. diff --git a/configs/hl-fwdesk/hypr/.luarc.json b/configs/hl-fwdesk/hypr/.luarc.json new file mode 100644 index 0000000..ad78fba --- /dev/null +++ b/configs/hl-fwdesk/hypr/.luarc.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json", + "workspace.library": ["types"], + "diagnostics.globals": ["hl"], + "runtime.version": "Lua 5.4" +} \ No newline at end of file diff --git a/configs/hl-fwdesk/hypr/ABOUTME.md b/configs/hl-fwdesk/hypr/ABOUTME.md new file mode 100644 index 0000000..9fdb896 --- /dev/null +++ b/configs/hl-fwdesk/hypr/ABOUTME.md @@ -0,0 +1,23 @@ +# hl-fwdesk/hypr + +Steam-console Hyprland config for `hl-fwdesk` (a lounge box attached to a single +1080p HDMI TV). Modeled on `configs/fwbook/hypr` but scoped down for the console +use case — no DMS/noctalia/qs shell, no laptop panel or multi-monitor setup. + +It is **baked into the build** (`skyg.nixos.desktop.tiler.hyprland.configLink.mountAsSource`) +and symlinked to `~/.config/hypr` by the skyg hyprland module. + +## Files + +| Path | Description | +|---|---| +| `hyprland.lua` | Entry point; `require`s the `conf/*.lua` files | +| `conf/env.lua` | Wayland/portal env vars | +| `conf/general.lua` | Scrolling-layout general settings | +| `conf/animations.lua` | Workspace/window animations | +| `conf/monitors.lua` | Single-display (fallback) monitor config | +| `conf/inputs.lua` | Keyboard layout | +| `conf/window-rules.lua` | Float rules for control dialogs | +| `conf/keybindings.lua` | Keyboard/mouse binds | +| `conf/autostart.lua` | Auto-launches Steam Big Picture (`steam -tenfoot`) on start | +| `types/hl.lua` | Lua-language-server type stubs for the `hl` global | \ No newline at end of file diff --git a/configs/hl-fwdesk/hypr/conf/animations.lua b/configs/hl-fwdesk/hypr/conf/animations.lua new file mode 100644 index 0000000..4d28c44 --- /dev/null +++ b/configs/hl-fwdesk/hypr/conf/animations.lua @@ -0,0 +1,26 @@ +-- ========================= +-- Animations +-- ========================= +hl.animation({ + leaf = "workspaces", + enabled = true, + speed = 2, + bezier = "default", + style = "slidevert", +}) + +hl.animation({ + leaf = "windows", + enabled = true, + speed = 5, + bezier = "default", + style = "slidefade 60%", +}) + +hl.animation({ + leaf = "windowsMove", + enabled = true, + speed = 5, + bezier = "default", + style = "slidefade 80%", +}) diff --git a/configs/hl-fwdesk/hypr/conf/autostart.lua b/configs/hl-fwdesk/hypr/conf/autostart.lua new file mode 100644 index 0000000..4e0c719 --- /dev/null +++ b/configs/hl-fwdesk/hypr/conf/autostart.lua @@ -0,0 +1,7 @@ +-- ========================= +-- Autostart +-- ========================= +hl.on("hyprland.start", function() + -- Lounge console: drop straight into Steam Big Picture. + hl.exec_cmd("steam -tenfoot") +end) diff --git a/configs/hl-fwdesk/hypr/conf/env.lua b/configs/hl-fwdesk/hypr/conf/env.lua new file mode 100644 index 0000000..dff7785 --- /dev/null +++ b/configs/hl-fwdesk/hypr/conf/env.lua @@ -0,0 +1,11 @@ +-- ========================= +-- Environment +-- ========================= +hl.env("XCURSOR_SIZE", "24") +hl.env("XCURSOR_THEME", "Adwaita") +hl.env("HYPRCURSOR_SIZE", "24") +hl.env("HYPRCURSOR_THEME", "") +hl.env("NIXOS_OZONE_WL", "1") +hl.env("QT_QPA_PLATFORM", "wayland") +hl.env("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1") +hl.env("ELECTRON_OZONE_PLATFORM_HINT", "auto") diff --git a/configs/hl-fwdesk/hypr/conf/general.lua b/configs/hl-fwdesk/hypr/conf/general.lua new file mode 100644 index 0000000..95a76a6 --- /dev/null +++ b/configs/hl-fwdesk/hypr/conf/general.lua @@ -0,0 +1,37 @@ +-- ========================= +-- General / Layout +-- ========================= +hl.config({ + general = { + gaps_in = 4, + gaps_out = 4, + border_size = 2, + layout = "scrolling", + resize_on_border = true, + }, + + decoration = { + rounding = 12, + active_opacity = 1.0, + inactive_opacity = 0.9, + }, + + -- https://wiki.hypr.land/Configuring/Layouts/Scrolling-Layout/ + scrolling = { + column_width = 0.5, + fullscreen_on_one_column = true, + focus_fit_method = 0, + follow_focus = true, + explicit_column_widths = "0.333, 0.5, 0.667, 1.0", + }, + + cursor = { + sync_gsettings_theme = true, + enable_hyprcursor = false, + }, + + misc = { + disable_hyprland_logo = true, + focus_on_activate = true, + }, +}) diff --git a/configs/hl-fwdesk/hypr/conf/inputs.lua b/configs/hl-fwdesk/hypr/conf/inputs.lua new file mode 100644 index 0000000..38b8c80 --- /dev/null +++ b/configs/hl-fwdesk/hypr/conf/inputs.lua @@ -0,0 +1,9 @@ +-- ========================= +-- Input +-- ========================= +hl.config({ + input = { + kb_layout = "us", + follow_mouse = 1, + }, +}) diff --git a/configs/hl-fwdesk/hypr/conf/keybindings.lua b/configs/hl-fwdesk/hypr/conf/keybindings.lua new file mode 100644 index 0000000..506e350 --- /dev/null +++ b/configs/hl-fwdesk/hypr/conf/keybindings.lua @@ -0,0 +1,51 @@ +-- ========================= +-- Keybindings +-- ========================= +local mod = "SUPER" + +-- ========================= +-- Apps +-- ========================= +hl.bind(mod .. " + T", hl.dsp.exec_cmd("ghostty")) +hl.bind(mod .. " + Q", hl.dsp.window.close()) + +-- ========================= +-- Navigation +-- ========================= +hl.bind(mod .. " + left", hl.dsp.focus({ direction = "left" })) +hl.bind(mod .. " + right", hl.dsp.focus({ direction = "right" })) +hl.bind(mod .. " + up", hl.dsp.focus({ workspace = "e-1" })) +hl.bind(mod .. " + down", hl.dsp.focus({ workspace = "e+1" })) + +-- ========================= +-- Window Management +-- ========================= +hl.bind(mod .. " + CTRL + right", hl.dsp.layout("swapcol r")) +hl.bind(mod .. " + CTRL + left", hl.dsp.layout("swapcol l")) +hl.bind(mod .. " + F", hl.dsp.window.fullscreen({ mode = "maximized", action = "toggle" })) +hl.bind(mod .. " + SHIFT + F", hl.dsp.window.fullscreen({ mode = "fullscreen", action = "toggle" })) +hl.bind(mod .. " + V", hl.dsp.window.float({ action = "toggle" })) + +-- ========================= +-- Resizing +-- ========================= +hl.bind(mod .. " + minus", hl.dsp.layout("colresize -0.1")) +hl.bind(mod .. " + equal", hl.dsp.layout("colresize +0.1")) + +-- ========================= +-- Screenshots +-- ========================= +hl.bind("Print", hl.dsp.exec_cmd('grim -g "$(slurp)" - | satty -f -')) +hl.bind(mod .. " + P", hl.dsp.exec_cmd('grim -g "$(slurp)" - | satty -f -')) + +-- ========================= +-- Session +-- ========================= +-- UWSM: use `uwsm stop` instead of the `exit` dispatcher (ordered shutdown). +hl.bind("CTRL + ALT + Delete", hl.dsp.exec_cmd("uwsm stop")) + +-- ========================= +-- Mouse drag (move / resize windows) +-- ========================= +hl.bind(mod .. " + mouse:272", hl.dsp.window.drag(), { mouse = true }) +hl.bind(mod .. " + mouse:273", hl.dsp.window.resize(), { mouse = true }) diff --git a/configs/hl-fwdesk/hypr/conf/monitors.lua b/configs/hl-fwdesk/hypr/conf/monitors.lua new file mode 100644 index 0000000..4ccd2fd --- /dev/null +++ b/configs/hl-fwdesk/hypr/conf/monitors.lua @@ -0,0 +1,11 @@ +-- ========================= +-- Monitors +-- ========================= +-- hl-fwdesk is a lounge console box on a single 1080p HDMI TV. +-- Fallback catches anything not matched above. +hl.monitor({ + output = "", + mode = "preferred", + position = "auto", + scale = "auto", +}) diff --git a/configs/hl-fwdesk/hypr/conf/window-rules.lua b/configs/hl-fwdesk/hypr/conf/window-rules.lua new file mode 100644 index 0000000..5f39fe9 --- /dev/null +++ b/configs/hl-fwdesk/hypr/conf/window-rules.lua @@ -0,0 +1,8 @@ +-- ========================= +-- Window Rules +-- ========================= +-- Float small control/dialog utilities so they don't tile in the console layout. +hl.window_rule({ name = "float-pavucontrol", match = { class = "^(pavucontrol)$" }, float = true }) +hl.window_rule({ name = "float-blueman", match = { class = "^(blueman-manager)$" }, float = true }) +hl.window_rule({ name = "float-open-file", match = { title = "^(Open File)$" }, float = true }) +hl.window_rule({ name = "float-save-file", match = { title = "^(Save File)$" }, float = true }) diff --git a/configs/hl-fwdesk/hypr/hyprland.lua b/configs/hl-fwdesk/hypr/hyprland.lua new file mode 100644 index 0000000..f9cc596 --- /dev/null +++ b/configs/hl-fwdesk/hypr/hyprland.lua @@ -0,0 +1,15 @@ +-- ========================= +-- Hyprland (hl-fwdesk) +-- ========================= +-- Steam-console desktop for the hl-fwdesk lounge box. +-- Config is baked into the build (skyg rootDir) and symlinked to +-- ~/.config/hypr by the skyg hyprland module. + +require("conf/env") +require("conf/general") +require("conf/animations") +require("conf/monitors") +require("conf/inputs") +require("conf/window-rules") +require("conf/keybindings") +require("conf/autostart") diff --git a/configs/hl-fwdesk/hypr/stylua.toml b/configs/hl-fwdesk/hypr/stylua.toml new file mode 100644 index 0000000..a5e3295 --- /dev/null +++ b/configs/hl-fwdesk/hypr/stylua.toml @@ -0,0 +1,6 @@ +column_width = 100 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 4 +quote_style = "AutoPreferDouble" +call_parentheses = "Always" \ No newline at end of file diff --git a/configs/hl-fwdesk/hypr/types/hl.lua b/configs/hl-fwdesk/hypr/types/hl.lua new file mode 100644 index 0000000..c68a0a9 --- /dev/null +++ b/configs/hl-fwdesk/hypr/types/hl.lua @@ -0,0 +1,181 @@ +-- ============================================================================= +-- Hyprland Lua API — EmmyLua type stubs (hl-fwdesk copy) +-- ============================================================================= +-- This file is never executed by Hyprland. It exists solely to give +-- lua-language-server type information for the `hl` global that Hyprland +-- injects at runtime (0.55+). +-- +-- Coverage is based on the API surface used in conf/*.lua. Extend as needed +-- when new hl.* calls are added. +-- ============================================================================= + +-- --------------------------------------------------------------------------- +-- Shared primitive types +-- --------------------------------------------------------------------------- + +---@class hl.ConfigTable +---@class hl.DispatcherValue + +-- --------------------------------------------------------------------------- +-- hl.dsp — dispatcher factories +-- --------------------------------------------------------------------------- + +---@class hl.dsp.FocusOpts +---@field direction? "left"|"right"|"up"|"down" +---@field workspace? string|integer +---@field monitor? string +---@field on_current_monitor? boolean + +---@class hl.dsp.MoveOpts +---@field direction? "left"|"right"|"up"|"down" +---@field workspace? string +---@field monitor? "l"|"r"|"u"|"d"|string +---@field follow? boolean + +---@class hl.dsp.FullscreenOpts +---@field mode? "fullscreen"|"maximize"|"float" +---@field action? "toggle"|"on"|"off" + +---@class hl.dsp.FloatOpts +---@field action? "toggle"|"on"|"off" + +---@class hl.dsp +local dsp = {} + +---Execute a shell command. +---@param cmd string +---@return hl.DispatcherValue +function dsp.exec_cmd(cmd) end + +---Invoke a named scrolling-layout dispatcher. +---@param action string +---@return hl.DispatcherValue +function dsp.layout(action) end + +---Focus a window or workspace. +---@param opts hl.dsp.FocusOpts +---@return hl.DispatcherValue +function dsp.focus(opts) end + +---@class hl.dsp.window +local dsp_window = {} + +---Close the focused window. +---@return hl.DispatcherValue +function dsp_window.close() end + +---Toggle/set fullscreen on the focused window. +---@param opts? hl.dsp.FullscreenOpts +---@return hl.DispatcherValue +function dsp_window.fullscreen(opts) end + +---Toggle/set floating on the focused window. +---@param opts? hl.dsp.FloatOpts +---@return hl.DispatcherValue +function dsp_window.float(opts) end + +---Begin an interactive mouse drag (move) on the focused window. +---@return hl.DispatcherValue +function dsp_window.drag() end + +---Resize the focused window by a pixel delta. +---@param opts? hl.dsp.ResizeOpts +---@return hl.DispatcherValue +function dsp_window.resize(opts) end + +dsp.window = dsp_window + +-- --------------------------------------------------------------------------- +-- hl.bind +-- --------------------------------------------------------------------------- + +---@class hl.BindOpts +---@field mouse? boolean +---@field locked? boolean +---@field repeating? boolean + +---@param keys string +---@param action hl.DispatcherValue | fun() +---@param opts? hl.BindOpts +function hl.bind(keys, action, opts) end + +-- --------------------------------------------------------------------------- +-- hl.config / hl.env / hl.monitor +-- --------------------------------------------------------------------------- + +---Apply a hyprlang config table. +---@param cfg hl.ConfigTable +function hl.config(cfg) end + +---Set a Wayland/compositor environment variable. +---@param name string +---@param value string +function hl.env(name, value) end + +---@class hl.MonitorOpts +---@field output string +---@field mode string +---@field position string +---@field scale number|string +---@field transform? number + +---Configure a monitor/output. +---@param opts hl.MonitorOpts +function hl.monitor(opts) end + +-- --------------------------------------------------------------------------- +-- hl.animation +-- --------------------------------------------------------------------------- + +---@class hl.AnimationOpts +---@field leaf string +---@field enabled boolean +---@field speed number +---@field bezier? string +---@field spring? string +---@field style? string + +---Configure an animation leaf. +---@param opts hl.AnimationOpts +function hl.animation(opts) end + +-- --------------------------------------------------------------------------- +-- hl.window_rule +-- --------------------------------------------------------------------------- + +---@class hl.WindowRuleMatchOpts +---@field class? string +---@field title? string +---@field float? boolean +---@field fullscreen? boolean +---@field pin? boolean +---@field xwayland? boolean +---@field workspace? string + +---@class hl.WindowRuleOpts +---@field name string +---@field match hl.WindowRuleMatchOpts +---@field float? boolean +---@field tile? boolean +---@field pin? boolean +---@field opacity? number +---@field border_size? number +---@field rounding? number +---@field move? string + +---Add a window rule. +---@param opts hl.WindowRuleOpts +function hl.window_rule(opts) end + +-- --------------------------------------------------------------------------- +-- hl.on / hl.exec_cmd +-- --------------------------------------------------------------------------- + +---Register a callback for a Hyprland event. +---@param event string +---@param callback fun() +function hl.on(event, callback) end + +---Execute a shell command immediately (not as a dispatcher). +---@param cmd string +function hl.exec_cmd(cmd) end diff --git a/flake.nix b/flake.nix index 8ab85e6..bbd4036 100644 --- a/flake.nix +++ b/flake.nix @@ -98,6 +98,7 @@ fullName = "Ari Sosnovsky"; email = "ariel@sosnovsky.ca"; }; + rootDir = ./.; inherit nixpkgs nixpkgs-unstable diff --git a/hosts/hl-fwdesk.nix b/hosts/hl-fwdesk.nix index 4d5f115..6260912 100644 --- a/hosts/hl-fwdesk.nix +++ b/hosts/hl-fwdesk.nix @@ -52,7 +52,13 @@ in enable = true; tiler = { enable = true; - niri.enable = true; + hyprland = { + enable = true; + configLink = { + enable = true; + mountAsSource = true; + }; + }; }; }; server.services.comfyui = { @@ -119,11 +125,11 @@ in # Desktop Env - DankGreeter programs.dank-material-shell.greeter = { enable = true; - compositor.name = "niri"; + compositor.name = "hyprland"; configHome = "/home/ari"; }; - # Boot straight into Steam Big Picture as ari, no password - services.displayManager.defaultSession = "steam"; + # Boot straight into the Hyprland desktop as ari, no password (Steam Big Picture auto-starts) + services.displayManager.defaultSession = "hyprland"; services.displayManager.autoLogin = { enable = true; user = "ari"; diff --git a/modules/ABOUTME.md b/modules/ABOUTME.md index 920b3ac..37be165 100644 --- a/modules/ABOUTME.md +++ b/modules/ABOUTME.md @@ -29,6 +29,7 @@ All custom options live under `skyg.*`. Never introduce options outside this nam ``` skyg.user.* → core/user.nix skyg.networkDrives.* → network-drives.nix +skyg.rootDir → core/default.nix (set by the flake; repo root store path) skyg.nixos.common.* → nixos/common/ skyg.nixos.desktop.* → nixos/desktop/ skyg.nixos.server.* → nixos/server/ diff --git a/modules/core/default.nix b/modules/core/default.nix index 23c83b8..9559af0 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -1,15 +1,17 @@ -{ ... }: +{ lib, ... }: { imports = [ ./user.nix ./macos.nix ./nix-substituters.nix ]; + options = { + skyg.rootDir = lib.mkOption { + type = lib.types.path; + description = "Top-level path of the nixos-setup repo (set by the flake)."; + }; + }; config = { - # Workaround: pipx 1.8.0 test suite fails in nixpkgs 26.05 due to a whitespace - # normalization regression in PEP 508 URL specifiers (space before @ in URLs). - # Must use pythonPackagesExtensions to patch the python3Packages.pipx that - # the build system actually uses, not just the top-level pkgs.pipx wrapper. nixpkgs.overlays = [ (final: _prev: { # xAI Grok CLI — prebuilt binary, see pkgs/grok-cli. diff --git a/modules/lib.nix b/modules/lib.nix index 0ad9d29..feb4d7b 100644 --- a/modules/lib.nix +++ b/modules/lib.nix @@ -1,6 +1,7 @@ { nixpkgs , nixpkgs-unstable , user +, rootDir , determinate , home-manager , nix-darwin @@ -101,6 +102,7 @@ in (import ./main.nix { inherit user + rootDir hostName systemStateVersion; }) @@ -124,6 +126,7 @@ in (import ./main.nix { inherit user + rootDir hostName systemStateVersion homeManagerVersion @@ -149,6 +152,7 @@ in (import ./main.nix { inherit user + rootDir hostName systemStateVersion homeManagerVersion @@ -184,6 +188,7 @@ in (import ./main.nix { inherit user + rootDir homeManagerVersion hostName systemStateVersion; diff --git a/modules/main.nix b/modules/main.nix index 776dc48..e7a05a3 100644 --- a/modules/main.nix +++ b/modules/main.nix @@ -1,6 +1,7 @@ { user , systemStateVersion , hostName +, rootDir , ... }: { lib, ... }: { @@ -15,6 +16,7 @@ fullName = lib.mkDefault user.fullName; email = lib.mkDefault user.email; }; + skyg.rootDir = rootDir; skyg.core.hostName = hostName; skyg.home-manager.version = lib.mkDefault "26.05"; system.stateVersion = systemStateVersion; diff --git a/modules/nixos/desktop/tiler/hyprland.nix b/modules/nixos/desktop/tiler/hyprland.nix index 7bd17d6..7310b2c 100644 --- a/modules/nixos/desktop/tiler/hyprland.nix +++ b/modules/nixos/desktop/tiler/hyprland.nix @@ -12,6 +12,21 @@ let hyprlandPkg = hyprland.packages.${system}.hyprland; hyprlandPortal = hyprland.packages.${system}.xdg-desktop-portal-hyprland; noctaliaPkg = noctalia.packages.${system}.default; + + # When mountAsSource is set, build a real, GC-protected copy of the hypr config + # dir. The flake self-source path (skyg.rootDir) is not referenced by the system + # closure, so it gets garbage-collected and the ~/.config/hypr symlink dangles. + # This derivation is added to the system profile, pinning it against GC. + bakedHyprConfig = pkgs.stdenv.mkDerivation { + pname = "${cfg.configName}-hypr-config"; + version = "1"; + src = "${config.skyg.rootDir}/configs/${cfg.configName}/hypr"; + buildPhase = "true"; + installPhase = '' + mkdir -p "$out/${cfg.configName}" + cp -r "$src" "$out/${cfg.configName}/hypr" + ''; + }; in { options = { @@ -35,6 +50,17 @@ in Disable on hosts that manage their own Hyprland config elsewhere. ''; }; + mountAsSource = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + If `configLink.enable` is true, embed the config dir in the build. + A GC-protected copy of the config is baked into the system closure + (via a derivation added to the system profile) instead of symlinking + to the live `~/nixos-setup/configs` checkout, making the config part + of the built system and reproducible. + ''; + }; }; }; }; @@ -65,14 +91,18 @@ in grim slurp satty - ]; + ] ++ (lib.optionals cfg.configLink.mountAsSource [ bakedHyprConfig ]); # Symlink ~/.config/hypr -> configs//hypr (host-specific). system.userActivationScripts.hyprlandConfig = lib.mkIf cfg.configLink.enable { text = skygUtils.makeHyperlinkScriptToConfigs { filePath = "${cfg.configName}/hypr"; targetPath = "hypr"; - configSource = "/home/${config.skyg.user.name}/nixos-setup/configs"; + configSource = + if cfg.configLink.mountAsSource then + "${bakedHyprConfig}" + else + "/home/${config.skyg.user.name}/nixos-setup/configs"; }; }; };