Compare commits

...

2 Commits

Author SHA1 Message Date
af643c452d feat(pi): manage global subagent configuration 2026-08-02 07:04:28 -04:00
1e80216b07 feat(steam): add Steam desktop module 2026-08-02 00:05:45 -04:00
6 changed files with 194 additions and 14 deletions

View File

@@ -83,3 +83,8 @@ The domain model (Host, Module, Skeleton, Auto-loader, Enable convention, overla
- Pi's tool discovery checks `~/.pi/agent/bin` before `PATH`, and downloaded generic Linux binaries there can be unusable on NixOS with the stub-ld error.
This flake patches Pi to validate local tool binaries before selecting them, so it falls back to usable `fd`/`rg` from `PATH` instead.
Stale unpatched launchers are the remaining failure mode for broken `@` autocomplete.
- Nix flake evaluation ignores untracked files in this checkout.
Keep a new auto-loaded module staged or committed until it is removed, otherwise `nix flake check` and `nixos-rebuild --flake` evaluate without it and report its options as missing.
- The current Steam desktop client is an XWayland application.
Its CEF windows do not support Ozone and Steam composites them into an SDL surface with X11 extensions, so SDL Wayland selectors do not make the visible client native Wayland.
Keep fractional scaling sharp with Hyprland's `xwayland.force_zero_scaling` and Steam's own `STEAM_FORCE_DESKTOPUI_SCALING` instead.

View File

@@ -68,9 +68,11 @@
modules.agents.herdr.enable = true;
modules.agents.tools.gitea-axi.enable = true;
modules.agents.pi.enable = true;
modules.agents.pi.subagents.maxConcurrent = 8;
modules.desktop.enable = true;
modules.desktop.obsidian.enable = true;
modules.desktop.steam.enable = true;
time.timeZone = "America/New_York";
i18n.defaultLocale = "en_GB.UTF-8";

View File

@@ -11,6 +11,40 @@ let
cfg = config.modules.agents.pi;
user = config.user.name;
piDir = "${config.users.users.${user}.home}/.pi/agent";
reservedToolProfiles = [
"none"
"read-only"
"read-only-with-safe-bash"
"full-tools"
];
subagentsConfig =
lib.optionalAttrs (cfg.subagents.defaultContext != null) {
defaultContext = cfg.subagents.defaultContext;
}
// lib.optionalAttrs (cfg.subagents.defaultTools != null) {
defaultTools = cfg.subagents.defaultTools;
}
// lib.optionalAttrs (cfg.subagents.maxConcurrent != null) {
maxConcurrent = cfg.subagents.maxConcurrent;
}
// lib.optionalAttrs (cfg.subagents.recentTerminalTtlMs != null) {
recentTerminalTtlMs = cfg.subagents.recentTerminalTtlMs;
}
// lib.optionalAttrs (
cfg.subagents.ui.enabled != null || cfg.subagents.ui.defaultExpanded != null
) {
ui =
lib.optionalAttrs (cfg.subagents.ui.enabled != null) {
enabled = cfg.subagents.ui.enabled;
}
// lib.optionalAttrs (cfg.subagents.ui.defaultExpanded != null) {
defaultExpanded = cfg.subagents.ui.defaultExpanded;
};
}
// lib.optionalAttrs (cfg.subagents.toolProfiles != { }) {
toolProfiles = cfg.subagents.toolProfiles;
};
subagentsJson = (pkgs.formats.json { }).generate "pi-subagents.json" subagentsConfig;
patchedPi = pkgs.pi-coding-agent.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [
./patches/pi-flex-spacer.patch
@@ -39,10 +73,112 @@ let
};
in
{
options.modules.agents.pi.enable = lib.mkEnableOption ''
Pi, a terminal coding agent, configured via home-manager'';
options.modules.agents.pi = {
enable = lib.mkEnableOption ''
Pi, a terminal coding agent, configured via home-manager'';
subagents = {
defaultContext = lib.mkOption {
type = lib.types.nullOr (lib.types.enum [
"independent"
"fork"
]);
default = null;
description = ''
Default context mode for subagents.
Left null, the extension keeps its in-code default.
'';
};
defaultTools = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
example = "read-only-with-safe-bash";
description = ''
Default tool profile for subagents.
Left null, the extension keeps its in-code default.
'';
};
maxConcurrent = lib.mkOption {
type = lib.types.nullOr lib.types.ints.positive;
default = null;
example = 4;
description = ''
Maximum number of child processes allowed to run concurrently.
Left null, the extension keeps its in-code default.
'';
};
recentTerminalTtlMs = lib.mkOption {
type = lib.types.nullOr lib.types.ints.unsigned;
default = null;
example = 600000;
description = ''
Milliseconds to retain terminal subagents in the recent work set.
Zero disables time-based retention.
Left null, the extension keeps its in-code default.
'';
};
ui = {
enabled = lib.mkOption {
type = lib.types.nullOr lib.types.bool;
default = null;
description = ''
Whether the extension renders its built-in subagent monitor.
Left null, the extension keeps its in-code default.
'';
};
defaultExpanded = lib.mkOption {
type = lib.types.nullOr lib.types.bool;
default = null;
description = ''
Whether the built-in subagent monitor starts expanded.
Left null, the extension keeps its in-code default.
'';
};
};
toolProfiles = lib.mkOption {
type = lib.types.attrsOf (
lib.types.submodule {
options.activeTools = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "Pi tools made available to a child using this profile.";
};
}
);
default = { };
example = {
review = {
activeTools = [
"read"
"grep"
"find"
"ls"
];
};
};
description = ''
Custom named tool profiles for subagents.
The extension's reserved built-in profile names cannot be redefined.
'';
};
};
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = lib.intersectLists reservedToolProfiles (
builtins.attrNames cfg.subagents.toolProfiles
) == [ ];
message = "modules.agents.pi.subagents.toolProfiles may not redefine the reserved profiles: ${lib.concatStringsSep ", " reservedToolProfiles}.";
}
];
home-manager.users.${user} = {
programs.pi-coding-agent = {
enable = true;
@@ -58,21 +194,29 @@ in
};
};
home.file = {
# The first declarative rollout replaces the interactive settings file.
# Login state stays in auth.json, which this module does not manage.
"${piDir}/settings.json".force = true;
home.file =
{
# The first declarative rollout replaces the interactive settings file.
# Login state stays in auth.json, which this module does not manage.
"${piDir}/settings.json".force = true;
"${piDir}/extensions" = {
source = piExtensions;
recursive = true;
};
"${piDir}/extensions" = {
source = piExtensions;
recursive = true;
};
"${piDir}/prompts" = {
source = ./prompts;
recursive = true;
"${piDir}/prompts" = {
source = ./prompts;
recursive = true;
};
}
// lib.optionalAttrs (subagentsConfig != { }) {
# Declaring any global override makes Nix the owner of the runtime file.
"${piDir}/subagents.json" = {
source = subagentsJson;
force = true;
};
};
};
};
};
}

View File

@@ -112,6 +112,10 @@ in
blur.enabled = cfg.blur;
};
# XWayland clients render at the panel's native resolution instead of
# being raster-scaled by the compositor at the fractional monitor scale.
xwayland.force_zero_scaling = true;
animations = {
enabled = true;
bezier = [ "ease, 0.25, 0.1, 0.25, 1.0" ];

24
modules/desktop/steam.nix Normal file
View File

@@ -0,0 +1,24 @@
{
config,
lib,
pkgs,
...
}:
# Steam game launcher and runtime integration.
let
cfg = config.modules.desktop.steam;
in
{
options.modules.desktop.steam.enable = lib.mkEnableOption "Steam game launcher";
config = lib.mkIf cfg.enable {
programs.steam = {
enable = true;
package = pkgs.steam.override {
extraEnv.STEAM_FORCE_DESKTOPUI_SCALING = "1.5";
};
};
hardware.steam-hardware.enable = true;
};
}

View File

@@ -83,6 +83,7 @@ in
"class<chromium.*>" = g "f268";
"class<[Cc]ode>" = g "f121";
"class<obsidian>" = g "f02d";
"class<[Ss]team>" = g "f1b6";
};
};