Add full-work desktop subset and personal Codex CLI

This commit is contained in:
Ziad Arafat committed 2026-11-13 13:20:49 -07:00
1 parent 5adea3ece7
commit 95ca15b2c6
11 files changed
+128 -27

No files matched your search

+26 -1
View File
@@ -55,6 +55,31 @@ dot doctor
Manual sign-ins that can't be automated: Edge (work account), Chrome and Firefox (personal account), XPipe (GitHub token for `RustyRaptor/xpipe-sync` on first launch), and the Bitwarden desktop app and browser extension. The extension comes back through browser sync.
## Desktop profiles
`full` is the personal desktop and includes Codex alongside Claude. Codex is managed by Nix and updated by `dot switch` after updating flake inputs. Sign in with `codex` on first use; credentials stay outside this repository.
`full-work` inherits the full desktop with these changes:
- Excludes Chrome and its managed PWAs, Telegram, Vesktop (including its settings), Krita, Defguard and the Portal 2 sound builder. Edge and its work PWAs remain.
- Uses only the Work activity and Ace Combat wallpapers, with light/dark switching. On login, other activities are removed. Wallpaper checkout uses sparse checkout to exclude the personal folder.
- Keeps notification sounds and volume feedback enabled with the default KDE Ocean sound theme.
- Excludes Codex; Claude remains available.
Apply on a desktop with:
```bash
dot profile full-work
dot switch
dot system
dot apps
dot wallpapers
```
Log out and back in to apply the activity layout. Flatpak installation is additive: switching an existing personal machine does not uninstall previously installed applications or games, or remove their data. A previously installed Defguard root service must be disabled separately. The profile does not install Portal 2 or require its assets.
For a fresh installation, set `DOTFILES_PROFILE=full-work`. `headless` remains the CLI-only profile. Run `bash tests/profiles.sh` to check the profile boundaries without applying them.
## Day to day
| Command | What |
@@ -62,7 +87,7 @@ Manual sign-ins that can't be automated: Edge (work account), Chrome and Firefox
| `dot update` | `git pull`, switch, `flatpak update`, `mise upgrade`, `claude update` |
| `dot update --inputs` | same, plus bump `flake.lock` (nixpkgs, home-manager, plasma-manager, konsole_daynight) |
| `dot switch` | apply after editing Nix files |
| `dot profile headless` / `full` / `auto` | switch layers; then `dot switch` |
| `dot profile headless` / `full` / `full-work` / `auto` | switch layers; then `dot switch` |
| `dot secrets push` | upload this machine's secrets.env, SSH keys and WireGuard configs to Bitwarden |
| `dot defguard` | preconfigure the Defguard VPN app for the home lab (see below) |
| `dot wallpapers --push` | re-sort the wallpapers from the external drive and push them |
+44 -17
View File
@@ -57,12 +57,25 @@ flake_attr() {
if [ "$p" = headless ] && [ "$(uname -m)" = aarch64 ]; then echo headless-aarch64; else echo "$p"; fi
}
is_desktop() { case "$(profile)" in full|full-work) return 0;; *) return 1;; esac; }
flatpak_apps() {
local app
while read -r app; do
[[ -z "$app" || "$app" == \#* ]] && continue
if [ "$(profile)" = full-work ]; then
case "$app" in com.google.Chrome|org.telegram.desktop|dev.vencord.Vesktop|org.kde.krita) continue;; esac
fi
printf '%s\n' "$app"
done <"$DOTFILES_DIR/config/flatpaks.txt"
}
cmd_profile() {
case "${1:-}" in
full|headless) echo "$1" >"$STATE_DIR/profile"; ok "profile set to $1 (run: dot switch)";;
full|full-work|headless) echo "$1" >"$STATE_DIR/profile"; ok "profile set to $1 (run: dot switch)";;
auto) rm -f "$STATE_DIR/profile"; ok "profile follows auto-detection ($(detect_profile))";;
"") echo "$(profile)$( [ -s "$STATE_DIR/profile" ] || echo ' (auto)')";;
*) die "usage: dot profile [full|headless|auto]";;
*) die "usage: dot profile [full|full-work|headless|auto]";;
esac
}
@@ -110,11 +123,11 @@ install_pkgs() {
steamos) return 0 ;; # read-only /usr; SteamOS already ships zsh, podman, distrobox, flatpak, Konsole
fedora)
local p=(zsh git curl podman distrobox flatpak)
[ "$(profile)" = full ] && p+=(konsole spectacle)
is_desktop && p+=(konsole spectacle)
SUDO dnf install -y "${p[@]}" ;;
arch|cachyos|endeavouros|manjaro)
local p=(zsh git curl podman distrobox flatpak xz)
[ "$(profile)" = full ] && p+=(konsole spectacle kate)
is_desktop && p+=(konsole spectacle kate)
SUDO pacman -Sy --needed --noconfirm "${p[@]}" ;;
almalinux|rhel|rocky)
SUDO dnf install -y zsh git curl podman flatpak ;;
@@ -127,6 +140,10 @@ install_pkgs() {
browser_policies() {
# Flathub Chrome/Edge merge host policies from /run/host/etc/opt/<browser>/policies.
for b in chrome edge; do
if [ "$b" = chrome ] && [ "$(profile)" = full-work ]; then
SUDO rm -f /etc/opt/chrome/policies/managed/dotfiles-pwas.json
continue
fi
SUDO install -d -m 0755 "/etc/opt/$b/policies/managed"
SUDO install -m 0644 "$DOTFILES_DIR/config/browsers/$b-pwas.json" "/etc/opt/$b/policies/managed/dotfiles-pwas.json"
done
@@ -168,10 +185,11 @@ defguard_service() {
cmd_system() {
local skip_pkgs=0 netbird=0 defguard=0
for a in "$@"; do case "$a" in --no-pkgs) skip_pkgs=1;; --netbird) netbird=1;; --defguard) defguard=1;; esac; done
[ "$(profile)" = full ] && { netbird=1; defguard=1; }
is_desktop && netbird=1
[ "$(profile)" = full ] && defguard=1
step "distro layer for $(os_id) (needs sudo)"
[ $skip_pkgs = 1 ] || install_pkgs
if [ "$(profile)" = full ]; then
if is_desktop; then
browser_policies
fi
[ $netbird = 1 ] && netbird_service
@@ -189,14 +207,14 @@ cmd_system() {
flatpak_has() { flatpak info "$1" >/dev/null 2>&1; }
cmd_apps() {
if [ "$(profile)" = full ] && have flatpak; then
if is_desktop && have flatpak; then
step "Flatpaks (user scope)"
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
local missing=()
while read -r app; do
[ -z "$app" ] || [[ "$app" == \#* ]] && continue
flatpak_has "$app" || missing+=("$app")
done <"$DOTFILES_DIR/config/flatpaks.txt"
done < <(flatpak_apps)
# One at a time: a single failure (e.g. Chrome's extra-data step inside an
# unprivileged container) would otherwise abort the whole batch.
local failed=()
@@ -462,7 +480,7 @@ cmd_wallpapers() {
if [ -d "$WALLPAPER_SRC_WORK" ] || [ -d "$WALLPAPER_SRC_PERSONAL" ]; then
have wallpaper-sort || die "wallpaper-sort missing (full profile)"
[ -d "$WALLPAPER_SRC_WORK" ] && wallpaper-sort "$WALLPAPER_SRC_WORK" "$WALLPAPER_DIR/work"
[ -d "$WALLPAPER_SRC_PERSONAL" ] && wallpaper-sort "$WALLPAPER_SRC_PERSONAL" "$WALLPAPER_DIR/personal"
[ "$(profile)" != full-work ] && [ -d "$WALLPAPER_SRC_PERSONAL" ] && wallpaper-sort "$WALLPAPER_SRC_PERSONAL" "$WALLPAPER_DIR/personal"
if [ -d "$WALLPAPER_DIR/.git" ] && [ "${1:-}" = --push ]; then
git -C "$WALLPAPER_DIR" add -A && git -C "$WALLPAPER_DIR" commit -qm "wallpapers: resort $(date -I)" && git -C "$WALLPAPER_DIR" push -q || true
fi
@@ -470,10 +488,17 @@ cmd_wallpapers() {
step "cloning wallpapers"
local auth=()
[ -n "${GITEA_TOKEN:-}" ] && auth=(-c "http.extraHeader=Authorization: token $GITEA_TOKEN")
git "${auth[@]}" clone --depth 1 "$WALLPAPER_REPO" "$WALLPAPER_DIR" || warn "wallpaper clone failed (dot secrets pull for git credentials?)"
git "${auth[@]}" clone --depth 1 --filter=blob:none --sparse "$WALLPAPER_REPO" "$WALLPAPER_DIR" || warn "wallpaper clone failed (dot secrets pull for git credentials?)"
else
git -C "$WALLPAPER_DIR" pull -q --ff-only || true
fi
if [ -d "$WALLPAPER_DIR/.git" ]; then
if [ "$(profile)" = full-work ]; then
git -C "$WALLPAPER_DIR" sparse-checkout set work
else
git -C "$WALLPAPER_DIR" sparse-checkout disable
fi
fi
have daynight-hooks && daynight-hooks --once >/dev/null 2>&1 || true
}
@@ -525,6 +550,7 @@ play_event() { # freedesktop sound name
}
cmd_sounds() {
[ "$(profile)" != full-work ] || die "full-work uses the default KDE sound theme; Portal 2 sounds are personal-only"
case "${1:-build}" in
build)
have build-sound-theme || die "build-sound-theme missing (full profile)"
@@ -555,7 +581,7 @@ cmd_update() {
source_nix && nix flake update --flake "$DOTFILES_DIR"
fi
cmd_switch
[ "$(profile)" = full ] && have flatpak && { step "flatpak update"; flatpak update --user -y --noninteractive || true; }
is_desktop && have flatpak && { step "flatpak update"; flatpak update --user -y --noninteractive || true; }
have mise && { step "mise upgrade"; mise upgrade -y || true; }
have claude && { step "claude update"; claude update || true; }
cmd_apps
@@ -572,20 +598,21 @@ cmd_doctor() {
chk "uv" "have uv || mise which uv" "dot apps"
chk "pi" "have pi || mise which pi" "dot apps"
chk "pokemon-go-colorscripts" "have pokemon-go-colorscripts || mise which pokemon-go-colorscripts" "dot apps"
[ "$p" != full ] || chk "codex" "have codex" "dot switch"
chk "claude" "[ -x ~/.local/bin/claude ]" "dot apps"
chk "podman" "have podman" "dot system"
chk "distrobox" "have distrobox" "dot system"
chk "ssh key" "[ -f ~/.ssh/id_ed25519 ]" "dot secrets pull"
chk "secrets.env" "[ -s $SECRETS_ENV ]" "dot secrets pull"
if [ "$p" = full ]; then
if is_desktop; then
chk "flatpak" "have flatpak" "dot system"
while read -r app; do
[ -z "$app" ] || [[ "$app" == \#* ]] && continue
chk "flatpak $app" "flatpak_has $app" "dot apps"
done <"$DOTFILES_DIR/config/flatpaks.txt"
chk "Chrome PWA policy" "[ -f /etc/opt/chrome/policies/managed/dotfiles-pwas.json ]" "dot system"
done < <(flatpak_apps)
[ "$p" != full ] || chk "Chrome PWA policy" "[ -f /etc/opt/chrome/policies/managed/dotfiles-pwas.json ]" "dot system"
chk "Edge PWA policy" "[ -f /etc/opt/edge/policies/managed/dotfiles-pwas.json ]" "dot system"
chk "wallpapers" "[ -d $WALLPAPER_DIR/personal ]" "dot wallpapers"
chk "wallpapers" "[ -d $WALLPAPER_DIR/work ]" "dot wallpapers"
if has_systemd; then
chk "konsole-daynight service" "systemctl --user is-active konsole-daynight" "dot switch, then log in to Plasma"
chk "daynight-hooks service" "systemctl --user is-active daynight-hooks" "dot switch, then log in to Plasma"
@@ -605,7 +632,7 @@ cmd_bootstrap() {
# The new profile puts mise & friends on PATH.
export PATH="$HOME/.nix-profile/bin:$HOME/.local/bin:$PATH"
cmd_apps
[ "$(profile)" = full ] && { cmd_wallpapers || true; }
is_desktop && { cmd_wallpapers || true; }
bw_server || true
cat <<EOF
@@ -624,7 +651,7 @@ dot — portable dev environment
dot bootstrap first-time setup (nix → system → switch → apps)
dot update [--inputs] pull repo, (bump flake inputs), switch, update flatpaks/mise/claude
dot switch [profile] apply the home-manager config
dot profile [full|headless|auto]
dot profile [full|full-work|headless|auto]
dot system [--netbird] [--defguard] sudo layer: distro packages, browser PWA policies, netbird, Defguard VPN service, login shell
dot nix install Nix if missing
dot apps Flatpaks, mise tools, Claude Code
+1 -1
View File
@@ -5,7 +5,7 @@
# curl -fsSL -H "Authorization: token $GITEA_TOKEN" \
# https://gitea.godemperordoge.org/ziadarafat/dotfiles/raw/branch/main/bootstrap.sh | bash
#
# Options (env): DOTFILES_PROFILE=full|headless, DOTFILES_SKIP_SYSTEM=1 (no sudo), DOTFILES_REF=main
# Options (env): DOTFILES_PROFILE=full|full-work|headless, DOTFILES_SKIP_SYSTEM=1 (no sudo), DOTFILES_REF=main
set -euo pipefail
REPO="https://gitea.godemperordoge.org/ziadarafat/dotfiles.git"
+3 -2
View File
@@ -43,7 +43,7 @@
nixpkgs.lib.removePrefix "ID=" (builtins.replaceStrings [ "\"" ] [ "" ] idLine);
mkHome =
{ system, gui }:
{ system, gui, work ? false }:
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
inherit system;
@@ -55,7 +55,7 @@
./home
{
home = { inherit username homeDirectory; };
dotfiles = { inherit gui; dir = dotfilesDir; };
dotfiles = { inherit gui work; dir = dotfilesDir; };
}
];
};
@@ -63,6 +63,7 @@
{
homeConfigurations = {
full = mkHome { system = "x86_64-linux"; gui = true; };
full-work = mkHome { system = "x86_64-linux"; gui = true; work = true; };
headless = mkHome { system = "x86_64-linux"; gui = false; };
headless-aarch64 = mkHome { system = "aarch64-linux"; gui = false; };
};
+3 -1
View File
@@ -1,10 +1,12 @@
{ config, ... }:
{ config, lib, pkgs, ... }:
let
link = config.dotfiles.link;
in
{
# Claude Code and pi install themselves (`dot apps`) so their auto-updaters keep working.
# Config is linked from the checkout so in-app edits show up in `git diff`.
home.packages = lib.optionals (config.dotfiles.gui && !config.dotfiles.work) [ pkgs.codex ];
home.file = {
".claude/settings.json".source = link "config/claude/settings.json";
".claude/CLAUDE.md".source = link "config/claude/CLAUDE.md";
+1
View File
@@ -13,6 +13,7 @@ in
];
options.dotfiles = {
work = lib.mkEnableOption "work-only desktop subset";
gui = lib.mkEnableOption "GUI layer (KDE Plasma, Flatpaks, Konsole, themes)";
dir = lib.mkOption {
type = lib.types.str;
+3 -1
View File
@@ -10,6 +10,7 @@ lib.mkIf config.dotfiles.gui {
# Defguard VPN client: its root service comes from `dot system`, its setup from `dot defguard`.
home.packages = [
pkgs.xpipe
] ++ lib.optionals (!config.dotfiles.work) [
(pkgs.callPackage ../../pkgs/defguard-client.nix { })
];
@@ -21,10 +22,11 @@ lib.mkIf config.dotfiles.gui {
XDG_DATA_DIRS=$HOME/.nix-profile/share:''${XDG_DATA_DIRS:-/usr/local/share:/usr/share}
'';
home.file = {
home.file = lib.optionalAttrs (!config.dotfiles.work) {
"${vesktop}/settings.json".source = link "config/vesktop/vesktop.json";
"${vesktop}/settings/settings.json".source = link "config/vesktop/vencord.json";
"${vesktop}/settings/quickCss.css".source = link "config/vesktop/quickCss.css";
} // {
".config/VSCodium/User/settings.json".source = link "config/vscodium/settings.json";
".config/zed/settings.json".source = link "config/zed/settings.json";
};
+5 -2
View File
@@ -49,14 +49,17 @@ let
};
in
lib.mkIf config.dotfiles.gui {
home.packages = [ konsole-daynight daynight-hooks wallpaper-sort build-sound-theme ];
home.packages = [ konsole-daynight daynight-hooks wallpaper-sort ]
++ lib.optionals (!config.dotfiles.work) [ build-sound-theme ];
xdg.configFile = {
"dotfiles/activities.json".text = builtins.toJSON {
# First entry (alphabetical) takes over the stock "Default" activity.
workOnly = config.dotfiles.work;
activities = {
Personal = { wallpapers = "${wallpapers}/personal"; interval = 10; };
Work = { wallpapers = "${wallpapers}/work"; interval = 900; };
} // lib.optionalAttrs (!config.dotfiles.work) {
Personal = { wallpapers = "${wallpapers}/personal"; interval = 10; };
};
konsole = { light = "Light"; dark = "Dark"; };
};
+1 -1
View File
@@ -38,7 +38,7 @@ lib.mkIf config.dotfiles.gui {
'';
programs.plasma.configFile = {
kdeglobals.Sounds.Theme = "portal2";
kdeglobals.Sounds.Theme = if config.dotfiles.work then "ocean" else "portal2";
# Volume slider clicks play audio-volume-change.
plasmaparc.General.AudioFeedback = true;
+8 -1
View File
@@ -84,7 +84,8 @@ for (const id of activities()) {
def ensure_activities(bus) -> None:
"""Create the configured activities; the stock "Default" one becomes the first."""
names = list(json.loads(CONFIG.read_text())["activities"])
cfg = json.loads(CONFIG.read_text())
names = list(cfg["activities"])
am = bus.get("org.kde.ActivityManager", "/ActivityManager/Activities")
existing = {am.ActivityName(i): i for i in am.ListActivities()}
for name in names:
@@ -94,6 +95,12 @@ def ensure_activities(bus) -> None:
am.SetActivityName(existing.pop("Default"), name)
else:
am.AddActivity(name)
if cfg.get("workOnly"):
existing = {am.ActivityName(i): i for i in am.ListActivities()}
am.SetCurrentActivity(existing["Work"])
for name, activity_id in existing.items():
if name != "Work":
am.RemoveActivity(activity_id)
def main() -> None:
+33
View File
@@ -0,0 +1,33 @@
#!/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'