scripts can now be enabled or disabled by group and each script has it's own override enable option

This commit is contained in:
pagedmov
2024-11-01 22:30:31 -04:00
parent 99b13fd979
commit 36ec78ac3f
2 changed files with 60 additions and 52 deletions

View File

@@ -44,8 +44,8 @@
batConfig.enable = lib.mkDefault true; batConfig.enable = lib.mkDefault true;
# ./scripts # ./scripts
pagedmovScripts.enable = lib.mkDefault true; movScripts.enable = lib.mkDefault true;
pagedmovScripts.commandScripts.enable = lib.mkDefault true; movScripts.commandScripts.enable = lib.mkDefault true;
pagedmovScripts.hyprlandControls.enable = lib.mkDefault true; movScripts.hyprlandControls.enable = lib.mkDefault true;
pagedmovScripts.nixShortcuts.enable = lib.mkDefault true; movScripts.nixShortcuts.enable = lib.mkDefault true;
} }

View File

@@ -20,67 +20,75 @@
viconf = import ./commands/viconf.nix { inherit pkgs; }; viconf = import ./commands/viconf.nix { inherit pkgs; };
chscheme = import ./wm-controls/chscheme.nix { inherit pkgs; }; chscheme = import ./wm-controls/chscheme.nix { inherit pkgs; };
chpaper = import ./wm-controls/chpaper.nix { inherit pkgs; }; chpaper = import ./wm-controls/chpaper.nix { inherit pkgs; };
scriptOverride =
doc:
group:
name:
lib.mkEnableOption
"${doc}" // {
default = config.movScripts.enable && config.movScripts.${group}.enable;
};
in { in {
options = { options = {
pagedmovScripts.enable = lib.mkEnableOption "Enables all pagedmov's scripts"; movScripts.enable = lib.mkEnableOption "Enables all pagedmov's scripts";
# Enable or disable by group # Enable or disable by group
pagedmovScripts.commandScripts.enable = movScripts.commandScripts.enable =
lib.mkEnableOption "Enables all command scripts"; lib.mkEnableOption "Enables all command scripts";
pagedmovScripts.hyprlandControls.enable = movScripts.hyprlandControls.enable =
lib.mkEnableOption "Enables all Hyprland control scripts"; lib.mkEnableOption "Enables all Hyprland control scripts";
pagedmovScripts.nixShortcuts.enable = movScripts.nixShortcuts.enable =
lib.mkEnableOption "Enables all Nix shortcut scripts"; lib.mkEnableOption "Enables all Nix shortcut scripts";
# These options override individual scripts # Individual options using scriptOverride or mkEnableOption directly
pagedmovScripts.commandScripts.invoke.enable = movScripts.commandScripts.invoke.enable =
lib.mkDefault (config.pagedmovScripts.commandScripts.enable) // lib.mkEnableOption "Enables the invoke command"; scriptOverride "Enables the invoke command" "commandScripts" "invoke";
pagedmovScripts.commandScripts.runbg.enable = movScripts.commandScripts.runbg.enable =
lib.mkDefault (config.pagedmovScripts.commandScripts.enable) // lib.mkEnableOption "Enables the runbg command - written by FrostPhoenix"; scriptOverride "Enables the runbg command - written by FrostPhoenix" "commandScripts" "runbg";
pagedmovScripts.commandScripts.splash.enable = movScripts.commandScripts.splash.enable =
lib.mkDefault (config.pagedmovScripts.commandScripts.enable) // lib.mkEnableOption "Enables the splash screen when opening a terminal"; scriptOverride "Enables the splash screen when opening a terminal" "commandScripts" "splash";
pagedmovScripts.commandScripts.toolbelt.enable = movScripts.commandScripts.toolbelt.enable =
lib.mkDefault (config.pagedmovScripts.commandScripts.enable) // lib.mkEnableOption "Enables the toolbelt command"; scriptOverride "Enables the toolbelt command" "commandScripts" "toolbelt";
pagedmovScripts.commandScripts.viconf.enable = movScripts.commandScripts.viconf.enable =
lib.mkDefault (config.pagedmovScripts.commandScripts.enable) // lib.mkEnableOption "Enables the viconf command"; scriptOverride "Enables the viconf command" "commandScripts" "viconf";
pagedmovScripts.hyprlandControls.chpaper.enable = movScripts.hyprlandControls.chpaper.enable =
lib.mkDefault (config.pagedmovScripts.hyprlandControls.enable) // lib.mkEnableOption "Enables the chpaper command"; scriptOverride "Enables the chpaper command" "hyprlandControls" "chpaper";
pagedmovScripts.hyprlandControls.scheck.enable = movScripts.hyprlandControls.scheck.enable =
lib.mkDefault (config.pagedmovScripts.hyprlandControls.enable) // lib.mkEnableOption "Enables the scheck command"; scriptOverride "Enables the scheck command" "hyprlandControls" "scheck";
pagedmovScripts.hyprlandControls.chscheme.enable = movScripts.hyprlandControls.chscheme.enable =
lib.mkDefault (config.pagedmovScripts.hyprlandControls.enable) // lib.mkEnableOption "Enables the chscheme command"; scriptOverride "Enables the chscheme command" "hyprlandControls" "chscheme";
pagedmovScripts.hyprlandControls.keyring.enable = movScripts.hyprlandControls.keyring.enable =
lib.mkDefault (config.pagedmovScripts.hyprlandControls.enable) // lib.mkEnableOption "Enables the keyring command"; scriptOverride "Enables the keyring command" "hyprlandControls" "keyring";
pagedmovScripts.hyprlandControls.moveonscreen.enable = movScripts.hyprlandControls.moveonscreen.enable =
lib.mkDefault (config.pagedmovScripts.hyprlandControls.enable) // lib.mkEnableOption "Ensures floating windows remain on screen"; scriptOverride "Ensures floating windows remain on screen" "hyprlandControls" "moveonscreen";
pagedmovScripts.hyprlandControls.switchmon.enable = movScripts.hyprlandControls.switchmon.enable =
lib.mkDefault (config.pagedmovScripts.hyprlandControls.enable) // lib.mkEnableOption "Moves cursor to the center of the second monitor"; scriptOverride "Moves cursor to the center of the second monitor" "hyprlandControls" "switchmon";
pagedmovScripts.nixShortcuts.garbage-collect.enable = movScripts.nixShortcuts.garbage-collect.enable =
lib.mkDefault (config.pagedmovScripts.nixShortcuts.enable) // lib.mkEnableOption "Enables the garbage-collect script"; scriptOverride "Enables the garbage-collect script" "nixShortcuts" "garbage-collect";
pagedmovScripts.nixShortcuts.nsp.enable = movScripts.nixShortcuts.nsp.enable =
lib.mkDefault (config.pagedmovScripts.nixShortcuts.enable) // lib.mkEnableOption "Enables nsp as an alias for 'nix-shell -p'"; scriptOverride "Enables nsp as an alias for 'nix-shell -p'" "nixShortcuts" "nsp";
pagedmovScripts.nixShortcuts.rebuild.enable = movScripts.nixShortcuts.rebuild.enable =
lib.mkDefault (config.pagedmovScripts.nixShortcuts.enable) // lib.mkEnableOption "Enables rebuild as an alias for 'sudo nixos-rebuild switch'"; scriptOverride "Enables rebuild as an alias for 'sudo nixos-rebuild switch'" "nixShortcuts" "rebuild";
}; };
config = lib.mkIf config.pagedmovScripts.enable { config = lib.mkIf config.movScripts.enable {
home.packages = lib.optionals config.pagedmovScripts.commandScripts.invoke.enable [ invoke ] home.packages = lib.optionals config.movScripts.commandScripts.invoke.enable [ invoke ]
++ lib.optionals config.pagedmovScripts.commandScripts.runbg.enable [ runbg ] ++ lib.optionals config.movScripts.commandScripts.runbg.enable [ runbg ]
++ lib.optionals config.pagedmovScripts.commandScripts.splash.enable [ splash ] ++ lib.optionals config.movScripts.commandScripts.splash.enable [ splash ]
++ lib.optionals config.pagedmovScripts.commandScripts.toolbelt.enable [ toolbelt ] ++ lib.optionals config.movScripts.commandScripts.toolbelt.enable [ toolbelt ]
++ lib.optionals config.pagedmovScripts.commandScripts.viconf.enable [ viconf ] ++ lib.optionals config.movScripts.commandScripts.viconf.enable [ viconf ]
++ lib.optionals config.pagedmovScripts.hyprlandControls.chpaper.enable [ chpaper ] ++ lib.optionals config.movScripts.hyprlandControls.chpaper.enable [ chpaper ]
++ lib.optionals config.pagedmovScripts.hyprlandControls.scheck.enable [ scheck ] ++ lib.optionals config.movScripts.hyprlandControls.scheck.enable [ scheck ]
++ lib.optionals config.pagedmovScripts.hyprlandControls.chscheme.enable [ chscheme ] ++ lib.optionals config.movScripts.hyprlandControls.chscheme.enable [ chscheme ]
++ lib.optionals config.pagedmovScripts.hyprlandControls.keyring.enable [ keyring ] ++ lib.optionals config.movScripts.hyprlandControls.keyring.enable [ keyring ]
++ lib.optionals config.pagedmovScripts.hyprlandControls.moveonscreen.enable [ moveonscreen ] ++ lib.optionals config.movScripts.hyprlandControls.moveonscreen.enable [ moveonscreen ]
++ lib.optionals config.pagedmovScripts.hyprlandControls.switchmon.enable [ switchmon ] ++ lib.optionals config.movScripts.hyprlandControls.switchmon.enable [ switchmon ]
++ lib.optionals config.pagedmovScripts.nixShortcuts.garbage-collect.enable [ garbage-collect ] ++ lib.optionals config.movScripts.nixShortcuts.garbage-collect.enable [ garbage-collect ]
++ lib.optionals config.pagedmovScripts.nixShortcuts.nsp.enable [ nsp ] ++ lib.optionals config.movScripts.nixShortcuts.nsp.enable [ nsp ]
++ lib.optionals config.pagedmovScripts.nixShortcuts.rebuild.enable [ rebuild ]; ++ lib.optionals config.movScripts.nixShortcuts.rebuild.enable [ rebuild ];
}; };
} }