rebuild nix files
This commit is contained in:
@@ -1,52 +1,24 @@
|
||||
# home/desktop/hyprscrolling.nix (Home-Manager module)
|
||||
# home/desktop/hyprscrolling.nix (Home-Manager module)
|
||||
{ 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;
|
||||
repoConf = flakeRoot + "/assets/conf/desktop/hypr/hyprscrolling.conf";
|
||||
targetRel = "hypr/conf.d/90-hyprscrolling.conf";
|
||||
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.
|
||||
options.programs.hyprscrolling.enable =
|
||||
lib.mkEnableOption "hyprscrolling Hyprland plugin";
|
||||
config = lib.mkIf cfg.enable {
|
||||
wayland.windowManager.hyprland = {
|
||||
# the key part: load plugin like you did for hyprshell
|
||||
plugins = [ pkgs.hyprlandPlugins.hyprscrolling ];
|
||||
# source the generated drop-in
|
||||
extraConfig = lib.mkAfter ''
|
||||
source = ~/.config/${targetRel}
|
||||
'';
|
||||
};
|
||||
# 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 file’s contents
|
||||
environment.etc."hypr/conf.d/90-hyprscrolling.conf".text = dropInConf;
|
||||
# place your repo config into ~/.config/hypr/conf.d/...
|
||||
xdg.configFile."${targetRel}".source = repoConf;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user