Add a host for a virtual machine for agent coding.
This commit is contained in:
67
nix/configuration/roles/pi_coding_agent/default.nix
Normal file
67
nix/configuration/roles/pi_coding_agent/default.nix
Normal file
@@ -0,0 +1,67 @@
|
||||
# Example endpoint when run in qemu with slirp: http://10.0.2.2:8080/v1/chat/completions
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
pi_coding_agent.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install pi_coding_agent.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.pi_coding_agent.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
pi-coding-agent
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
pi-coding-agent = pkgs.symlinkJoin {
|
||||
name = prev.pi-coding-agent.name;
|
||||
paths = [ prev.pi-coding-agent ];
|
||||
buildInputs = [ pkgs.makeWrapper ];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/pi \
|
||||
--set-default PI_SKIP_VERSION_CHECK 1 \
|
||||
--set-default PI_TELEMETRY 0 \
|
||||
--set-default PI_OFFLINE 1 \
|
||||
--set-default LLAMA_BASE_URL http://10.0.2.2:8080 \
|
||||
--set-default LLAMA_API_KEY optional-secret \
|
||||
--set-default PI_PROVIDER llama.cpp \
|
||||
--set-default PI_MODEL qwen3.8_27b_bf16
|
||||
'';
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
environment.persistence."/persist" = lib.mkIf (config.me.mountPersistence) {
|
||||
hideMounts = true;
|
||||
users.talexander = {
|
||||
directories = [
|
||||
{
|
||||
directory = ".pi";
|
||||
user = "talexander";
|
||||
group = "talexander";
|
||||
mode = "0700";
|
||||
}
|
||||
{
|
||||
# For ~/.agents/skills
|
||||
directory = ".agents";
|
||||
user = "talexander";
|
||||
group = "talexander";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user