nix/home/scripts.nix
Harivansh Rathi 0aab0a4d61
Some checks failed
quality / changes (push) Successful in 2s
quality / Flake Check (push) Failing after 1s
quality / Nix Format Check (push) Failing after 1s
quality / Deploy netty (push) Has been skipped
ci: drop darwin shims, rebuild locally on netty runner
- remove macOS-era `sudo mkdir /Users/rathi/...` shim steps from flake-check
  and nix-format (Linux runner, paths don't exist, gitea-runner has no sudo)
- deploy-netty now runs `sudo nixos-rebuild switch --flake .#netty` directly
  on the runner (it *is* netty), no SSH, no `just switch-netty`
- grant gitea-runner NOPASSWD sudo for nixos-rebuild only
- apply current nixfmt to home/scripts.nix, hermes-gateway.nix, devshells.nix

Made-with: Cursor
2026-04-18 22:33:25 -04:00

57 lines
2.2 KiB
Nix

{
config,
lib,
pkgs,
hostConfig,
...
}:
let
customScripts = import ../scripts { inherit config lib pkgs; };
in
{
home.packages =
builtins.attrValues customScripts.commonPackages
++ lib.optionals hostConfig.isDarwin (builtins.attrValues customScripts.darwinPackages);
home.activation.initializeThemeState = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
${customScripts.themeAssetsText}
mkdir -p "${customScripts.theme.paths.stateDir}" \
"${customScripts.theme.paths.fzfDir}" \
"${customScripts.theme.paths.ghosttyDir}" \
"${customScripts.theme.paths.tmuxDir}" \
"${customScripts.theme.paths.lazygitDir}" \
"${customScripts.theme.wallpapers.dir}"
if [[ -f "${customScripts.theme.paths.stateFile}" ]]; then
mode=$(tr -d '[:space:]' < "${customScripts.theme.paths.stateFile}")
else
mode="${customScripts.theme.defaultMode}"
fi
mode="$(theme_normalize_mode "$mode")"
printf '%s\n' "$mode" > "${customScripts.theme.paths.stateFile}"
theme_load_mode_assets "$mode"
ln -sfn "$THEME_FZF_TARGET" "${customScripts.theme.paths.fzfCurrentFile}"
ln -sfn "$THEME_GHOSTTY_TARGET" "${customScripts.theme.paths.ghosttyCurrentFile}"
ln -sfn "$THEME_TMUX_TARGET" "${customScripts.theme.paths.tmuxCurrentFile}"
ln -sfn "$THEME_LAZYGIT_TARGET" "${customScripts.theme.paths.lazygitCurrentFile}"
${lib.optionalString hostConfig.isDarwin ''
lg_darwin="${config.home.homeDirectory}/Library/Application Support/lazygit"
mkdir -p "$lg_darwin"
ln -sfn "$THEME_DARWIN_LAZYGIT_TARGET" "$lg_darwin/config.yml"
''}
# seed wallpapers from static assets if no generated ones exist yet
if [[ ! -f "${customScripts.theme.wallpapers.dark}" ]]; then
cp "${customScripts.theme.wallpapers.staticDark}" "${customScripts.theme.wallpapers.dark}"
fi
if [[ ! -f "${customScripts.theme.wallpapers.light}" ]]; then
cp "${customScripts.theme.wallpapers.staticLight}" "${customScripts.theme.wallpapers.light}"
fi
# ensure wallpaper symlink points to active mode
ln -sfn "$THEME_WALLPAPER" "${customScripts.theme.wallpapers.current}"
'';
}