fix(nixos): build vendored pi independently
This commit was merged in pull request #124.
This commit is contained in:
@@ -6,7 +6,6 @@
|
|||||||
}:
|
}:
|
||||||
# rofi as the desktop launcher and dmenu-style menu frontend.
|
# rofi as the desktop launcher and dmenu-style menu frontend.
|
||||||
let
|
let
|
||||||
cfg = config.modules.desktop.session.rofi; # NOLINT(let_order)
|
|
||||||
user = config.user.name;
|
user = config.user.name;
|
||||||
|
|
||||||
# A session menu built on the same themed rofi, so the power actions look
|
# A session menu built on the same themed rofi, so the power actions look
|
||||||
@@ -26,7 +25,7 @@ in
|
|||||||
{
|
{
|
||||||
options.modules.desktop.session.rofi.enable = lib.mkEnableOption "the rofi launcher";
|
options.modules.desktop.session.rofi.enable = lib.mkEnableOption "the rofi launcher";
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf config.modules.desktop.session.rofi.enable {
|
||||||
home-manager.users.${user} = {
|
home-manager.users.${user} = {
|
||||||
# No theme is set here: Stylix's rofi target supplies the Nord one.
|
# No theme is set here: Stylix's rofi target supplies the Nord one.
|
||||||
programs.rofi = {
|
programs.rofi = {
|
||||||
@@ -35,7 +34,7 @@ in
|
|||||||
# Application launch is the only mode, kept minimal so the prompt opens
|
# Application launch is the only mode, kept minimal so the prompt opens
|
||||||
# as fast as rofi can read the desktop entries.
|
# as fast as rofi can read the desktop entries.
|
||||||
# Icons are off: resolving one per entry is the bulk of drun's startup.
|
# Icons are off: resolving one per entry is the bulk of drun's startup.
|
||||||
extraConfig = {
|
settings = {
|
||||||
modi = "drun";
|
modi = "drun";
|
||||||
show-icons = false;
|
show-icons = false;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,12 +8,7 @@
|
|||||||
# home-manager, which ships the package and manages global settings.
|
# home-manager, which ships the package and manages global settings.
|
||||||
# The login credential is left unmanaged, so it survives rebuilds.
|
# The login credential is left unmanaged, so it survives rebuilds.
|
||||||
let
|
let
|
||||||
cfg = config.modules.shell.pi; # NOLINT(let_order)
|
user = config.user.name; # NOLINT(let_order)
|
||||||
vendoredPi = pkgs.pi-coding-agent.overrideAttrs {
|
|
||||||
src = ../../../../../third_party/pi;
|
|
||||||
patches = [ ];
|
|
||||||
};
|
|
||||||
user = config.user.name;
|
|
||||||
piDir = "${config.users.users.${user}.home}/.pi/agent";
|
piDir = "${config.users.users.${user}.home}/.pi/agent";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -21,11 +16,83 @@ in
|
|||||||
enable = lib.mkEnableOption "Pi, a terminal coding agent, configured through home-manager";
|
enable = lib.mkEnableOption "Pi, a terminal coding agent, configured through home-manager";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf config.modules.shell.pi.enable {
|
||||||
home-manager.users.${user} = {
|
home-manager.users.${user} = {
|
||||||
programs.pi-coding-agent = {
|
programs.pi-coding-agent = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = vendoredPi;
|
package = pkgs.buildNpmPackage {
|
||||||
|
pname = "pi-coding-agent";
|
||||||
|
version = "0.85.1";
|
||||||
|
src = ../../../../../third_party/pi;
|
||||||
|
npmDepsHash = "sha256-jzlsZIQzfl1FCZZ5//dHFWwMfBZQ4nRD6KB4HHifPqE=";
|
||||||
|
npmWorkspace = "packages/coding-agent";
|
||||||
|
npmRebuildFlags = [ "--ignore-scripts" ];
|
||||||
|
dontNpmPrune = true;
|
||||||
|
|
||||||
|
preConfigure = ''
|
||||||
|
mkdir -p packages/ai/src/providers/data
|
||||||
|
tar --extract --gzip \
|
||||||
|
--file=${
|
||||||
|
pkgs.fetchurl {
|
||||||
|
url = "https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-0.85.1.tgz";
|
||||||
|
hash = "sha256-r30RmGF5RFzm/oizfVfeIvgjwP/TplyuMcVVt/XpklM=";
|
||||||
|
}
|
||||||
|
} \
|
||||||
|
--directory=packages/ai/src/providers/data \
|
||||||
|
--strip-components=4 \
|
||||||
|
package/dist/providers/data
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
runHook preBuild
|
||||||
|
npm run build:offline
|
||||||
|
runHook postBuild
|
||||||
|
'';
|
||||||
|
|
||||||
|
preInstall = ''
|
||||||
|
npm prune --omit=dev --no-save
|
||||||
|
'';
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
local nm="$out/lib/node_modules/pi-monorepo/node_modules"
|
||||||
|
|
||||||
|
for ws in @earendil-works/chord:packages/chord \
|
||||||
|
@earendil-works/pi-ai:packages/ai \
|
||||||
|
@earendil-works/pi-agent-core:packages/agent \
|
||||||
|
@earendil-works/pi-client:packages/client \
|
||||||
|
@earendil-works/pi-protocol:packages/protocol \
|
||||||
|
@earendil-works/pi-telemetry:packages/telemetry \
|
||||||
|
@earendil-works/pi-tui:packages/tui; do
|
||||||
|
IFS=: read -r pkg src <<< "$ws"
|
||||||
|
rm "$nm/$pkg"
|
||||||
|
cp -r "$src" "$nm/$pkg"
|
||||||
|
done
|
||||||
|
|
||||||
|
find "$nm" -type l -lname '*/packages/*' -delete
|
||||||
|
find "$nm/.bin" -xtype l -delete
|
||||||
|
'';
|
||||||
|
|
||||||
|
nativeBuildInputs = [ pkgs.makeBinaryWrapper ];
|
||||||
|
postFixup = ''
|
||||||
|
wrapProgram "$out/bin/pi" --prefix PATH : ${
|
||||||
|
lib.makeBinPath [
|
||||||
|
pkgs.ripgrep
|
||||||
|
pkgs.fd
|
||||||
|
]
|
||||||
|
} \
|
||||||
|
--set-default PI_SKIP_VERSION_CHECK 1 \
|
||||||
|
--set-default PI_TELEMETRY 0
|
||||||
|
'';
|
||||||
|
|
||||||
|
doInstallCheck = true;
|
||||||
|
nativeInstallCheckInputs = [
|
||||||
|
pkgs.writableTmpDirAsHomeHook
|
||||||
|
pkgs.versionCheckHook
|
||||||
|
];
|
||||||
|
versionCheckKeepEnvironment = [ "HOME" ];
|
||||||
|
versionCheckProgram = "${placeholder "out"}/bin/pi";
|
||||||
|
versionCheckProgramArg = "--version";
|
||||||
|
};
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
defaultProvider = "openai-codex";
|
defaultProvider = "openai-codex";
|
||||||
|
|||||||
Reference in New Issue
Block a user