From c88237e9d2a9fc7a92543698c12ed60d7db1c6e4 Mon Sep 17 00:00:00 2001 From: Ziad Arafat Date: Fri, 30 Oct 2026 11:00:15 -0600 Subject: [PATCH] Fix pokefetch ordering, writable mise config, autostart fallback for daemons, README Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013UzjWUxheYfqqjWGH7Ktmc --- README.md | 102 ++++++++++++++++++++++++++++++++++++++++ bin/dot | 4 +- config/mise/config.toml | 14 ++++++ home/dev.nix | 19 +------- home/gui/daynight.nix | 37 ++++++++++----- home/shell.nix | 5 +- 6 files changed, 149 insertions(+), 32 deletions(-) create mode 100644 README.md create mode 100644 config/mise/config.toml diff --git a/README.md b/README.md new file mode 100644 index 0000000..d58d8e9 --- /dev/null +++ b/README.md @@ -0,0 +1,102 @@ +# dotfiles + +A reproducible dev environment for the Steam Deck (SteamOS), Fedora KDE, Arch and CachyOS. Almost everything lives in `$HOME`, so a SteamOS update that wipes `/usr` and `/etc` can't break it. Re-running `dot system` puts back the few root-owned pieces. + +| Layer | Tool | Lives in | +|---|---|---| +| CLI tools, shell, git, ssh, KDE config | Nix + home-manager (this flake) + plasma-manager | `/nix` (on SteamOS: `/home/.steamos/offload/nix`), `~` | +| Language runtimes + npm/GitHub CLIs | mise (`programs.mise.globalConfig`) | `~/.local/share/mise` | +| GUI apps | Flatpak, user scope (`config/flatpaks.txt`) | `~/.local/share/flatpak` | +| Secrets (SSH keys, MCP tokens, WireGuard) | Bitwarden CLI (`dot secrets`) | `~/.config/dotfiles/secrets.env`, `~/.ssh` | +| Root bits (distro pkgs, browser policies, netbird unit, login shell) | `dot system` (sudo) | `/etc` | + +```mermaid +flowchart LR + B[bootstrap.sh] --> P[distro pkgs
git curl zsh podman distrobox flatpak] + B --> N[Nix
single-user on SteamOS/containers
Determinate elsewhere] + N --> HM[home-manager switch
profile full | headless] + HM --> S[system: browser PWA policies,
netbird unit, chsh zsh] + S --> A[apps: Flatpaks, mise tools,
Claude Code] + A --> W[wallpapers repo] + A -. manual .-> SEC[dot secrets pull
Bitwarden] +``` + +## Install + +```bash +export GITEA_TOKEN=... # read access to ziadarafat/dotfiles + wallpapers +curl -fsSL -H "Authorization: token $GITEA_TOKEN" \ + https://gitea.godemperordoge.org/ziadarafat/dotfiles/raw/branch/main/bootstrap.sh | bash +``` + +| Env var | Effect | +|---|---| +| `DOTFILES_PROFILE=headless` | No KDE, Flatpaks, Konsole or themes (servers, SSH-only boxes, non-KDE desktops). Default: `full` when Plasma is present. | +| `DOTFILES_SKIP_SYSTEM=1` | Never call sudo. Everything in `$HOME` still works. | +| `DOTFILES_DIR` | Checkout location (default `~/.dotfiles`). | + +On SteamOS, the one sudo prompt makes `/nix` owned by `deck`. Nix then runs in single-user mode, with no daemon and no units in `/etc`. + +Then, once per machine: + +```bash +bw login && export BW_SESSION=$(bw unlock --raw) +dot secrets pull # ~/.ssh/id_ed25519, secrets.env, Claude/pi MCP config, ~/.git-credentials +dot secrets pull --wireguard # also import WireGuard connections into NetworkManager (sudo) +dot boxes # distrobox: general (Fedora), etv (AlmaLinux 10) +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. + +## Day to day + +| Command | What | +|---|---| +| `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 secrets push` | upload this machine's secrets.env, SSH keys and WireGuard configs to Bitwarden | +| `dot wallpapers --push` | re-sort the wallpapers from the external drive and push them | +| `dot sounds` | build the Portal 2 sound theme from your Steam install | +| `dot doctor` | what's installed or missing | + +Apps that write their own settings (Claude Code, pi, Vesktop, Konsole profiles, VSCodium, Zed, `~/.ssh/config`) are linked **out of the Nix store** into this checkout. Changes made in the app show up in `git diff`, so commit them. + +## What's in it + +- **Shell:** zsh + oh-my-zsh (`xiong-chiamiov-plus`, git, virtualenv, archlinux, autosuggestions, syntax highlighting), direnv + nix-direnv, fzf, btop. `fastfetch` shows a `pokemon-go-colorscripts` sprite: Rotom by default, in a form chosen by distro (Deck: normal, Fedora: fan, Arch/CachyOS: heat, Alma: frost, Debian: wash, other: mow), 10 % shiny. Override in `~/.config/dotfiles/local.zsh`: + ```zsh + POKEMON=pikachu POKEMON_SHINY_PERCENT=25 # or POKEFETCH=0 + ``` +- **Dev:** mise (node 24, uv, python 3.13, go, deno, java, pi, pokemon-go-colorscripts), git + lfs, tea, gh, bitwarden-cli, gitea-mcp, nmap, rclone, jq/yq, ripgrep/fd, netbird, XPipe (nixpkgs 24.6). Claude Code uses its native installer, so it keeps auto-updating. +- **Agents:** `config/claude/{settings.json,CLAUDE.md}` linked into `~/.claude`. MCP servers come from `config/claude/mcp.json` and `config/pi/mcp.json` templates with `${TOKEN}` placeholders, rendered by `dot secrets render`. +- **SSH:** `config/ssh/config` (all work and homelab hosts). Machine-only hosts go in `~/.ssh/config.local`. +- **Containers:** `config/distrobox/distrobox.ini`. Podman and distrobox come from the distro, and SteamOS ships both. +- **GUI (full profile):** + - Flatpaks: Zed, VSCodium, Kate, Bruno, Bitwarden, Edge, Chrome, Chromium, Firefox, Telegram, Vesktop, GIMP, Krita, Blender, OBS, Kdenlive, VLC, mpv, Okular, LibreOffice, Filelight, Aurynk, Flatseal. + - **PWAs** are force-installed by managed policies (`config/browsers/*-pwas.json` → `/etc/opt/{chrome,edge}/policies/managed`). Flathub's Chrome and Edge read those through `/run/host`. + - **Theme:** Utterly Nord, with two wrapper global themes (`dotfiles.nord.light` / `.dark`) that keep the Utterly colours, Round decorations, Tela-circle-nord icons and Nordic cursors, but use Breeze widgets (no Kvantum on SteamOS) and never touch the wallpaper. Plasma's automatic light/dark switching flips between them on the knighttime schedule. Night Light follows the same schedule (3700 K). + - **Accent colour from wallpaper** is on, so each slideshow change re-tints the UI. + - **Panel:** the Deck's layout plus four system monitors (per-core CPU bars, per-disk horizontal bars, network line graph, RAM ring with %) and a clock with Local, Arizona, Pacific, Central, Eastern, London and Beijing (scroll to cycle). + - **Activities:** *Personal* (Pokémon, 10 s slideshow) and *Work* (Ace Combat, 15 min slideshow). `daynight-hooks` points each at its `light/` or `dark/` folder as the theme flips, and also sets Konsole's default profile at login. + - **Konsole:** `Light` (Solarized Light) / `Dark` (Breeze) profiles switched by [konsole_daynight](https://github.com/RustyRaptor/konsole_daynight), packaged from source with Nix's PyGObject. `general` / `etv` profiles open the distroboxes. + - **Sounds:** `dot sounds` extracts Portal 2 sounds from your local Steam install (game assets stay out of git) into `~/.local/share/sounds/portal2`. Mapping: `config/sounds/portal2.json`. + +## Testing + +`tests/container-test.sh IMAGE PROFILE` runs the bootstrap from scratch in a throwaway Podman container, copying in the current checkout: + +```bash +tests/container-test.sh docker.io/archlinux:latest headless +tests/container-test.sh docker.io/cachyos/cachyos:latest headless +WEBTOP=1 tests/container-test.sh lscr.io/linuxserver/webtop:fedora-kde full webtop # KDE desktop at :3901 +``` + +## Gotchas + +- `home-manager switch` runs with `--impure`, because user, home and distro are read from the environment. That's how one flake serves `deck`, `abc` and `ziadarafat`. +- Flatpak doesn't work inside unprivileged containers (webtops). `dot apps` warns and moves on. +- Plasma only applies panel changes from plasma-manager at the next login. +- Managed browser policies show "Managed by your organization" in Chrome and Edge. That's expected. diff --git a/bin/dot b/bin/dot index 2f2b0f9..1dc396a 100755 --- a/bin/dot +++ b/bin/dot @@ -324,7 +324,9 @@ cmd_wallpapers() { fi elif [ ! -d "$WALLPAPER_DIR/.git" ]; then step "cloning wallpapers" - git clone --depth 1 "$WALLPAPER_REPO" "$WALLPAPER_DIR" || warn "wallpaper clone failed (dot secrets pull for git credentials?)" + 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?)" else git -C "$WALLPAPER_DIR" pull -q --ff-only || true fi diff --git a/config/mise/config.toml b/config/mise/config.toml new file mode 100644 index 0000000..708fae3 --- /dev/null +++ b/config/mise/config.toml @@ -0,0 +1,14 @@ +# Global mise tools. Linked (writable) from the dotfiles checkout, so `mise use -g` works and shows up in git. +[tools] +node = "24" +uv = "latest" +python = "3.13" +go = "latest" +deno = "latest" +java = "latest" +"npm:@earendil-works/pi-coding-agent" = "latest" +"github:scottmckendry/pokemon-go-colorscripts" = "latest" + +[settings] +experimental = true +idiomatic_version_file_enable_tools = ["python", "node"] diff --git a/home/dev.nix b/home/dev.nix index fe9de7c..c68f5e9 100644 --- a/home/dev.nix +++ b/home/dev.nix @@ -17,25 +17,8 @@ enable = true; enableZshIntegration = true; enableBashIntegration = true; - globalConfig = { - tools = { - node = "24"; - uv = "latest"; - python = "3.13"; - go = "latest"; - deno = "latest"; - java = "latest"; - "npm:@earendil-works/pi-coding-agent" = "latest"; - "github:scottmckendry/pokemon-go-colorscripts" = "latest"; - }; - settings = { - experimental = true; - # Avoid GitHub API rate limits in fresh containers. - github_attestations = false; - idiomatic_version_file_enable_tools = [ "python" "node" ]; - }; - }; }; + xdg.configFile."mise/config.toml".source = config.dotfiles.link "config/mise/config.toml"; # Rootful bits (podman, distrobox) come from the distro; distrobox.ini declares the boxes. xdg.configFile."distrobox/distrobox.ini".source = ../config/distrobox/distrobox.ini; diff --git a/home/gui/daynight.nix b/home/gui/daynight.nix index 36ea592..1333ceb 100644 --- a/home/gui/daynight.nix +++ b/home/gui/daynight.nix @@ -24,6 +24,11 @@ let exec ${pkgs.python3.withPackages (ps: [ ps.vpk ])}/bin/python ${../../scripts/build-sound-theme.py} "$@" ''; + daemons = { + konsole-daynight = "${konsole-daynight}/bin/konsole-daynight --light_profile Light --dark_profile Dark"; + daynight-hooks = "${daynight-hooks}/bin/daynight-hooks"; + }; + wallpapers = "${config.home.homeDirectory}/Pictures/Wallpapers"; userService = description: exec: { @@ -45,17 +50,27 @@ in lib.mkIf config.dotfiles.gui { home.packages = [ konsole-daynight daynight-hooks wallpaper-sort build-sound-theme ]; - xdg.configFile."dotfiles/activities.json".text = builtins.toJSON { - # First entry takes over the stock "Default" activity. - activities = { - Personal = { wallpapers = "${wallpapers}/personal"; interval = 10; }; - Work = { wallpapers = "${wallpapers}/work"; interval = 900; }; + xdg.configFile = { + "dotfiles/activities.json".text = builtins.toJSON { + # First entry (alphabetical) takes over the stock "Default" activity. + activities = { + Personal = { wallpapers = "${wallpapers}/personal"; interval = 10; }; + Work = { wallpapers = "${wallpapers}/work"; interval = 900; }; + }; + konsole = { light = "Light"; dark = "Dark"; }; }; - konsole = { light = "Light"; dark = "Dark"; }; - }; + } + # Sessions without systemd (webtops) start the daemons via XDG autostart instead. + // lib.mapAttrs' (name: exec: lib.nameValuePair "autostart/${name}.desktop" { + text = '' + [Desktop Entry] + Type=Application + Name=${name} + Exec=sh -c '[ -d /run/systemd/system ] || exec ${exec}' + X-KDE-autostart-phase=2 + NoDisplay=true + ''; + }) daemons; - systemd.user.services = { - konsole-daynight = userService "Konsole profile follows Plasma light/dark" "${konsole-daynight}/bin/konsole-daynight --light_profile Light --dark_profile Dark"; - daynight-hooks = userService "Activities + light/dark wallpaper folders follow Plasma" "${daynight-hooks}/bin/daynight-hooks"; - }; + systemd.user.services = lib.mapAttrs (name: exec: userService name exec) daemons; } diff --git a/home/shell.nix b/home/shell.nix index 03eae43..5b3755e 100644 --- a/home/shell.nix +++ b/home/shell.nix @@ -35,9 +35,10 @@ # Machine-local overrides (not in git): POKEMON, POKEMON_SHINY_PERCENT, aliases... [ -f "$HOME/.config/dotfiles/local.zsh" ] && source "$HOME/.config/dotfiles/local.zsh" '') - '' + # After mise activation (default order), which puts pokemon-go-colorscripts on PATH. + (lib.mkOrder 1500 '' source ${./files/pokefetch.zsh} - '' + '') ]; };