Compare commits
2 Commits
wip
...
7823066147
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7823066147
|
||
|
|
730805ceec
|
@@ -79,7 +79,6 @@ in
|
||||
./roles/openpgp_card_tools
|
||||
./roles/optimized_build
|
||||
./roles/pcsx2
|
||||
./roles/pi_coding_agent
|
||||
./roles/podman
|
||||
./roles/postgresql_client
|
||||
./roles/python
|
||||
@@ -87,7 +86,6 @@ in
|
||||
./roles/rdp_client
|
||||
./roles/recovery
|
||||
./roles/reset
|
||||
./roles/robot
|
||||
./roles/rpcs3
|
||||
./roles/rust
|
||||
./roles/sequoia
|
||||
@@ -289,13 +287,6 @@ in
|
||||
(disableOptimizations "nototools") # Needs to use the same version of python as the zopfli package
|
||||
(disableOptimizations "lib2geom") # Tests failing: ellipse-test, elliptical-arc-test, line-test, polynomial-test
|
||||
(disableOptimizations "libjpeg_turbo") # Test failing: djpeg12-shared-3x2-float-prog-cmp
|
||||
(disableOptimizations "libjxl") # Test failing, but only on my builder VM. I assume related to AVX512: DjxlFuzzerTestInstantiation
|
||||
(disableOptimizationsScope "kdePackages" "qtbase") # Issue with my bhyve VM: Incompatible processor. This Qt build requires the following features: avx512ifma avx512vbmi avx512vbmi2 gfni avx512bitalg avx512vpopcntdq
|
||||
(disableOptimizationsScope "libsForQt5" "qtbase") # Issue with my bhyve VM: Incompatible processor. This Qt build requires the following features: avx512ifma avx512vbmi avx512vbmi2 gfni avx512bitalg avx512vpopcntdq
|
||||
(disableOptimizationsScope "qt6Packages" "qtbase") # Issue with my bhyve VM: Incompatible processor. This Qt build requires the following features: avx512ifma avx512vbmi avx512vbmi2 gfni avx512bitalg avx512vpopcntdq
|
||||
(disableTests "sequoia-sq") # Test failing on my builder vm: sq_key_generate_dev_null
|
||||
(disableOptimizations "tzdata") # Tests failing on my builder vm
|
||||
(disableOptimizations "simdutf") # Tests failing on my builder vm
|
||||
];
|
||||
|
||||
hardware.firmware =
|
||||
|
||||
@@ -5,13 +5,14 @@ set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
: ${CPU_CORES:="4"}
|
||||
: ${MEMORY:="8G"}
|
||||
: ${CPU_CORES:="1"}
|
||||
: ${MEMORY:="1G"}
|
||||
: ${GTK_ENABLE:="NO"} # Only enable one, either GTK or VNC
|
||||
: ${VNC_ENABLE:="NO"} # Only enable one, either GTK or VNC
|
||||
: ${VNC_LISTEN:="127.0.0.1:0"}
|
||||
: ${VNC_WIDTH:="1920"}
|
||||
: ${VNC_HEIGHT:="1080"}
|
||||
: ${AUDIO_ENABLE:="NO"}
|
||||
|
||||
############## Setup #########################
|
||||
|
||||
@@ -53,20 +54,22 @@ function main {
|
||||
-device "ahci,id=achi0"
|
||||
-device "ide-cd,bus=achi0.0,drive=drive-cd1,id=cd1,bootindex=1")
|
||||
|
||||
additional_args+=(-fsdev "local,id=fsdev0,path=${mount_path},security_model=mapped-xattr" -device "virtio-9p-pci,fsdev=fsdev0,mount_tag=host")
|
||||
|
||||
mkdir -p "${mount_path}/.persist" "${mount_path}/.state"
|
||||
additional_args+=(-device "virtio-9p-pci,fsdev=${mount_path},mount_tag=host")
|
||||
|
||||
if [ "$VNC_ENABLE" = "YES" ]; then
|
||||
additional_args+=(-vnc "${VNC_LISTEN},power-control=on")
|
||||
elif [ "$GTK_ENABLE" = "YES" ]; then
|
||||
fi
|
||||
|
||||
if [ "$AUDIO_ENABLE" = "YES" ]; then
|
||||
additional_args+=(-audio "driver=pa,model=virtio,server=/run/user/11235/pulse/native")
|
||||
fi
|
||||
|
||||
if [ "$GTK_ENABLE" = "YES" ]; then
|
||||
additional_args+=(
|
||||
-device 'virtio-gpu-gl,hostmem=8G,blob=true,venus=true'
|
||||
-display 'gtk,gl=on'
|
||||
-vga virtio
|
||||
)
|
||||
else
|
||||
additional_args+=(-nographic)
|
||||
fi
|
||||
|
||||
exec qemu-system-x86_64 \
|
||||
6
nix/configuration/flake.lock
generated
6
nix/configuration/flake.lock
generated
@@ -185,11 +185,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1793540411,
|
||||
"narHash": "sha256-fiPJ88izTVucjeo2EQ3jk4aWmLg03I1D4vxnX2QjEgE=",
|
||||
"lastModified": 1793110635,
|
||||
"narHash": "sha256-dhoW6VgFWlaodSY5jrBn+CF2FLmaUvDVgM7+C7T2+NM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0bb2eedc20e4739f29e8045034f2828ad7054f8f",
|
||||
"rev": "31ecbaca1bdefa45dffc409f0250bd8039ea0010",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -45,14 +45,7 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
forAllSystems =
|
||||
func:
|
||||
builtins.listToAttrs (
|
||||
map (system: {
|
||||
name = system;
|
||||
value = func system;
|
||||
}) nixpkgs.lib.systems.flakeExposed
|
||||
);
|
||||
forAllSystems = nixpkgs.lib.genAttrs nixpkgs.lib.systems.flakeExposed;
|
||||
nodes = {
|
||||
odo = {
|
||||
system = "x86_64-linux";
|
||||
@@ -79,49 +72,41 @@
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
};
|
||||
baseConfig = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit self nix_builder;
|
||||
};
|
||||
modules = [
|
||||
impermanence.nixosModules.impermanence
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
disko.nixosModules.disko
|
||||
./configuration.nix
|
||||
{
|
||||
config = {
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
# stable = nixpkgs-stable.legacyPackages."${prev.stdenv.hostPlatform.system}";
|
||||
unoptimized = import nixpkgs {
|
||||
system = prev.stdenv.hostPlatform.system;
|
||||
hostPlatform.gcc.arch = "default";
|
||||
hostPlatform.gcc.tune = "default";
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
toplevelConfigs = builtins.mapAttrs (
|
||||
hostname: nodeConfig:
|
||||
baseConfig.extendModules {
|
||||
nixosConfigs = builtins.mapAttrs (
|
||||
hostname: nodeConfig: format:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit self nix_builder;
|
||||
|
||||
this_nixos_config = self.nixosConfigurations."${hostname}";
|
||||
|
||||
all_nixos_configs = self.nixosConfigurations;
|
||||
};
|
||||
modules = [
|
||||
impermanence.nixosModules.impermanence
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
disko.nixosModules.disko
|
||||
./configuration.nix
|
||||
(./. + "/hosts/${hostname}")
|
||||
(./. + "/formats/${format}.nix")
|
||||
{
|
||||
config = {
|
||||
nixpkgs.hostPlatform.system = nodeConfig.system;
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
# stable = nixpkgs-stable.legacyPackages."${prev.stdenv.hostPlatform.system}";
|
||||
unoptimized = import nixpkgs {
|
||||
system = prev.stdenv.hostPlatform.system;
|
||||
hostPlatform.gcc.arch = "default";
|
||||
hostPlatform.gcc.tune = "default";
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
) nodes;
|
||||
specialFormats =
|
||||
nixosConfig: format:
|
||||
nixosConfig.extendModules {
|
||||
modules = [ (./. + "/formats/${format}.nix") ];
|
||||
};
|
||||
installerConfig =
|
||||
hostname: nodeConfig:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
@@ -135,37 +120,66 @@
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations = toplevelConfigs;
|
||||
nixosConfigurations = (builtins.mapAttrs (name: value: value "toplevel") nixosConfigs);
|
||||
}
|
||||
// {
|
||||
packages = (
|
||||
forAllSystems (
|
||||
system:
|
||||
let
|
||||
machines = (
|
||||
builtins.mapAttrs (hostname: nodeConfig: {
|
||||
iso = (specialFormats self.nixosConfigurations."${hostname}" "iso").config.system.build.isoImage;
|
||||
vm_iso =
|
||||
(specialFormats self.nixosConfigurations."${hostname}" "vm_iso").config.system.build.isoImage;
|
||||
sd = (specialFormats self.nixosConfigurations."${hostname}" "sd").config.system.build.sdImage;
|
||||
installer = (installerConfig hostname nodes."${hostname}").config.system.build.isoImage;
|
||||
}) (nixpkgs.lib.attrsets.filterAttrs (hostname: nodeConfig: nodeConfig.system == system) nodes)
|
||||
);
|
||||
in
|
||||
(
|
||||
machines
|
||||
(builtins.mapAttrs (hostname: nodeConfig: {
|
||||
iso = (nixosConfigs."${hostname}" "iso").config.system.build.isoImage;
|
||||
vm_iso = (nixosConfigs."${hostname}" "vm_iso").config.system.build.isoImage;
|
||||
sd = (nixosConfigs."${hostname}" "sd").config.system.build.sdImage;
|
||||
installer = (installerConfig hostname nodes."${hostname}").config.system.build.isoImage;
|
||||
}) (nixpkgs.lib.attrsets.filterAttrs (hostname: nodeConfig: nodeConfig.system == system) nodes))
|
||||
// {
|
||||
wip = nixpkgs.legacyPackages."${system}".symlinkJoin {
|
||||
name = "wip";
|
||||
paths =
|
||||
(builtins.map (name: self.nixosConfigurations."${name}".config.system.build.toplevel) [
|
||||
"odo"
|
||||
"odowork"
|
||||
"quark"
|
||||
"family_disks"
|
||||
])
|
||||
++ [ self.packages."${system}".hydra.vm_iso ];
|
||||
};
|
||||
launch_robot =
|
||||
let
|
||||
pkgs = (nixosConfigs."robot" "vm_iso").pkgs;
|
||||
patchScriptBin =
|
||||
filename: contents:
|
||||
((pkgs.writeScriptBin filename contents).overrideAttrs (old: {
|
||||
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||
}));
|
||||
launch_robot_script = (
|
||||
patchScriptBin "launch_robot" (
|
||||
builtins.readFile (
|
||||
pkgs.replaceVars ./files/robot/launch_robot.bash (
|
||||
let
|
||||
robot_image_package = (nixosConfigs."robot" "vm_iso").config.system.build.isoImage;
|
||||
robot_image = "${robot_image_package}/iso/${robot_image_package.isoName}";
|
||||
in
|
||||
{
|
||||
"OVMFfd" = "${pkgs.OVMF.fd}";
|
||||
"mountiso" = robot_image;
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
launch_robot_script_wrapped =
|
||||
(pkgs.writeScriptBin "launch_robot" ''
|
||||
#!/usr/bin/env bash
|
||||
export "PATH=${
|
||||
pkgs.lib.makeBinPath (
|
||||
with pkgs;
|
||||
[
|
||||
qemu
|
||||
]
|
||||
)
|
||||
}:''${PATH}"
|
||||
exec ${launch_robot_script}/bin/launch_robot "''${@}"
|
||||
'').overrideAttrs
|
||||
(old: {
|
||||
buildCommand = ''
|
||||
${old.buildCommand}
|
||||
patchShebangs $out
|
||||
'';
|
||||
});
|
||||
|
||||
in
|
||||
launch_robot_script_wrapped;
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
1
nix/configuration/formats/toplevel.nix
Normal file
1
nix/configuration/formats/toplevel.nix
Normal file
@@ -0,0 +1 @@
|
||||
{ }
|
||||
@@ -137,7 +137,6 @@
|
||||
me.python.enable = true;
|
||||
me.qemu.enable = true;
|
||||
me.recovery.enable = true;
|
||||
me.robot.enable = true;
|
||||
me.rpcs3.enable = true;
|
||||
me.rust.enable = true;
|
||||
me.sequoia.enable = true;
|
||||
|
||||
@@ -128,7 +128,6 @@
|
||||
me.postgresql_client.enable = true;
|
||||
me.python.enable = true;
|
||||
me.rdp_client.enable = true;
|
||||
me.robot.enable = true;
|
||||
me.rust.enable = true;
|
||||
me.sequoia.enable = true;
|
||||
me.shikane.enable = true;
|
||||
|
||||
@@ -128,7 +128,6 @@
|
||||
me.python.enable = true;
|
||||
me.qemu.enable = true;
|
||||
me.recovery.enable = true;
|
||||
me.robot.enable = true;
|
||||
me.rpcs3.enable = true;
|
||||
me.rust.enable = true;
|
||||
me.sequoia.enable = true;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
config = {
|
||||
networking =
|
||||
let
|
||||
interface = "ens3";
|
||||
interface = "enp0s10";
|
||||
in
|
||||
{
|
||||
# Generate with `head -c4 /dev/urandom | od -A none -t x4`
|
||||
@@ -21,9 +21,32 @@
|
||||
|
||||
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;
|
||||
interfaces = {
|
||||
"${interface}" = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = "10.215.1.224";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
|
||||
ipv6.addresses = [
|
||||
{
|
||||
address = "2620:11f:7001:7:ffff:ffff:0ad7:01e0";
|
||||
prefixLength = 64;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
defaultGateway = "10.215.1.1";
|
||||
defaultGateway6 = {
|
||||
# address = "2620:11f:7001:7::1";
|
||||
address = "2620:11f:7001:7:ffff:ffff:0ad7:0101";
|
||||
inherit interface;
|
||||
};
|
||||
|
||||
dhcpcd.enable = lib.mkForce false;
|
||||
useDHCP = lib.mkForce false;
|
||||
};
|
||||
|
||||
time.timeZone = "America/New_York";
|
||||
@@ -62,11 +85,6 @@
|
||||
# nix.optimise.dates = [ "03:45" ];
|
||||
# nix.optimise.persistent = true;
|
||||
|
||||
# For console-only qemu operation
|
||||
boot.kernelParams = [
|
||||
"console=ttyS0,115200n8"
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
htop
|
||||
];
|
||||
@@ -76,6 +94,5 @@
|
||||
|
||||
me.dont_use_substituters.enable = true;
|
||||
me.minimal_base.enable = true;
|
||||
me.pi_coding_agent.enable = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,34 +11,18 @@
|
||||
config = {
|
||||
# Mount the local disk
|
||||
fileSystems = lib.mkIf config.me.mountPersistence {
|
||||
"/persist" = {
|
||||
fsType = "none";
|
||||
device = "/robot/.persist";
|
||||
"/.disk" = lib.mkForce {
|
||||
device = "/dev/nvme0n1p1";
|
||||
fsType = "ext4";
|
||||
options = [
|
||||
"bind"
|
||||
"rw"
|
||||
];
|
||||
depends = [
|
||||
"/robot/.persist"
|
||||
"noatime"
|
||||
"discard"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
"/state" = {
|
||||
fsType = "none";
|
||||
device = "/robot/.state";
|
||||
options = [
|
||||
"bind"
|
||||
"rw"
|
||||
];
|
||||
depends = [
|
||||
"/robot/.state"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
"/robot" = lib.mkForce {
|
||||
device = "host";
|
||||
"/.persist" = lib.mkForce {
|
||||
device = "bind9p";
|
||||
fsType = "9p";
|
||||
options = [
|
||||
"noatime"
|
||||
@@ -51,6 +35,60 @@
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
"/persist" = {
|
||||
fsType = "none";
|
||||
device = "/.persist/persist";
|
||||
options = [
|
||||
"bind"
|
||||
"rw"
|
||||
];
|
||||
depends = [
|
||||
"/.persist/persist"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
"/state" = {
|
||||
fsType = "none";
|
||||
device = "/.persist/state";
|
||||
options = [
|
||||
"bind"
|
||||
"rw"
|
||||
];
|
||||
depends = [
|
||||
"/.persist/state"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
"/k8spv" = lib.mkForce {
|
||||
device = "k8spv";
|
||||
fsType = "9p";
|
||||
options = [
|
||||
"noatime"
|
||||
"trans=virtio"
|
||||
"version=9p2000.L"
|
||||
"cache=mmap"
|
||||
"msize=512000"
|
||||
# "noauto"
|
||||
# "x-systemd.automount"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
"/disk" = {
|
||||
fsType = "none";
|
||||
device = "/.disk/persist";
|
||||
options = [
|
||||
"bind"
|
||||
"rw"
|
||||
];
|
||||
depends = [
|
||||
"/.disk/persist"
|
||||
];
|
||||
neededForBoot = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -76,15 +76,5 @@ in
|
||||
# Disable installing documentation.
|
||||
documentation.doc.enable = false;
|
||||
documentation.nixos.enable = false;
|
||||
|
||||
# Let users in group wheel increase the priority of their processees without elevating to root.
|
||||
security.pam.loginLimits = [
|
||||
{
|
||||
domain = "@wheel";
|
||||
type = "-"; # Sets both soft and hard limits
|
||||
item = "nice";
|
||||
value = -20; # Range is -20 (highest priority) to 19 (lowest)
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
this_nixos_config,
|
||||
...
|
||||
}:
|
||||
|
||||
@@ -49,9 +50,6 @@
|
||||
# ++ flakeOutPaths;
|
||||
# closureInfo = pkgs.closureInfo { rootPaths = dependencies; };
|
||||
# in
|
||||
let
|
||||
this_nixos_config = self.nixosConfigurations."${config.networking.hostName}";
|
||||
in
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
all_nixos_configs,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
|
||||
@@ -76,14 +76,14 @@ let
|
||||
sshUser = "nixworker";
|
||||
sshKey = "/persist/manual/ssh/root/keys/id_ed25519";
|
||||
maxJobs = 1;
|
||||
supportedFeatures = self.nixosConfigurations."${hostname}".config.me.optimizations.system_features;
|
||||
supportedFeatures = all_nixos_configs."${hostname}".config.me.optimizations.system_features;
|
||||
protocol = "ssh-ng";
|
||||
}
|
||||
static_host_configs."${hostname}"
|
||||
config.me.distributed_build.machines."${hostname}".additional_config
|
||||
]
|
||||
))
|
||||
) (builtins.attrNames self.nixosConfigurations)
|
||||
) (builtins.attrNames all_nixos_configs)
|
||||
);
|
||||
substituters_list = (
|
||||
map (
|
||||
@@ -92,7 +92,7 @@ let
|
||||
config.me.distributed_build.machines."${hostname}".enable_substituter
|
||||
&& config.me.distributed_build.machines."${hostname}".substituter_url != null
|
||||
) (config.me.distributed_build.machines."${hostname}".substituter_url))
|
||||
) (builtins.attrNames self.nixosConfigurations)
|
||||
) (builtins.attrNames all_nixos_configs)
|
||||
);
|
||||
has_any_substituters = substituters_list != [ ];
|
||||
in
|
||||
@@ -107,9 +107,7 @@ in
|
||||
description = "Whether we want to use multiple machines to perform a nixos-rebuild.";
|
||||
};
|
||||
|
||||
distributed_build.machines = lib.mapAttrs (
|
||||
name: value: make_machine_config name
|
||||
) self.nixosConfigurations;
|
||||
distributed_build.machines = lib.mapAttrs (name: value: make_machine_config name) all_nixos_configs;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.distributed_build.enable (
|
||||
|
||||
@@ -84,13 +84,6 @@
|
||||
"browser.ml.enable" = false;
|
||||
"browser.ml.chat.enabled" = false;
|
||||
"browser.ml.chat.menu" = false;
|
||||
|
||||
# Disable disk-based caching to reduce writes to SSDs. My machines have plenty of RAM.
|
||||
"browser.cache.disk.enable" = 0;
|
||||
# Max memory for cache in KiB (set to 1 GiB). This defaults to unbounded (-1).
|
||||
"browser.cache.memory.capacity" = 1048576;
|
||||
# Only keep the previous 5 pages in memory for the back button. This defaults to unbounded (-1).
|
||||
"browser.sessionhistory.max_total_viewers" = 5;
|
||||
};
|
||||
# Check about:policies#documentation and https://mozilla.github.io/policy-templates/ for options.
|
||||
policies = {
|
||||
|
||||
@@ -80,8 +80,6 @@ in
|
||||
systemd.services."build-cache" =
|
||||
let
|
||||
enabled_targets = [
|
||||
"wip"
|
||||
"wip_kubernetes"
|
||||
"odo"
|
||||
"odo_update"
|
||||
"odowork"
|
||||
|
||||
@@ -1,19 +1,5 @@
|
||||
output_directory = "/home/nixworker/persist/nix_builder"
|
||||
|
||||
[[targets]]
|
||||
name = "wip"
|
||||
repo = "https://code.fizz.buzz/talexander/machine_setup.git"
|
||||
branch = "wip"
|
||||
path = "nix/configuration"
|
||||
attr = "wip"
|
||||
|
||||
[[targets]]
|
||||
name = "wip_kubernetes"
|
||||
repo = "https://code.fizz.buzz/talexander/machine_setup.git"
|
||||
branch = "wip"
|
||||
path = "nix/kubernetes"
|
||||
attr = "wip"
|
||||
|
||||
[[targets]]
|
||||
name = "odo"
|
||||
repo = "https://code.fizz.buzz/talexander/machine_setup.git"
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
# 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";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -21,19 +21,5 @@
|
||||
environment.systemPackages = with pkgs; [
|
||||
freerdp
|
||||
];
|
||||
|
||||
environment.persistence."/persist" = lib.mkIf (config.me.mountPersistence) {
|
||||
hideMounts = true;
|
||||
users.talexander = {
|
||||
directories = [
|
||||
{
|
||||
directory = ".config/freerdp";
|
||||
user = "talexander";
|
||||
group = "talexander";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
patchScriptBin =
|
||||
filename: contents:
|
||||
((pkgs.writeScriptBin filename contents).overrideAttrs (old: {
|
||||
buildCommand = "${old.buildCommand}\n patchShebangs $out";
|
||||
}));
|
||||
launch_robot_script = (
|
||||
patchScriptBin "launch_robot" (
|
||||
builtins.readFile (
|
||||
pkgs.replaceVars ./files/robot/launch_robot.bash (
|
||||
let
|
||||
robot_image_package = self.packages.${pkgs.system}.robot.vm_iso;
|
||||
robot_image = "${robot_image_package}/iso/${robot_image_package.isoName}";
|
||||
in
|
||||
{
|
||||
"OVMFfd" = "${pkgs.OVMF.fd}";
|
||||
"mountiso" = robot_image;
|
||||
}
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
launch_robot_script_wrapped =
|
||||
(pkgs.writeScriptBin "launch_robot" ''
|
||||
#!/usr/bin/env bash
|
||||
export "PATH=${
|
||||
pkgs.lib.makeBinPath (
|
||||
with pkgs;
|
||||
[
|
||||
qemu
|
||||
]
|
||||
)
|
||||
}:''${PATH}"
|
||||
exec ${launch_robot_script}/bin/launch_robot "''${@}"
|
||||
'').overrideAttrs
|
||||
(old: {
|
||||
buildCommand = ''
|
||||
${old.buildCommand}
|
||||
patchShebangs $out
|
||||
'';
|
||||
});
|
||||
|
||||
in
|
||||
|
||||
{
|
||||
imports = [ ];
|
||||
|
||||
options.me = {
|
||||
robot.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = "Whether we want to install robot.";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.me.robot.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
launch_robot_script_wrapped
|
||||
];
|
||||
environment.persistence."/persist" = lib.mkIf (config.me.mountPersistence) {
|
||||
hideMounts = true;
|
||||
directories = [
|
||||
{
|
||||
directory = "/robot";
|
||||
user = "talexander";
|
||||
group = "talexander";
|
||||
mode = "0700";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -15,24 +15,45 @@ let
|
||||
ms-azuretools.vscode-docker
|
||||
ms-vscode-remote.remote-ssh
|
||||
esbenp.prettier-vscode
|
||||
ms-python.python
|
||||
ms-python.debugpy
|
||||
];
|
||||
work_specific = [
|
||||
ms-python.vscode-python-envs
|
||||
ms-python.vscode-pylance
|
||||
ms-python.debugpy
|
||||
ms-python.python
|
||||
# ms-python.vscode-pylance
|
||||
]
|
||||
++ (pkgs.vscode-utils.extensionsFromVscodeMarketplace [
|
||||
{
|
||||
name = "remote-server";
|
||||
publisher = "ms-vscode";
|
||||
version = "1.5.4";
|
||||
sha256 = "x0zD2MolMai8cCdNfn8kf58cf7oNe6XH1CDUfpJ/Zaw=";
|
||||
version = "1.5.3";
|
||||
sha256 = "MSayIBwvSgIHg6gTrtUotHznvo5kTiveN8iSrehllW0=";
|
||||
}
|
||||
{
|
||||
name = "vscode-python-envs";
|
||||
publisher = "ms-python";
|
||||
version = "1.12.0";
|
||||
sha256 = "8dCnGBuxv+8QwP0FrUZIKFxllVOR2z+wIhyyJgxsRns=";
|
||||
}
|
||||
{
|
||||
name = "vscode-pylance";
|
||||
publisher = "ms-python";
|
||||
version = "2025.10.1";
|
||||
sha256 = "7NLq5huykRAhhEIHjtXLKDBFwQ5yiJKFLG64Tjh0yaM=";
|
||||
}
|
||||
{
|
||||
name = "debugpy";
|
||||
publisher = "ms-python";
|
||||
version = "2025.16.0";
|
||||
sha256 = "QPIDUzzwIfzyicsCwqU2u6hVSjCJMInHhHMBqvL8tYs=";
|
||||
}
|
||||
{
|
||||
name = "python";
|
||||
publisher = "ms-python";
|
||||
version = "2025.18.0";
|
||||
sha256 = "6auzfS1DmOuaqV2rDHSCC9BlrcON4xUrdJZ0N0wYCs4=";
|
||||
}
|
||||
]);
|
||||
personal_specific = [
|
||||
ms-python.python
|
||||
ms-python.debugpy
|
||||
ms-vscode.cpptools # C/C++ support and debugging
|
||||
ms-vscode.cpptools-extension-pack
|
||||
];
|
||||
@@ -78,11 +99,9 @@ in
|
||||
me.install.user.talexander.file = {
|
||||
".config/Code/User/settings.json" = {
|
||||
source = ./files/settings.json;
|
||||
method = "overwrite";
|
||||
};
|
||||
".config/Code/User/keybindings.json" = {
|
||||
source = ./files/keybindings.json;
|
||||
method = "overwrite";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
6
nix/kubernetes/flake.lock
generated
6
nix/kubernetes/flake.lock
generated
@@ -164,11 +164,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1793540411,
|
||||
"narHash": "sha256-fiPJ88izTVucjeo2EQ3jk4aWmLg03I1D4vxnX2QjEgE=",
|
||||
"lastModified": 1793110635,
|
||||
"narHash": "sha256-dhoW6VgFWlaodSY5jrBn+CF2FLmaUvDVgM7+C7T2+NM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0bb2eedc20e4739f29e8045034f2828ad7054f8f",
|
||||
"rev": "31ecbaca1bdefa45dffc409f0250bd8039ea0010",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -71,49 +71,64 @@
|
||||
system = "x86_64-linux";
|
||||
};
|
||||
};
|
||||
baseConfig = nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit self;
|
||||
};
|
||||
modules = [
|
||||
impermanence.nixosModules.impermanence
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
disko.nixosModules.disko
|
||||
./configuration.nix
|
||||
{
|
||||
config = {
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
# stable = nixpkgs-stable.legacyPackages."${prev.stdenv.hostPlatform.system}";
|
||||
unoptimized = import nixpkgs {
|
||||
system = prev.stdenv.hostPlatform.system;
|
||||
hostPlatform.gcc.arch = "default";
|
||||
hostPlatform.gcc.tune = "default";
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
toplevelConfigs = builtins.mapAttrs (
|
||||
hostname: nodeConfig:
|
||||
baseConfig.extendModules {
|
||||
nixosConfigs = builtins.mapAttrs (
|
||||
hostname: nodeConfig: format:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit self;
|
||||
|
||||
this_nixos_config = self.nixosConfigurations."${hostname}";
|
||||
|
||||
all_nixos_configs = self.nixosConfigurations;
|
||||
};
|
||||
modules = [
|
||||
impermanence.nixosModules.impermanence
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
disko.nixosModules.disko
|
||||
./configuration.nix
|
||||
(./. + "/hosts/${hostname}")
|
||||
(./. + "/formats/${format}.nix")
|
||||
{
|
||||
config = {
|
||||
nixpkgs.hostPlatform.system = nodeConfig.system;
|
||||
nixpkgs.overlays = [
|
||||
(final: prev: {
|
||||
# stable = nixpkgs-stable.legacyPackages."${prev.stdenv.hostPlatform.system}";
|
||||
unoptimized = import nixpkgs {
|
||||
system = prev.stdenv.hostPlatform.system;
|
||||
hostPlatform.gcc.arch = "default";
|
||||
hostPlatform.gcc.tune = "default";
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
(
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
nix-self-repl = pkgs.writeShellScriptBin "nix-self-repl" ''
|
||||
source /etc/set-environment
|
||||
nix repl --expr 'builtins.getFlake "${self}"'
|
||||
'';
|
||||
# If we wanted the current version of a flake then we'd just launch
|
||||
# nix repl
|
||||
# and then run:
|
||||
# :lf /path/to/flake
|
||||
in
|
||||
{
|
||||
config = {
|
||||
environment.systemPackages = lib.mkIf config.nix.enable [ nix-self-repl ];
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
) nodes;
|
||||
specialFormats =
|
||||
nixosConfig: format:
|
||||
nixosConfig.extendModules {
|
||||
modules = [ (./. + "/formats/${format}.nix") ];
|
||||
};
|
||||
installerConfig =
|
||||
hostname: nodeConfig:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
@@ -122,41 +137,46 @@
|
||||
};
|
||||
modules = [
|
||||
./formats/installer.nix
|
||||
(
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
nix-self-repl = pkgs.writeShellScriptBin "nix-self-repl" ''
|
||||
source /etc/set-environment
|
||||
nix repl --expr 'builtins.getFlake "${self}"'
|
||||
'';
|
||||
# If we wanted the current version of a flake then we'd just launch
|
||||
# nix repl
|
||||
# and then run:
|
||||
# :lf /path/to/flake
|
||||
in
|
||||
{
|
||||
config = {
|
||||
environment.systemPackages = lib.mkIf config.nix.enable [ nix-self-repl ];
|
||||
};
|
||||
}
|
||||
)
|
||||
({ nixpkgs.hostPlatform.system = nodeConfig.system; })
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations = toplevelConfigs;
|
||||
nixosConfigurations = (builtins.mapAttrs (name: value: value "toplevel") nixosConfigs);
|
||||
}
|
||||
// {
|
||||
packages = (
|
||||
forAllSystems (
|
||||
system:
|
||||
let
|
||||
machines = (
|
||||
builtins.mapAttrs (hostname: nodeConfig: {
|
||||
iso = (specialFormats self.nixosConfigurations."${hostname}" "iso").config.system.build.isoImage;
|
||||
vm_iso =
|
||||
(specialFormats self.nixosConfigurations."${hostname}" "vm_iso").config.system.build.isoImage;
|
||||
sd = (specialFormats self.nixosConfigurations."${hostname}" "sd").config.system.build.sdImage;
|
||||
installer = (installerConfig hostname nodes."${hostname}").config.system.build.isoImage;
|
||||
}) (nixpkgs.lib.attrsets.filterAttrs (hostname: nodeConfig: nodeConfig.system == system) nodes)
|
||||
);
|
||||
in
|
||||
(
|
||||
machines
|
||||
// {
|
||||
wip = nixpkgs.legacyPackages."${system}".symlinkJoin {
|
||||
name = "wip";
|
||||
paths = (
|
||||
builtins.map (name: self.nixosConfigurations."${name}".config.system.build.toplevel) (
|
||||
builtins.attrNames self.nixosConfigurations
|
||||
)
|
||||
);
|
||||
};
|
||||
}
|
||||
)
|
||||
(builtins.mapAttrs (hostname: nodeConfig: {
|
||||
iso = (nixosConfigs."${hostname}" "iso").config.system.build.isoImage;
|
||||
vm_iso = (nixosConfigs."${hostname}" "vm_iso").config.system.build.isoImage;
|
||||
sd = (nixosConfigs."${hostname}" "sd").config.system.build.sdImage;
|
||||
installer = (installerConfig hostname nodes."${hostname}").config.system.build.isoImage;
|
||||
}) (nixpkgs.lib.attrsets.filterAttrs (hostname: nodeConfig: nodeConfig.system == system) nodes))
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
1
nix/kubernetes/formats/toplevel.nix
Normal file
1
nix/kubernetes/formats/toplevel.nix
Normal file
@@ -0,0 +1 @@
|
||||
{ }
|
||||
Reference in New Issue
Block a user