Initial: Nix flake reproducing MacBook capabilities on x86_64 NixOS
- pi coding agent (from sscoble/pi-mono Forgejo mirror) - qmd vault search (via bunx @tobilu/qmd) - zsh + oh-my-zsh + developer tooling - home-manager config for sscoble user - Forgejo Action to check pi version drift daily
This commit is contained in:
commit
8155b9b64c
5 changed files with 461 additions and 0 deletions
106
flake.nix
Normal file
106
flake.nix
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
{
|
||||
description = "Scobleclaw laptop — NixOS configuration reproducing MacBook software capabilities on x86_64";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
pi-mono = {
|
||||
url = "git+https://os.scoble.me/forgejo/sscoble/pi-mono.git";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, home-manager, pi-mono, ... }@inputs: let
|
||||
# System we're targeting (x86_64 NixOS laptop)
|
||||
system = "x86_64-linux";
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ self.overlays.default ];
|
||||
};
|
||||
in {
|
||||
# Overlay — add pi and qmd to nixpkgs
|
||||
overlays.default = final: prev: {
|
||||
# pi coding agent — built from Forgejo mirror of pi-mono
|
||||
pi-coding-agent = final.buildNpmPackage {
|
||||
pname = "pi-coding-agent";
|
||||
version = "0.73.0";
|
||||
src = pi-mono;
|
||||
npmDepsHash = ""; # Set after first build: nix-build outputs the correct hash
|
||||
npmWorkspace = "packages/coding-agent";
|
||||
npmFlags = [ "--legacy-peer-deps" ];
|
||||
dontNpmBuild = true;
|
||||
preConfigure = ''
|
||||
# Build dependencies first (monorepo workspace order)
|
||||
cd packages/ai && npm run build && cd ../..
|
||||
cd packages/agent && npm run build && cd ../..
|
||||
cd packages/tui && npm run build && cd ../..
|
||||
cd packages/coding-agent && npm run build && cd ../..
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $out/lib/node_modules/@mariozechner/pi-coding-agent
|
||||
cp -r packages/coding-agent/dist $out/lib/node_modules/@mariozechner/pi-coding-agent/
|
||||
cp packages/coding-agent/package.json $out/lib/node_modules/@mariozechner/pi-coding-agent/
|
||||
mkdir -p $out/bin
|
||||
cat > $out/bin/pi <<'EOF'
|
||||
#!/usr/bin/env bash
|
||||
exec ${final.nodejs}/bin/node $out/lib/node_modules/@mariozechner/pi-coding-agent/dist/cli.js "$@"
|
||||
EOF
|
||||
chmod +x $out/bin/pi
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
|
||||
# qmd — vault search tool, wraps npm package via bun
|
||||
qmd = final.writeShellScriptBin "qmd" ''
|
||||
exec ${final.bun}/bin/bunx --bun @tobilu/qmd "$@"
|
||||
'';
|
||||
|
||||
# Pi config directory structure (without secrets)
|
||||
pi-config-dir = final.runCommand "pi-config-dir" {} ''
|
||||
mkdir -p $out
|
||||
# Placeholder — real config should be restored from backup
|
||||
echo "# Pi agent configuration" > $out/README.md
|
||||
echo "# Defaults" > $out/settings.json
|
||||
'';
|
||||
};
|
||||
|
||||
# NixOS configuration for the laptop
|
||||
nixosConfigurations.laptop = nixpkgs.lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = [
|
||||
home-manager.nixosModules.home-manager
|
||||
./modules/laptop.nix
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.sscoble = import ./home/sscoble.nix;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Standalone dev shell for trying things out
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
pi-coding-agent
|
||||
qmd
|
||||
nodejs
|
||||
bun
|
||||
git
|
||||
zsh
|
||||
];
|
||||
shellHook = ''
|
||||
echo "🦞 Scobleclaw laptop dev shell"
|
||||
echo " pi: $(which pi)"
|
||||
echo " qmd: $(which qmd)"
|
||||
echo " node: $(node --version)"
|
||||
echo " bun: $(bun --version)"
|
||||
echo " git: $(git --version)"
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue