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, ... }:
|
{ config, lib, pkgs, flakeRoot, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.programs.hyprscrolling;
|
cfg = config.programs.hyprscrolling;
|
||||||
defaultPluginPkg = (pkgs.hyprlandPlugins.hyprscrolling or null);
|
repoConf = flakeRoot + "/assets/conf/desktop/hypr/hyprscrolling.conf";
|
||||||
# Stable paths (avoid pinning /nix/store/... in your hyprland.conf)
|
targetRel = "hypr/conf.d/90-hyprscrolling.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
|
in
|
||||||
{
|
{
|
||||||
options.programs.hyprscrolling = {
|
options.programs.hyprscrolling.enable =
|
||||||
enable = lib.mkEnableOption "Hyprland hyprscrolling (scrolling layout) plugin (NixOS-friendly)";
|
lib.mkEnableOption "hyprscrolling Hyprland plugin";
|
||||||
pluginPackage = lib.mkOption {
|
config = lib.mkIf cfg.enable {
|
||||||
type = lib.types.nullOr lib.types.package;
|
wayland.windowManager.hyprland = {
|
||||||
default = defaultPluginPkg;
|
# the key part: load plugin like you did for hyprshell
|
||||||
description = ''
|
plugins = [ pkgs.hyprlandPlugins.hyprscrolling ];
|
||||||
Package that provides the hyprscrolling plugin.
|
# source the generated drop-in
|
||||||
Defaults to pkgs.hyprlandPlugins.hyprscrolling when available.
|
extraConfig = lib.mkAfter ''
|
||||||
|
source = ~/.config/${targetRel}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
# Where we install the generated config snippet (so you can `source = ...` it)
|
# place your repo config into ~/.config/hypr/conf.d/...
|
||||||
dropInPath = lib.mkOption {
|
xdg.configFile."${targetRel}".source = repoConf;
|
||||||
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;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user