Can now build specific hosts on phoenix script

This commit is contained in:
Emmet 2025-11-08 12:58:23 -06:00
parent d9531c16b2
commit 74ade00081

View file

@ -1,4 +1,10 @@
{ config, lib, pkgs, pkgs-stable, ... }:
{
config,
lib,
pkgs,
pkgs-stable,
...
}:
{
options = {
@ -24,7 +30,8 @@
config = {
environment.systemPackages = with pkgs; [
attic-client
git git-lfs
git
git-lfs
nix-output-monitor
(pkgs.writeScriptBin "phoenix" ''
if [[ $EUID -ne 0 ]]; then
@ -70,30 +77,28 @@
chown -R 0:0 ${config.systemSettings.dotfilesDir};
chown -R 0:0 ${config.systemSettings.secretsFlakeDir};
exit 0;
# TODO allow specifying host with $2 in build subcommand
elif [ "$1" = "build" ]; then
if [ "$#" -gt 1 ]; then
echo "Warning: The 'build' command has no subcommands (no $2 subcommand)";
fi
chown -R 0:0 ${config.systemSettings.dotfilesDir};
chown -R 0:0 ${config.systemSettings.secretsFlakeDir};
pushd ${config.systemSettings.dotfilesDir} &> /dev/null;
systemd-inhibit --what sleep:idle:handle-lid-switch nixos-rebuild build --flake .#snowfire;
if [ "$#" -gt 1 ]; then
hoststobuild=("''${@:2}")
for i in "''${hoststobuild[@]}"
do
systemd-inhibit --what sleep:idle:handle-lid-switch nixos-rebuild build --flake .#$i;
systemd-inhibit --what sleep:idle:handle-lid-switch attic push emmet ./result;
systemd-inhibit --what sleep:idle:handle-lid-switch rm ./result;
systemd-inhibit --what sleep:idle:handle-lid-switch nixos-rebuild build --flake .#duskfall;
systemd-inhibit --what sleep:idle:handle-lid-switch attic push emmet ./result;
systemd-inhibit --what sleep:idle:handle-lid-switch rm ./result;
systemd-inhibit --what sleep:idle:handle-lid-switch nixos-rebuild build --flake .#zenith;
systemd-inhibit --what sleep:idle:handle-lid-switch attic push emmet ./result;
systemd-inhibit --what sleep:idle:handle-lid-switch rm ./result;
systemd-inhibit --what sleep:idle:handle-lid-switch nixos-rebuild build --flake .#stardust;
systemd-inhibit --what sleep:idle:handle-lid-switch attic push emmet ./result;
systemd-inhibit --what sleep:idle:handle-lid-switch rm ./result;
systemd-inhibit --what sleep:idle:handle-lid-switch nixos-rebuild build --flake .#ori;
done
else
hoststobuild=($(find ${config.systemSettings.dotfilesDir}/hosts -maxdepth 1 -type d \! \( -name TEMPLATE \) \! \( -name hosts \) -exec basename {} \; | xargs -d " "))
for i in "''${hoststobuild[@]}"
do
systemd-inhibit --what sleep:idle:handle-lid-switch nixos-rebuild build --flake .#$i;
systemd-inhibit --what sleep:idle:handle-lid-switch attic push emmet ./result;
systemd-inhibit --what sleep:idle:handle-lid-switch rm ./result;
done
exit 0;
fi
elif [ "$1" = "lock" ]; then
if [ "$#" -gt 1 ]; then
echo "Warning: The 'lock' command has no subcommands (no $2 subcommand)";
@ -127,7 +132,10 @@
# FIXME this thing doesn't work at all
systemd.services."phoenix-system-builder" = lib.mkIf config.systemSettings.systemBuilder.enable {
path = with pkgs; [
pkgs-stable.openssh git nix nixos-rebuild
pkgs-stable.openssh
git
nix
nixos-rebuild
];
script = ''
set -euo pipefail