From decc865d5149ab0e7efa7821271d6b4668f403f4 Mon Sep 17 00:00:00 2001 From: Adam0 Date: Sat, 4 Jul 2026 00:46:03 +0200 Subject: [PATCH] add a test --- LICENSE | 21 +++ assets/hylix-infra-sample.lua | 198 +++++++++++++++++++++++++++ modules/tests.nix | 246 ++++++++++++++++++++++++++++++++++ modules/treefmt.nix | 1 + 4 files changed, 466 insertions(+) create mode 100644 LICENSE create mode 100644 assets/hylix-infra-sample.lua create mode 100644 modules/tests.nix diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2a592aa --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Adam0 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/assets/hylix-infra-sample.lua b/assets/hylix-infra-sample.lua new file mode 100644 index 0000000..915a3f9 --- /dev/null +++ b/assets/hylix-infra-sample.lua @@ -0,0 +1,198 @@ +-- settings +hl.config({ + debug = { + suppress_errors = true, + watchdog_timeout = 0, + }, + decoration = { + active_opacity = 0.95, + blur = { + input_methods = true, + passes = 2, + popups = true, + size = 16, + }, + inactive_opacity = 0.95, + rounding = 0, + }, + dwindle = { + preserve_split = true, + special_scale_factor = 0.8, + }, + ecosystem = { + enforce_permissions = true, + no_donation_nag = true, + no_update_news = true, + }, + general = { + gaps_in = 4, + gaps_out = 4, + hover_icon_on_border = false, + }, + input = { + accel_profile = "flat", + kb_options = "caps:swapescape", + mouse_refocus = false, + touchdevice = { + enable = false, + }, + }, + misc = { + disable_hyprland_logo = true, + disable_splash_rendering = true, + enable_swallow = true, + force_default_wallpaper = 0, + initial_workspace_tracking = 2, + render_unfocused_fps = 1, + swallow_regex = "^com\\.mitchellh\\.ghostty$", + vrr = 1, + }, + plugin = { + hyprfocus = { + keyboard_focus_animation = "shrink", + mouse_focus_animation = "shrink", + shrink_percentage = 0.995, + }, + }, + xwayland = { + force_zero_scaling = true, + }, +}) + +-- monitors +hl.monitor({ + mode = "1920x1080@144", + output = "DP-1", + position = "-1920x96", + scale = 1, + vrr = 0, +}) +hl.monitor({ + mode = "1920x1080@60", + output = "eDP-1", + position = "0x0", + scale = 1, +}) + +-- animations.curves +hl.curve("fadeGeneric", { + points = { + { + 0.0, + 0.0, + }, + { + 0.2, + 1.0, + }, + }, + type = "bezier", +}) +hl.curve("springWindow", { + dampening = 12, + mass = 1, + stiffness = 45, + type = "spring", +}) + +-- animations.animations +hl.curve("hylix_windows_springWindow", { + dampening = 30.0, + mass = 1, + stiffness = 281.25, + type = "spring", +}) +hl.animation({ + bezier = "fadeGeneric", + enabled = true, + leaf = "fade", + speed = 3.03, +}) +hl.animation({ + enabled = true, + leaf = "windows", + speed = 4, + spring = "hylix_windows_springWindow", + style = "popin", +}) + +-- rules.window +hl.window_rule({ + float = true, + match = { + class = "steam", + title = "Friends List", + }, + size = { + 380, + 540, + }, +}) +hl.window_rule({ + center = true, + float = true, + match = { + class = "me.iepure.devtoolbox", + }, + size = { + 1130, + 750, + }, +}) + +-- rules.layer +hl.layer_rule({ + blur = true, + blur_popups = true, + ignore_alpha = 0.94, + match = { + namespace = "overzicht", + }, +}) + +-- permissions +hl.permission({ + binary = ".*/libhyprfocus\\.so$", + mode = "allow", + type = "plugin", +}) +hl.permission({ + binary = "/nix/store/example-grim/bin/grim", + mode = "allow", + type = "screencopy", +}) + +-- gestures +hl.gesture({ + action = "workspace", + direction = "horizontal", + fingers = 3, +}) +hl.gesture({ + action = "exec", + direction = "pinchout", + exec = "overzicht ipc call overview close", + fingers = 3, +}) + +local MAX_ZOOM = 3 +local MIN_ZOOM = 1 + +local function zoom_reset() + hl.config({ cursor = { zoom_factor = MIN_ZOOM } }) +end + +-- binds +-- 1. Applications +hl.bind("SUPER + Return", hl.dsp.exec_cmd("runapp ghostty --initial-window=false +new-window"), { + description = "Terminal", +}) +-- 2. Window Management +hl.bind("SUPER + SHIFT + minus", zoom_reset, { + description = "Reset zoom", +}) +hl.bind("SUPER + V", hl.dsp.window.float({ + action = "toggle", +}), { + description = "Toggle floating", +}) diff --git a/modules/tests.nix b/modules/tests.nix new file mode 100644 index 0000000..d456394 --- /dev/null +++ b/modules/tests.nix @@ -0,0 +1,246 @@ +{ + config, + inputs, + ... +}: { + perSystem = {system, ...}: let + inherit (inputs.nixpkgs) lib; + inherit (lib) mkOrder; + + pkgs = inputs.nixpkgs.legacyPackages.${system}; + hylixLib = config.flake.lib; + + generatedConfig = + (lib.evalModules { + modules = [ + config.flake.modules.generic.hylix + { + programs.hylix = { + _generatedConfig = mkOrder 899 '' + local MAX_ZOOM = 3 + local MIN_ZOOM = 1 + + local function zoom_reset() + hl.config({ cursor = { zoom_factor = MIN_ZOOM } }) + end + ''; + + animations = { + animations = [ + { + leaf = "fade"; + enabled = true; + speed = 3.03; + bezier = "fadeGeneric"; + } + + { + leaf = "windows"; + enabled = true; + speed = 4; + spring = "springWindow"; + style = "popin"; + } + ]; + + curves = { + fadeGeneric = { + type = "bezier"; + points = [0.00 0.00 0.20 1.00]; + }; + + springWindow = { + type = "spring"; + mass = 1; + stiffness = 45; + dampening = 12; + }; + }; + }; + + bindGroups = [ + (hylixLib.mkHylixBindGroup "Applications" [ + { + description = "Terminal"; + keys = ["SUPER" "Return"]; + exec = "runapp ghostty --initial-window=false +new-window"; + } + ]) + + (hylixLib.mkHylixBindGroup "Window Management" [ + { + description = "Reset zoom"; + keys = ["SUPER" "SHIFT" "minus"]; + lua = "zoom_reset"; + } + + { + description = "Toggle floating"; + keys = ["SUPER" "V"]; + action = "window.float"; + args.action = "toggle"; + } + ]) + ]; + + gestures = [ + { + direction = "horizontal"; + fingers = 3; + action = "workspace"; + } + + { + direction = "pinchout"; + fingers = 3; + action = "exec"; + exec = "overzicht ipc call overview close"; + } + ]; + + monitors = [ + { + output = "DP-1"; + mode = "1920x1080@144"; + position = "-1920x96"; + scale = "1"; + extra.vrr = 0; + } + + { + output = "eDP-1"; + mode = "1920x1080@60"; + position = "0x0"; + scale = "1"; + } + ]; + + permissions = [ + { + binary = ".*/libhyprfocus\\.so$"; + mode = "allow"; + type = "plugin"; + } + + { + binary = "/nix/store/example-grim/bin/grim"; + mode = "allow"; + type = "screencopy"; + } + ]; + + rules = { + layer = [ + { + match.namespace = "overzicht"; + blur = true; + blur_popups = true; + ignore_alpha = 0.94; + } + ]; + + window = [ + { + match = { + class = "steam"; + title = "Friends List"; + }; + + float = true; + size = [380 540]; + } + + { + match.class = "me.iepure.devtoolbox"; + center = true; + float = true; + size = [1130 750]; + } + ]; + }; + + settings = { + debug = { + suppress_errors = true; + watchdog_timeout = 0; + }; + + decoration = { + active_opacity = 0.95; + inactive_opacity = 0.95; + rounding = 0; + + blur = { + input_methods = true; + popups = true; + passes = 2; + size = 16; + }; + }; + + dwindle = { + preserve_split = true; + special_scale_factor = 0.8; + }; + + ecosystem = { + enforce_permissions = true; + no_donation_nag = true; + no_update_news = true; + }; + + general = { + gaps_in = 4; + gaps_out = 4; + hover_icon_on_border = false; + }; + + input = { + accel_profile = "flat"; + kb_options = "caps:swapescape"; + mouse_refocus = false; + touchdevice.enable = false; + }; + + misc = { + disable_hyprland_logo = true; + disable_splash_rendering = true; + enable_swallow = true; + force_default_wallpaper = 0; + initial_workspace_tracking = 2; + render_unfocused_fps = 1; + swallow_regex = "^com\\.mitchellh\\.ghostty$"; + vrr = 1; + }; + + plugin.hyprfocus = { + keyboard_focus_animation = "shrink"; + mouse_focus_animation = "shrink"; + shrink_percentage = 0.995; + }; + + xwayland.force_zero_scaling = true; + }; + }; + } + ]; + }) + .config + .programs + .hylix + ._generatedConfig; + + expectedConfig = ../assets/hylix-infra-sample.lua; + in { + checks.hylix-infra-sample-config = + pkgs.runCommand "hylix-infra-sample-config" { + inherit expectedConfig generatedConfig; + nativeBuildInputs = [pkgs.diffutils]; + passAsFile = ["generatedConfig"]; + } '' + diff -u "$expectedConfig" "$generatedConfigPath" + + cp "$generatedConfigPath" "$out" + ''; + }; +} diff --git a/modules/treefmt.nix b/modules/treefmt.nix index b5410c4..8f95370 100644 --- a/modules/treefmt.nix +++ b/modules/treefmt.nix @@ -20,6 +20,7 @@ # keep-sorted start ".direnv/*" ".envrc" + "assets/hylix-infra-sample.lua" "flake.nix" # keep-sorted end ]; -- 2.51.2