34 lines
1.8 KiB
Bash
34 lines
1.8 KiB
Bash
#!/usr/bin/env bash
|
|
# Evaluate profile boundaries without installing or switching a desktop.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
for profile in full full-work headless; do
|
|
nix eval --impure --json ".#homeConfigurations.$profile.config" --apply 'c: {
|
|
packages = map (p: p.pname or p.name) c.home.packages;
|
|
activities = if c.dotfiles.gui then builtins.fromJSON c.xdg.configFile."dotfiles/activities.json".text else null;
|
|
theme = if c.dotfiles.gui then c.programs.plasma.configFile.kdeglobals.Sounds.Theme.value else null;
|
|
vesktop = builtins.hasAttr ".var/app/dev.vencord.Vesktop/config/vesktop/settings.json" c.home.file;
|
|
}' | jq -e --arg p "$profile" '
|
|
if $p == "full" then
|
|
(.packages | index("codex") != null and index("defguard-client") != null and index("build-sound-theme") != null) and
|
|
(.activities.activities | keys == ["Personal", "Work"]) and .theme == "portal2" and .vesktop
|
|
elif $p == "full-work" then
|
|
(.packages | index("codex") == null and index("defguard-client") == null and index("build-sound-theme") == null and index("notification-sounds") != null) and
|
|
(.activities.activities | keys == ["Work"]) and .activities.workOnly and .theme == "ocean" and (.vesktop | not)
|
|
else (.packages | index("codex") == null) and .activities == null end
|
|
'
|
|
done
|
|
# Exercise the same manifest selector used by apps and doctor in an isolated HOME.
|
|
export HOME="$(mktemp -d)"
|
|
trap 'rm -rf "$HOME"' EXIT
|
|
export DOTFILES_DIR="$PWD"
|
|
source <(sed '$d' bin/dot)
|
|
cmd_profile full-work
|
|
work_apps="$(flatpak_apps)"
|
|
! rg -q '^(com.google.Chrome|org.telegram.desktop|dev.vencord.Vesktop|org.kde.krita)$' <<<"$work_apps"
|
|
rg -q '^com.microsoft.Edge$' <<<"$work_apps"
|
|
cmd_profile full
|
|
full_apps="$(flatpak_apps)"
|
|
rg -q '^com.google.Chrome$' <<<"$full_apps"
|
|
echo 'Profile checks passed'
|