Files
Nomarchy/modules/home/scripts.nix
Bernardo Magri cfd5e4bb65 feat(core): migrate system state to unified declarative JSON
- Consolidate all configuration toggles (suspend, idle, waybar, etc.) into ~/.config/home-manager/state.json
- Introduce nomarchy.toggles and nomarchy.hyprland options in Nix
- Inject toggle states into all bin/ scripts via environment variables
- Update toggle scripts to mutate JSON and trigger background rebuilds
- Add a migration script to transition legacy flag files to the new format
2026-04-04 10:11:09 +01:00

65 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
cp -r * $out/bin/
chmod +x $out/bin/*
# 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 ];
}