Add a host for a virtual machine for agent coding.
This commit is contained in:
13
nix/configuration/hosts/robot/DEPLOY_BOOT
Executable file
13
nix/configuration/hosts/robot/DEPLOY_BOOT
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
TARGET=robot
|
||||
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild boot --flake "$DIR/../../#robot" --target-host "$TARGET" --build-host "$TARGET" --sudo --max-jobs "$JOBS" --log-format internal-json -v "${@}" |& nom --json
|
||||
13
nix/configuration/hosts/robot/DEPLOY_SWITCH
Executable file
13
nix/configuration/hosts/robot/DEPLOY_SWITCH
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
TARGET=robot
|
||||
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
|
||||
nixos-rebuild switch --flake "$DIR/../../#robot" --target-host "$TARGET" --build-host "$TARGET" --sudo --max-jobs "$JOBS" --log-format internal-json -v "${@}" |& nom --json
|
||||
10
nix/configuration/hosts/robot/ISO
Executable file
10
nix/configuration/hosts/robot/ISO
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nix build --extra-experimental-features nix-command --extra-experimental-features flakes "$DIR/../..#robot.iso" --max-jobs "$JOBS" --log-format internal-json -v "${@}" |& nom --json
|
||||
10
nix/configuration/hosts/robot/SELF_BOOT
Executable file
10
nix/configuration/hosts/robot/SELF_BOOT
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nixos-rebuild boot --show-trace --sudo --max-jobs "$JOBS" --flake "$DIR/../../#robot" --log-format internal-json -v "${@}" |& nom --json
|
||||
10
nix/configuration/hosts/robot/SELF_BUILD
Executable file
10
nix/configuration/hosts/robot/SELF_BUILD
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nixos-rebuild build --show-trace --sudo --max-jobs "$JOBS" --flake "$DIR/../../#robot" --log-format internal-json -v "${@}" |& nom --json
|
||||
10
nix/configuration/hosts/robot/SELF_SWITCH
Executable file
10
nix/configuration/hosts/robot/SELF_SWITCH
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nixos-rebuild switch --show-trace --sudo --max-jobs "$JOBS" --flake "$DIR/../../#robot" --log-format internal-json -v "${@}" |& nom --json
|
||||
10
nix/configuration/hosts/robot/VM_ISO
Executable file
10
nix/configuration/hosts/robot/VM_ISO
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: "${JOBS:="1"}"
|
||||
|
||||
for f in /persist/manual/manual_add_to_store/*; do nix-store --add-fixed sha256 "$f"; done
|
||||
nix build --extra-experimental-features nix-command --extra-experimental-features flakes "$DIR/../..#robot.vm_iso" --max-jobs "$JOBS" --log-format internal-json -v "${@}" |& nom --json
|
||||
81
nix/configuration/hosts/robot/default.nix
Normal file
81
nix/configuration/hosts/robot/default.nix
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
./vm_disk.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
networking =
|
||||
let
|
||||
interface = "ens3";
|
||||
in
|
||||
{
|
||||
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
||||
hostId = "5223fba9";
|
||||
|
||||
hostName = "robot"; # Define your hostname.
|
||||
|
||||
# These are both enabled by default, but putting it explicitly here anyway. We will get networking via qemu's slirp.
|
||||
dhcpcd.enable = true;
|
||||
useDHCP = true;
|
||||
};
|
||||
|
||||
time.timeZone = "America/New_York";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
me.boot.enable = true;
|
||||
me.boot.secure = false;
|
||||
me.mountPersistence = true;
|
||||
boot.loader.timeout = lib.mkForce 0; # We can always generate a new ISO if we need to access other boot options.
|
||||
|
||||
me.optimizations = {
|
||||
enable = true;
|
||||
arch = "znver4";
|
||||
# build_arch = "x86-64-v3";
|
||||
system_features = [
|
||||
"gccarch-znver4"
|
||||
"gccarch-skylake"
|
||||
"gccarch-kabylake"
|
||||
# "gccarch-alderlake" missing WAITPKG
|
||||
"gccarch-x86-64-v3"
|
||||
"gccarch-x86-64-v4"
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"kvm"
|
||||
"nixos-test"
|
||||
];
|
||||
};
|
||||
|
||||
# Mount tmpfs at /tmp
|
||||
boot.tmp.useTmpfs = true;
|
||||
|
||||
# Enable TRIM
|
||||
# services.fstrim.enable = lib.mkDefault true;
|
||||
|
||||
# nix.optimise.automatic = true;
|
||||
# nix.optimise.dates = [ "03:45" ];
|
||||
# nix.optimise.persistent = true;
|
||||
|
||||
# For console-only qemu operation
|
||||
boot.kernelParams = [
|
||||
"console=ttyS0,115200n8"
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
htop
|
||||
];
|
||||
|
||||
# nix.sshServe.enable = true;
|
||||
# nix.sshServe.keys = [ "ssh-dss AAAAB3NzaC1k... bob@example.org" ];
|
||||
|
||||
me.dont_use_substituters.enable = true;
|
||||
me.minimal_base.enable = true;
|
||||
me.pi_coding_agent.enable = true;
|
||||
};
|
||||
}
|
||||
31
nix/configuration/hosts/robot/hardware-configuration.nix
Normal file
31
nix/configuration/hosts/robot/hardware-configuration.nix
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/installer/scan/not-detected.nix")
|
||||
];
|
||||
|
||||
config = {
|
||||
boot.initrd.availableKernelModules = [
|
||||
"nvme"
|
||||
"xhci_pci"
|
||||
"thunderbolt"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
# networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.wlp58s0.useDHCP = lib.mkDefault true;
|
||||
};
|
||||
}
|
||||
56
nix/configuration/hosts/robot/vm_disk.nix
Normal file
56
nix/configuration/hosts/robot/vm_disk.nix
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
config = {
|
||||
# Mount the local disk
|
||||
fileSystems = lib.mkIf config.me.mountPersistence {
|
||||
"/persist" = {
|
||||
fsType = "none";
|
||||
device = "/robot/.persist";
|
||||
options = [
|
||||
"bind"
|
||||
"rw"
|
||||
];
|
||||
depends = [
|
||||
"/robot/.persist"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
"/state" = {
|
||||
fsType = "none";
|
||||
device = "/robot/.state";
|
||||
options = [
|
||||
"bind"
|
||||
"rw"
|
||||
];
|
||||
depends = [
|
||||
"/robot/.state"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
"/robot" = lib.mkForce {
|
||||
device = "host";
|
||||
fsType = "9p";
|
||||
options = [
|
||||
"noatime"
|
||||
"trans=virtio"
|
||||
"version=9p2000.L"
|
||||
"cache=mmap"
|
||||
"msize=512000"
|
||||
# "noauto"
|
||||
# "x-systemd.automount"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user