Files
Nomarchy/modules/home/scripts.nix

68 lines
1.8 KiB
Nix

{ config, pkgs, lib, ... }:
let
# Core dependencies needed by most Nomarchy scripts
nomarchy-deps = with pkgs; [
gum
hyprland
procps
libnotify
coreutils
gnused
gnugrep
pciutils
findutils
jq
swww
xmlstarlet
wl-clipboard
grim
slurp
brightnessctl
playerctl
pamixer
pulseaudio
wireplumber
swayosd
gawk
curl
wget
# Add any others commonly used in bin/
];
nomarchy-scripts = pkgs.stdenv.mkDerivation {
pname = "nomarchy-scripts";
version = "1.0.0";
src = ../../bin;
nativeBuildInputs = [ pkgs.makeWrapper ];
installPhase = ''
mkdir -p $out/bin
find . -type f -exec cp {} $out/bin/ \;
chmod +x $out/bin/*
patchShebangs $out/bin
'';
postFixup = ''
# Wrap every script to ensure dependencies are in PATH and inject configuration
for file in $out/bin/*; do
if [ -f "$file" ]; then
wrapProgram "$file" \
--prefix PATH : ${lib.makeBinPath nomarchy-deps} \
--set NOMARCHY_TOGGLE_SUSPEND "${if config.nomarchy.toggles.suspend then "true" else "false"}" \
--set NOMARCHY_TOGGLE_SCREENSAVER "${if config.nomarchy.toggles.screensaver then "true" else "false"}" \
--set NOMARCHY_TOGGLE_IDLE "${if config.nomarchy.toggles.idle then "true" else "false"}" \
--set NOMARCHY_TOGGLE_NIGHTLIGHT "${if config.nomarchy.toggles.nightlight then "true" else "false"}" \
--set NOMARCHY_TOGGLE_WAYBAR "${if config.nomarchy.toggles.waybar then "true" else "false"}" \
--set NOMARCHY_TOGGLE_SKIP_VSCODE_THEME "${if config.nomarchy.toggles.skipVsCodeTheme then "true" else "false"}" \
--set NOMARCHY_MONOSPACE_FONT "${config.nomarchy.fonts.monospace}"
fi
done
'';
};
in
{
home.packages = [ nomarchy-scripts ];
}