Skip to content

feat(deps/bootstraps/installs/updates): Add Nix flake for cross-platform install + dev shell. PLEASE 🙏#1118

Closed
zitongcharliedeng wants to merge 1 commit into
danielmiessler:mainfrom
zitongcharliedeng:nix-flake
Closed

feat(deps/bootstraps/installs/updates): Add Nix flake for cross-platform install + dev shell. PLEASE 🙏#1118
zitongcharliedeng wants to merge 1 commit into
danielmiessler:mainfrom
zitongcharliedeng:nix-flake

Conversation

@zitongcharliedeng

@zitongcharliedeng zitongcharliedeng commented May 1, 2026

Copy link
Copy Markdown

FIXES ISSUES RELATED TO (i.e.):


I BEG YOU TO CONSIDER MR MIESSLER!

A big hole in PAI I've noticed whenever trying out your features (and
why I haven't moved from my personal lightweight Pi-Mono DA yet) is
the lack of idempotency. We have workarounds like LLM-driven adaptive
updates — but really, in your own words, determinism is the default
when we can make it so. It makes it easier for consumers and
developers to work on PAI together.

The current curl … | bash is presented as a one-line install but it
isn't really one. It leaves the prerequisite story to chance: the
script itself has to detect whether bun is present, offer to install
it, fall back gracefully when it isn't — all because the runtime
environment is whatever the user happens to have. That work shouldn't
live in a shell script. With Nix it disappears: bun, curl,
rsync, git, plus the FHS libs Electron needs, are all guaranteed
by the runtime — the installer doesn't have to ask, doesn't have to
offer, doesn't have to fall back. THAT'S a true one-line install.

This is also a forcing function for cleaner architecture. Once Nix is
the install path, node_modules/ can move into the immutable store
(out of ~/.claude/PAI/PAI-Install/electron/ and out of the user's
home), upgrades become atomic via nix flake update, rollback is one
command, and the whole "did the curl piped script run cleanly?"
question goes away — the closure is content-addressed and pinned in
flake.lock.


Journey is identical, only the bootstrap shrinks

The user experience from the inner installer onward — banners, DA
identity setup, voice, Pulse — is unchanged. The only differences are
in the outer bootstrap:

  • No step 1 (prereq check + "offer to install bun") — Nix guarantees
    bun, curl, rsync, git, bash, plus the FHS libs Electron needs.
  • No step 3 (fetch v5.0.0 tarball from GitHub) — the flake's source IS
    the source. Tarball download is redundant.
  • Step 2 (backup ~/.claude → ~/.claude.backup-{timestamp}) and step 4
    (place release at ~/.claude/) happen exactly the same way, just
    without the ▸ 2/5 / ▸ 4/5 ceremony around them.
  • Step 5 (handoff to ~/.claude/install.sh) — identical. Same wizard,
    same banner, same prompts.

What disappears is exactly the part that was leaving outcome to
chance — what the user happens to have installed, what their distro
ships by default, whether the bun installer succeeds non-interactively.

What this adds

A single new file (flake.nix) exposing:

  • nix run github:danielmiessler/Personal_AI_Infrastructure — installs
    PAI on any Nix-supporting system (macOS, regular Linux, NixOS, WSL)
    with one command, no prereq install, no curl | bash.
  • nix develop github:danielmiessler/Personal_AI_Infrastructure
    drops hackers into a shell with bun/curl/rsync/git/bash + (on Linux)
    the FHS libs PAI's bundled Electron GUI needs (libglib2, GTK, NSS,
    etc.).

Existing install paths (curl | bash, manual clone) are unchanged.

Why this PR exists

Non-Nix install paths today:

  • curl -sSL https://ourpai.ai/install.sh | bash — fails on NixOS at
    step 5/5 with libglib-2.0.so.0: cannot open shared object file
    because PAI's bundled Electron expects an FHS userspace.
  • README "Manual install" — same failure at the GUI launch.

The Nix flake wraps the install in pkgs.buildFHSEnv with
pkgs.appimageTools.defaultFhsEnvArgs (nixpkgs-curated, community-
maintained dep list for desktop Electron-shaped apps). No hand-rolled
library list, no per-distro install hints, no "On Debian/Ubuntu run
apt-get install …" branches. The FHS env covers any desktop Linux app
shape Electron might evolve into.

Forward-looking notes (not part of this PR)

  • The bootstrap that runs at https://ourpai.ai/install.sh is not in
    this repo — the README links to the live URL with no git history. If
    it lived in the repo (or was source-controlled somewhere visible),
    the install path would be auditable, the Nix flake could mirror it
    exactly, and the two paths could share code.
  • After this lands, a clean follow-up is moving node_modules/ and
    the bundled Electron into the Nix store at derivation-build time, so
    ~/.claude/PAI/ only contains user-mutable state (skills, agents,
    memory, DA identity, settings).

Tested

nix run --refresh github:zitongcharliedeng/PAI/nix-flake from a
sandbox HOME on NixOS:

  • FHS env activates, prereqs all visible at /nix/store/... paths
  • Backup-then-install steps execute (auto-mv ~/.claude →
    ~/.claude.backup-{timestamp}, then cp Releases/v5.0.0/.claude →
    ~/.claude)
  • Inner installer launches and reaches its CLI flow (Electron GUI not
    exercised in headless test, but FHS env is what fixes that case)

macOS not directly tested. Flake evaluates clean across all four
default systems; macOS branch is plain writeShellApplication with no
FHS wrap since Electron uses native frameworks there.

apps.default     —  nix run github:.../PAI
packages.default —  same, as a derivation
devShells.default — nix develop, FHS-shaped on Linux (incl. WSL),
                    plain mkShell on macOS

Linux uses pkgs.buildFHSEnv with appimageTools.defaultFhsEnvArgs so
the bundled Electron GUI installer finds its libs. The runScript
mirrors README 'Manual install': cp Releases/v5.0.0/.claude into
$HOME/.claude, then exec the bundled installer.
@zitongcharliedeng

zitongcharliedeng commented May 1, 2026

Copy link
Copy Markdown
Author

Made this as a compromise after seeing an immediate libc error when trying out PAI 5. It changes no underlying logic for now and solves installation, at least for me :)

Love what you're doing and just trying to help anyway I can without getting in the way of rapid iteration seeing this is a sharp alpha release ❤️

@zitongcharliedeng

Copy link
Copy Markdown
Author

It's a middle-ground since people can still choose to install imperatively through their Ubuntu's and Homebrews (🤮) and pollute their userspace with node modules and non-human intents, so at the very least this PR can just be thought as a developer shell for PAI.

@zitongcharliedeng

zitongcharliedeng commented May 1, 2026

Copy link
Copy Markdown
Author

I also have strong opinions about literate programming and how all code and markdown literature should be interleaved with one another and that this is the gateway into companies being an easily traversable wiki with state machines generated from the wiki itself aka a graph of algorithms.

Maybe one day I can refactor this into markdown...

@zitongcharliedeng zitongcharliedeng changed the title Add Nix flake for cross-platform install + dev shell feat(deps/bootstraps/installs/updates): Add Nix flake for cross-platform install + dev shell. PLEASE. May 1, 2026
@zitongcharliedeng zitongcharliedeng changed the title feat(deps/bootstraps/installs/updates): Add Nix flake for cross-platform install + dev shell. PLEASE. feat(deps/bootstraps/installs/updates): Add Nix flake for cross-platform install + dev shell. PLEASE 🙏 May 1, 2026
@danielmiessler

Copy link
Copy Markdown
Owner

Hey @zitongcharliedeng, thanks for raising this, and sorry it sat for a while.

We're changing how LifeOS ships. Instead of cloning a full ~/.claude directory and running it as a complete system, LifeOS is becoming a skill you install through an agentic installer. The installer hands integration to your own AI, which reads your actual machine (your OS, your paths, your harness) and wires the hooks and system prompt in where they belong.

That's aimed right at what you hit here. The old "one directory, one layout, hope it matches your setup" approach is exactly what broke for so many people, and the new model should handle it far better because your AI does the integration per machine instead of us guessing.

So we're closing this in prep for that release. If it still bites you once the skill-based version is out, reopen or file a fresh one and we'll jump on it. Appreciate you taking the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants