Support Selkies bootstrap and native Fedora profile apps
This commit is contained in:
1 parent
95ca15b2c6
commit
f13397cf45
6 files changed
+139
-11
No files matched your search
@@ -117,6 +117,14 @@ Apps that write their own settings (Claude Code, pi, Vesktop, Konsole profiles,
|
||||
- **Defguard VPN** (home lab, `vpn.godemperordoge.org`): the desktop client is repackaged from the official `.deb` in `pkgs/defguard-client.nix`, so it runs natively on SteamOS (no WebKitGTK 4.1 there). `dot system` installs its root service (`config/defguard/defguard-service.service`, group `defguard`, a `resolvconf` → `resolvectl` shim where needed). Setup tokens are single-use and expire in 24 h, so Bitwarden holds a Defguard **API token** instead: create one in Defguard (your profile → *API tokens*) once, `dot secrets set DEFGUARD_API_TOKEN`, then on each new machine run `dot defguard` from home or over the VPN. It mints a fresh token and writes `~/.local/share/net.defguard/provisioning.json`, and the app sets itself up on its next start; you only sign in with Doge Home Lab.
|
||||
- **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`.
|
||||
|
||||
## Selkies / Fedora containers
|
||||
|
||||
Bootstrap exports a missing `USER` from `id -un` and enables Nix flakes even when Nix is already installed. Container detection supports Podman, Docker and the `container` environment variable. Containers skip Flatpaks, distrobox setup, and host VPN daemon setup.
|
||||
|
||||
On Fedora containers, `dot apps` automatically installs the selected desktop profile natively. On a Fedora desktop, use `dot apps --native` to select the same path explicitly. Fedora RPMs are installed with DNF; apps unavailable in the enabled repositories fall back to Nix using this repo's pinned nixpkgs input. Re-running skips Nix packages already installed. Run `dot apps --native` again after updating inputs to install newer Nix app versions; old profile entries can be removed with `nix profile remove`.
|
||||
|
||||
The mapping is in `config/fedora-apps.tsv`, filtered through the same profile selection as Flatpaks. Flatseal is skipped because it manages Flatpaks; Aurynk is skipped with a warning because no native package is configured. Native app failures are reported and return a nonzero status. Native mode requires sudo for RPMs and a working Nix installation. Non-Fedora containers skip desktop app installation with an explanation. `DOTFILES_SKIP_SYSTEM=1` skips the bootstrap system layer; it does not prevent explicit native app installation from using sudo.
|
||||
|
||||
## Testing
|
||||
|
||||
`tests/container-test.sh IMAGE PROFILE` runs the bootstrap from scratch in a throwaway Podman container, copying in the current checkout:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
# dot — manage this dev environment. Run `dot help`.
|
||||
export USER=${USER:-$(id -un)}
|
||||
set -euo pipefail
|
||||
|
||||
DOTFILES_DIR="${DOTFILES_DIR:-$HOME/.dotfiles}"
|
||||
@@ -23,7 +24,7 @@ have() { command -v "$1" >/dev/null 2>&1; }
|
||||
|
||||
os_id() { (. /etc/os-release 2>/dev/null && echo "${ID:-unknown}") || echo unknown; }
|
||||
has_systemd() { [ -d /run/systemd/system ]; }
|
||||
in_container() { [ -f /run/.containerenv ] || [ -f /.dockerenv ]; }
|
||||
in_container() { [ -f /run/.containerenv ] || [ -f /.dockerenv ] || [ -n "${container:-}" ]; }
|
||||
|
||||
source_nix() {
|
||||
have nix && return 0
|
||||
@@ -81,6 +82,8 @@ cmd_profile() {
|
||||
|
||||
# ---------------------------------------------------------------- nix
|
||||
cmd_nix() {
|
||||
mkdir -p "$HOME/.config/nix"
|
||||
grep -q flakes "$HOME/.config/nix/nix.conf" 2>/dev/null || echo "experimental-features = nix-command flakes" >>"$HOME/.config/nix/nix.conf"
|
||||
if source_nix; then ok "nix $(nix --version | awk '{print $NF}') present"; return; fi
|
||||
local os; os="$(os_id)"
|
||||
if [ "$os" = steamos ] || ! has_systemd || in_container; then
|
||||
@@ -98,8 +101,6 @@ cmd_nix() {
|
||||
curl -fsSL https://install.determinate.systems/nix | sh -s -- install --no-confirm
|
||||
fi
|
||||
source_nix || die "nix installed but not on PATH; open a new shell and re-run"
|
||||
mkdir -p "$HOME/.config/nix"
|
||||
grep -q flakes "$HOME/.config/nix/nix.conf" 2>/dev/null || echo "experimental-features = nix-command flakes" >>"$HOME/.config/nix/nix.conf"
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------- home-manager
|
||||
@@ -119,6 +120,15 @@ cmd_switch() {
|
||||
# ---------------------------------------------------------------- distro layer (sudo)
|
||||
install_pkgs() {
|
||||
local os; os="$(os_id)"
|
||||
if in_container; then
|
||||
case "$os" in
|
||||
fedora|almalinux|rhel|rocky) SUDO dnf install -y zsh git curl xz ;;
|
||||
arch|cachyos|endeavouros|manjaro) SUDO pacman -Sy --needed --noconfirm zsh git curl xz ;;
|
||||
debian|ubuntu) SUDO apt-get update && SUDO apt-get install -y zsh git curl xz-utils ;;
|
||||
*) warn "install zsh, git, curl and xz in this container" ;;
|
||||
esac
|
||||
return
|
||||
fi
|
||||
case "$os" in
|
||||
steamos) return 0 ;; # read-only /usr; SteamOS already ships zsh, podman, distrobox, flatpak, Konsole
|
||||
fedora)
|
||||
@@ -185,8 +195,12 @@ 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
|
||||
is_desktop && netbird=1
|
||||
[ "$(profile)" = full ] && defguard=1
|
||||
if in_container; then
|
||||
netbird=0; defguard=0
|
||||
elif is_desktop; then
|
||||
netbird=1
|
||||
fi
|
||||
if ! in_container && [ "$(profile)" = full ]; then defguard=1; fi
|
||||
step "distro layer for $(os_id) (needs sudo)"
|
||||
[ $skip_pkgs = 1 ] || install_pkgs
|
||||
if is_desktop; then
|
||||
@@ -206,8 +220,46 @@ cmd_system() {
|
||||
# ---------------------------------------------------------------- user apps
|
||||
flatpak_has() { flatpak info "$1" >/dev/null 2>&1; }
|
||||
|
||||
native_apps() {
|
||||
[ "$(os_id)" = fedora ] || die "native desktop apps currently require Fedora"
|
||||
source_nix || die "Nix is required for apps unavailable as Fedora RPMs (dot nix)"
|
||||
local app rpm attr entry store_path
|
||||
local failed=() skipped=()
|
||||
while read -r app; do
|
||||
entry="$(awk -F '|' -v app="$app" '$1 == app { print; exit }' "$DOTFILES_DIR/config/fedora-apps.tsv")"
|
||||
[ -n "$entry" ] || { failed+=("$app (no native mapping)"); continue; }
|
||||
IFS='|' read -r app rpm attr <<<"$entry"
|
||||
# Flatseal only manages Flatpaks; Aurynk currently has no packaged native build.
|
||||
if [ "$rpm" = - ] && [ "$attr" = - ]; then skipped+=("$app"); continue; fi
|
||||
if [ "$rpm" != - ] && SUDO dnf install -y "$rpm"; then continue; fi
|
||||
if [ "$attr" != - ]; then
|
||||
store_path="$(NIXPKGS_ALLOW_UNFREE=1 nix eval --impure --raw --inputs-from "$DOTFILES_DIR" "nixpkgs#$attr.outPath")" || { failed+=("$app"); continue; }
|
||||
if nix profile list --json | jq -e --arg path "$store_path" '[.elements[].storePaths[]] | index($path) != null' >/dev/null; then continue; fi
|
||||
NIXPKGS_ALLOW_UNFREE=1 nix profile install --impure --inputs-from "$DOTFILES_DIR" "nixpkgs#$attr" || failed+=("$app")
|
||||
else
|
||||
failed+=("$app")
|
||||
fi
|
||||
done < <(flatpak_apps)
|
||||
[ ${#skipped[@]} -eq 0 ] || warn "Native install skips Flatseal (Flatpak-only) and Aurynk (no native package): ${skipped[*]}"
|
||||
seed_xpipe
|
||||
if [ ${#failed[@]} -gt 0 ]; then warn "Native apps failed: ${failed[*]}"; return 1; fi
|
||||
}
|
||||
|
||||
cmd_apps() {
|
||||
if is_desktop && have flatpak; then
|
||||
local native=0
|
||||
case "${1:-}" in
|
||||
--native) native=1 ;;
|
||||
"") in_container && native=1 ;;
|
||||
*) die "usage: dot apps [--native]" ;;
|
||||
esac
|
||||
if is_desktop && [ "$native" = 1 ]; then
|
||||
if [ "$(os_id)" = fedora ]; then
|
||||
native_apps
|
||||
else
|
||||
warn "Skipping container desktop apps: native installation currently supports Fedora; Flatpaks are disabled in containers"
|
||||
fi
|
||||
fi
|
||||
if is_desktop && [ "$native" = 0 ] && ! in_container && have flatpak; then
|
||||
step "Flatpaks (user scope)"
|
||||
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
local missing=()
|
||||
@@ -248,6 +300,7 @@ seed_xpipe() {
|
||||
}
|
||||
|
||||
cmd_boxes() {
|
||||
if in_container; then ok "skipping distrobox inside a container"; return; fi
|
||||
have distrobox || die "distrobox missing (dot system)"
|
||||
distrobox assemble create --file "$HOME/.config/distrobox/distrobox.ini"
|
||||
}
|
||||
@@ -581,7 +634,7 @@ cmd_update() {
|
||||
source_nix && nix flake update --flake "$DOTFILES_DIR"
|
||||
fi
|
||||
cmd_switch
|
||||
is_desktop && have flatpak && { step "flatpak update"; flatpak update --user -y --noninteractive || true; }
|
||||
is_desktop && ! in_container && 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
|
||||
@@ -600,23 +653,27 @@ cmd_doctor() {
|
||||
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"
|
||||
if ! in_container; then
|
||||
chk "podman" "have podman" "dot system"
|
||||
chk "distrobox" "have distrobox" "dot system"
|
||||
fi
|
||||
chk "ssh key" "[ -f ~/.ssh/id_ed25519 ]" "dot secrets pull"
|
||||
chk "secrets.env" "[ -s $SECRETS_ENV ]" "dot secrets pull"
|
||||
if is_desktop; then
|
||||
if ! in_container; 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 < <(flatpak_apps)
|
||||
fi
|
||||
[ "$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/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"
|
||||
chk "netbird daemon" "systemctl is-active netbird" "dot system --netbird"
|
||||
if ! in_container; then chk "netbird daemon" "systemctl is-active netbird" "dot system --netbird"; fi
|
||||
else
|
||||
chk "day/night daemons (XDG autostart)" "pgrep -f daynight-hooks" "log in to Plasma"
|
||||
fi
|
||||
@@ -654,7 +711,7 @@ dot — portable dev environment
|
||||
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
|
||||
dot apps [--native] profile apps (native on Fedora containers), mise tools, Claude Code
|
||||
dot secrets status|push|pull|add|set|render Bitwarden-backed tokens, keys, files, WireGuard
|
||||
dot defguard [--force] preconfigure the Defguard VPN app (one-time token minted with DEFGUARD_API_TOKEN)
|
||||
dot wallpapers [--push] sort wallpapers into light/dark (or clone them)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
# https://gitea.godemperordoge.org/ziadarafat/dotfiles/raw/branch/main/bootstrap.sh | bash
|
||||
#
|
||||
# Options (env): DOTFILES_PROFILE=full|full-work|headless, DOTFILES_SKIP_SYSTEM=1 (no sudo), DOTFILES_REF=main
|
||||
export USER=${USER:-$(id -un)}
|
||||
set -euo pipefail
|
||||
|
||||
REPO="https://gitea.godemperordoge.org/ziadarafat/dotfiles.git"
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# Flatpak ID | Fedora RPM (or -) | nixpkgs fallback attribute (or -)
|
||||
dev.zed.Zed|-|zed-editor
|
||||
com.vscodium.codium|-|vscodium
|
||||
org.kde.kate|kate|kdePackages.kate
|
||||
com.usebruno.Bruno|-|bruno
|
||||
com.bitwarden.desktop|-|bitwarden-desktop
|
||||
com.github.tchx84.Flatseal|-|-
|
||||
com.microsoft.Edge|-|microsoft-edge
|
||||
com.google.Chrome|-|google-chrome
|
||||
org.chromium.Chromium|chromium|chromium
|
||||
org.mozilla.firefox|firefox|firefox
|
||||
org.telegram.desktop|telegram-desktop|telegram-desktop
|
||||
dev.vencord.Vesktop|-|vesktop
|
||||
org.gimp.GIMP|gimp|gimp
|
||||
org.kde.krita|krita|krita
|
||||
org.blender.Blender|blender|blender
|
||||
com.obsproject.Studio|obs-studio|obs-studio
|
||||
org.kde.kdenlive|kdenlive|kdePackages.kdenlive
|
||||
org.videolan.VLC|vlc|vlc
|
||||
io.mpv.Mpv|mpv|mpv
|
||||
org.kde.okular|okular|kdePackages.okular
|
||||
org.libreoffice.LibreOffice|libreoffice|libreoffice
|
||||
org.kde.filelight|filelight|kdePackages.filelight
|
||||
io.github.IshuSinghSE.aurynk|-|-
|
||||
|
@@ -26,6 +26,9 @@ lib.mkIf config.dotfiles.gui {
|
||||
"${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/vesktop/settings.json".source = link "config/vesktop/vesktop.json";
|
||||
".config/vesktop/settings/settings.json".source = link "config/vesktop/vencord.json";
|
||||
".config/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";
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
export DOTFILES_DIR="$PWD"
|
||||
export HOME="$(mktemp -d)"
|
||||
trap 'rm -rf "$HOME"' EXIT
|
||||
unset USER
|
||||
source <(sed '$d' bin/dot)
|
||||
[ "$USER" = "$(id -un)" ]
|
||||
source_nix() { return 0; }
|
||||
nix() { echo 'nix (Nix) test'; }
|
||||
cmd_nix
|
||||
grep -qx 'experimental-features = nix-command flakes' "$HOME/.config/nix/nix.conf"
|
||||
cmd_nix
|
||||
[ "$(wc -l < "$HOME/.config/nix/nix.conf")" = 1 ]
|
||||
in_container() { return 0; }
|
||||
os_id() { echo fedora; }
|
||||
SUDO() { printf '%s\n' "$*" >>"$HOME/system-calls"; }
|
||||
install_pkgs
|
||||
! rg -q 'flatpak|distrobox|podman' "$HOME/system-calls"
|
||||
cmd_boxes
|
||||
cmd_profile full-work
|
||||
native_apps() { echo native >>"$HOME/apps-calls"; }
|
||||
flatpak() { echo flatpak >>"$HOME/apps-calls"; return 1; }
|
||||
mise() { :; }
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
touch "$HOME/.local/bin/claude"
|
||||
chmod +x "$HOME/.local/bin/claude"
|
||||
cmd_apps
|
||||
[ "$(cat "$HOME/apps-calls")" = native ]
|
||||
# Every declared app has a mapping, including explicitly unsupported apps.
|
||||
while read -r app; do
|
||||
awk -F '|' -v app="$app" '$1 == app { found=1 } END { exit !found }' config/fedora-apps.tsv
|
||||
done < <(flatpak_apps)
|
||||
echo 'Webtop checks passed'
|
||||
Reference in new issue
Block a user