Files
Nomarchy/modules/home/scripts.nix
Bernardo Magri b27fc5aee8 refactor: major architectural restructure for theme-centric organization
Theme System:
- Move all theme app configs to apps/ subdirectory (20 themes)
- Add theme-loader.nix for dynamic theme config deployment
- Simplify stylix.nix to focus on base theming only

Override System:
- Add overrides.nix for file-based config overrides
- Add behavior-configs.nix for non-visual configuration
- Split hypr/nomarchy.conf into behavior vs visual sections

Module Improvements:
- Add lib.mkDefault to all customizable settings
- Add modules/lib/ with shared utilities and state schema
- Update all home and system modules for downstream overridability

Installer:
- New minimal TTY installer (installer/install.sh)
- Golden path: BTRFS + LUKS2 (disko-golden.nix)
- New installer-iso.nix for TTY-only installation
- Keep graphical installer as installerIsoGraphical option

Cleanup:
- Remove obsolete install.sh, disko-ext4.nix, install-nomarchy.sh
- Update live-iso.nix references
- Add .claude/ to .gitignore for local IDE settings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-11 19:38:27 +01:00

157 lines
3.9 KiB
Nix

{ config, pkgs, lib, ... }:
let
# Core dependencies needed by most scripts (minimal set)
coreDeps = with pkgs; [
coreutils
gnused
gnugrep
findutils
gawk
jq
];
# Category-specific dependencies
categoryDeps = with pkgs; {
appearance = [
swww
libnotify
];
apps = [
hyprland
libnotify
];
hardware = [
brightnessctl
playerctl
pamixer
pciutils
libnotify
];
system = [
gum
libnotify
curl
wget
];
utils = [
gum
hyprland
libnotify
wl-clipboard
grim
slurp
xmlstarlet
curl
wget
];
wm = [
hyprland
swayosd
libnotify
procps
];
};
# All dependencies combined (for scripts that might call others)
allDeps = coreDeps ++ (lib.unique (lib.flatten (builtins.attrValues categoryDeps)));
# Environment variables to inject
envVars = {
NOMARCHY_TOGGLE_SUSPEND = if config.nomarchy.toggles.suspend then "true" else "false";
NOMARCHY_TOGGLE_SCREENSAVER = if config.nomarchy.toggles.screensaver then "true" else "false";
NOMARCHY_TOGGLE_IDLE = if config.nomarchy.toggles.idle then "true" else "false";
NOMARCHY_TOGGLE_NIGHTLIGHT = if config.nomarchy.toggles.nightlight then "true" else "false";
NOMARCHY_TOGGLE_WAYBAR = if config.nomarchy.toggles.waybar then "true" else "false";
NOMARCHY_TOGGLE_SKIP_VSCODE_THEME = if config.nomarchy.toggles.skipVsCodeTheme then "true" else "false";
NOMARCHY_MONOSPACE_FONT = config.nomarchy.fonts.monospace;
};
# Build wrapper arguments for environment variables
envWrapperArgs = lib.concatStringsSep " " (
lib.mapAttrsToList (name: value: "--set ${name} \"${value}\"") envVars
);
nomarchy-scripts = pkgs.stdenv.mkDerivation {
pname = "nomarchy-scripts";
version = "1.0.0";
src = ../../bin;
nativeBuildInputs = [ pkgs.makeWrapper ];
installPhase = ''
mkdir -p $out/bin
# Copy scripts preserving directory structure for category detection
for category in appearance apps hardware system utils wm; do
if [ -d "$category" ]; then
for script in "$category"/*; do
if [ -f "$script" ]; then
cp "$script" "$out/bin/"
fi
done
fi
done
chmod +x $out/bin/*
patchShebangs $out/bin
'';
postFixup = ''
# Wrap scripts with category-specific dependencies
for file in $out/bin/*; do
if [ -f "$file" ]; then
scriptName=$(basename "$file")
# Determine category from original source location
category=""
for cat in appearance apps hardware system utils wm; do
if [ -f "$src/$cat/$scriptName" ]; then
category="$cat"
break
fi
done
# Select dependencies based on category
case "$category" in
appearance)
deps="${lib.makeBinPath (coreDeps ++ categoryDeps.appearance)}"
;;
apps)
deps="${lib.makeBinPath (coreDeps ++ categoryDeps.apps)}"
;;
hardware)
deps="${lib.makeBinPath (coreDeps ++ categoryDeps.hardware)}"
;;
system)
deps="${lib.makeBinPath (coreDeps ++ categoryDeps.system)}"
;;
utils)
deps="${lib.makeBinPath (coreDeps ++ categoryDeps.utils)}"
;;
wm)
deps="${lib.makeBinPath (coreDeps ++ categoryDeps.wm)}"
;;
*)
# Fallback to all deps for unknown categories
deps="${lib.makeBinPath allDeps}"
;;
esac
wrapProgram "$file" \
--prefix PATH : "$deps" \
${envWrapperArgs}
fi
done
'';
};
in
{
home.packages = [ nomarchy-scripts ];
}