Files
nixos/henrovnix_ok/home/desktop/hyprscrolling.nix
T
2026-02-25 15:45:12 +01:00

53 lines
2.1 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{ config, lib, pkgs, flakeRoot, ... }:
let
cfg = config.programs.hyprscrolling;
defaultPluginPkg = (pkgs.hyprlandPlugins.hyprscrolling or null);
# Stable paths (avoid pinning /nix/store/... in your hyprland.conf)
stableSoPath = "/etc/hypr/plugins/libhyprscrolling.so";
dropInConfPath = "/etc/hypr/conf.d/90-hyprscrolling.conf";
# Read drop-in config from your repo (flake root)
dropInConfSourcePath = flakeRoot + "/assets/conf/desktop/hypr/hyprscrolling.conf";
dropInConf = builtins.readFile dropInConfSourcePath;
in
{
options.programs.hyprscrolling = {
enable = lib.mkEnableOption "Hyprland hyprscrolling (scrolling layout) plugin (NixOS-friendly)";
pluginPackage = lib.mkOption {
type = lib.types.nullOr lib.types.package;
default = defaultPluginPkg;
description = ''
Package that provides the hyprscrolling plugin.
Defaults to pkgs.hyprlandPlugins.hyprscrolling when available.
'';
};
# Where we install the generated config snippet (so you can `source = ...` it)
dropInPath = lib.mkOption {
type = lib.types.str;
default = dropInConfPath;
description = "Path to the Hyprland drop-in config file (needs to be sourced by your hyprland.conf).";
};
# Where we install a stable symlink to the plugin .so
stablePluginSoPath = lib.mkOption {
type = lib.types.str;
default = stableSoPath;
description = "Stable path for the plugin shared object (symlinked to the Nix store).";
};
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = cfg.pluginPackage != null;
message = ''
Could not find hyprscrolling plugin package in this nixpkgs.
Set programs.hyprscrolling.pluginPackage explicitly (e.g. pkgs.hyprlandPlugins.hyprscrolling).
'';
}
];
environment.systemPackages = [ cfg.pluginPackage ];
environment.etc."hypr/plugins/libhyprscrolling.so".source =
"${cfg.pluginPackage}/lib/libhyprscrolling.so";
# Now /etc/hypr/conf.d/90-hyprscrolling.conf is exactly your files contents
environment.etc."hypr/conf.d/90-hyprscrolling.conf".text = dropInConf;
};
}