Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2517501
Remove inputs-update target
booxter Feb 22, 2026
0716381
Define default make target to print available targets
booxter Feb 22, 2026
e247ecd
Untangle update script from make
booxter Feb 22, 2026
2ab5669
flake: add fleet-upgrade app for machine updates
booxter Feb 22, 2026
de5aa3d
flake: expose pi-image package and drop make target
booxter Feb 22, 2026
1152012
formatter: keep trailing newline in Makefile
booxter Feb 22, 2026
e96b629
make: remove switch convenience targets
booxter Feb 22, 2026
c37dee9
make: drop unused local build convenience targets
booxter Feb 22, 2026
351bf8b
make: remove bats convenience target
booxter Feb 22, 2026
a316adf
docs: clarify local test commands
booxter Feb 22, 2026
b550ed5
make: clarify REMOTE support for darwin build target
booxter Feb 22, 2026
d57b093
ci: build qemu attrs directly and drop make wrapper
booxter Feb 22, 2026
28ef04e
make: drop nixos-run-vm target
booxter Feb 22, 2026
0a63928
ci: drop nixos-build-vm make target
booxter Feb 22, 2026
05409df
ci: use platform-specific home-manager build targets
booxter Feb 22, 2026
a5260de
apps: make fleet-apply a dispatcher for deploy and home
booxter Feb 22, 2026
004249b
apps: add disko mode to fleet-apply and remove make target
booxter Feb 22, 2026
3d5c063
apps: add vm app and drop make local-vm target
booxter Feb 22, 2026
15d0f97
make: rename build targets and improve nixos host resolution
booxter Feb 22, 2026
1393c32
apps: rename fleet app to fleet-deploy and simplify docs
booxter Feb 23, 2026
fbb076f
apps: add pinned get-local-builders app for make
booxter Feb 23, 2026
353383e
ci: update build-targets matrix for renamed make targets
booxter Feb 23, 2026
401bda4
Merge remote-tracking branch 'origin/master' into get-rid-of-make-tar…
booxter Feb 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bake.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[formatter]
ensure_final_newline = true
39 changes: 20 additions & 19 deletions .github/workflows/build-targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,25 @@ jobs:
script: |
const fullMatrix = {
include: [
{ name: "frame (x86_64-linux)", cmd: "make nixos-build-target WHAT=frame", os: "ubuntu-latest" },
{ name: "nvws (x86_64-linux)", cmd: "make nixos-build-target WHAT=nvws", os: "ubuntu-latest" },
{ name: "prx1-lab (x86_64-linux)", cmd: "make nixos-build-target WHAT=prx1-lab", os: "ubuntu-latest" },
{ name: "prx2-lab (x86_64-linux)", cmd: "make nixos-build-target WHAT=prx2-lab", os: "ubuntu-latest" },
{ name: "prx3-lab (x86_64-linux)", cmd: "make nixos-build-target WHAT=prx3-lab", os: "ubuntu-latest" },
{ name: "builder (x86_64-linux)", cmd: "make nixos-build-target WHAT=prox-builder1vm", os: "ubuntu-latest" },
{ name: "cache (x86_64-linux)", cmd: "make nixos-build-target WHAT=prox-cachevm", os: "ubuntu-latest" },
{ name: "pi5 dhcp (aarch64-linux)", cmd: "make nixos-build-target WHAT=pi5", os: "ubuntu-24.04-arm" },
{ name: "beast (x86_64-linux)", cmd: "make nixos-build-target WHAT=beast", os: "ubuntu-latest" },
{ name: "srvarr (x86_64-linux)", cmd: "make nixos-build-target WHAT=prox-srvarrvm", os: "ubuntu-latest" },
{ name: "nixos vm builder1 (x86_64-linux)", cmd: "make nixos-build-vm WHAT=builder1", os: "ubuntu-latest" },
{ name: "home-manager nv (x86_64-linux)", cmd: "make home-build-nv USERNAME=ihrachyshka", os: "ubuntu-latest" },
{ name: "mair-ci (aarch64-darwin)", cmd: "make darwin-build-target WHAT=mair-ci", os: "macos-26" },
{ name: "mmini-ci (aarch64-darwin)", cmd: "make darwin-build-target WHAT=mmini-ci", os: "macos-26" },
{ name: "JGWXHWDL4X-ci (aarch64-darwin)", cmd: "make darwin-build-target WHAT=JGWXHWDL4X-ci", os: "macos-26" },
{ name: "nixos vm qemu (x86_64-linux)", cmd: "make nixos-build-vm-qemu", os: "ubuntu-latest" },
{ name: "nixos vm qemu (aarch64-darwin)", cmd: "make nixos-build-vm-qemu", os: "macos-26" },
{ name: "nixos vm proxmox iso (x86_64-linux)", cmd: "make nixos-build-prox-iso WHAT=builder1", os: "ubuntu-latest" }
{ name: "frame (x86_64-linux)", cmd: "make nixos WHAT=frame", os: "ubuntu-latest" },
{ name: "nvws (x86_64-linux)", cmd: "make nixos WHAT=nvws", os: "ubuntu-latest" },
{ name: "prx1-lab (x86_64-linux)", cmd: "make nixos WHAT=prx1-lab", os: "ubuntu-latest" },
{ name: "prx2-lab (x86_64-linux)", cmd: "make nixos WHAT=prx2-lab", os: "ubuntu-latest" },
{ name: "prx3-lab (x86_64-linux)", cmd: "make nixos WHAT=prx3-lab", os: "ubuntu-latest" },
{ name: "builder (x86_64-linux)", cmd: "make nixos WHAT=prox-builder1vm", os: "ubuntu-latest" },
{ name: "cache (x86_64-linux)", cmd: "make nixos WHAT=prox-cachevm", os: "ubuntu-latest" },
{ name: "pi5 dhcp (aarch64-linux)", cmd: "make nixos WHAT=pi5", os: "ubuntu-24.04-arm" },
{ name: "beast (x86_64-linux)", cmd: "make nixos WHAT=beast", os: "ubuntu-latest" },
{ name: "srvarr (x86_64-linux)", cmd: "make nixos WHAT=prox-srvarrvm", os: "ubuntu-latest" },
{ name: "nixos vm builder1 (x86_64-linux)", cmd: "nix build .#nixosConfigurations.prox-builder1vm.config.system.build.vm -L --show-trace", os: "ubuntu-latest" },
{ name: "home-manager nv (x86_64-linux)", cmd: "make linux-home TARGET=nv USERNAME=ihrachyshka", os: "ubuntu-latest" },
{ name: "home-manager mair (aarch64-darwin)", cmd: "make darwin-home TARGET=mair USERNAME=ihrachyshka", os: "macos-26" },
{ name: "mair-ci (aarch64-darwin)", cmd: "make darwin WHAT=mair-ci", os: "macos-26" },
{ name: "mmini-ci (aarch64-darwin)", cmd: "make darwin WHAT=mmini-ci", os: "macos-26" },
{ name: "JGWXHWDL4X-ci (aarch64-darwin)", cmd: "make darwin WHAT=JGWXHWDL4X-ci", os: "macos-26" },
{ name: "nixos vm qemu (x86_64-linux)", cmd: "nix build .#nixosConfigurations.prox-builder1vm.config.system.build.vmQemu -L --show-trace", os: "ubuntu-latest" },
{ name: "nixos vm qemu (aarch64-darwin)", cmd: "nix build .#nixosConfigurations.local-builder1vm.config.system.build.vmQemu -L --show-trace", os: "macos-26" },
{ name: "nixos vm proxmox iso (x86_64-linux)", cmd: "nix build .#nixosConfigurations.prox-builder1vm.config.virtualisation.proxmox.iso -L --show-trace", os: "ubuntu-latest" }
]
};

Expand Down Expand Up @@ -157,7 +158,7 @@ jobs:
{ prefix: "nixos/beast/", jobs: [ "beast (x86_64-linux)" ] },
{ prefix: "nixos/srvarrvm/", jobs: [ "srvarr (x86_64-linux)" ] },
{ prefix: "nixos/cachevm/", jobs: [ "cache (x86_64-linux)" ] },
{ prefix: "darwin/mair/", jobs: [ "mair-ci (aarch64-darwin)" ] },
{ prefix: "darwin/mair/", jobs: [ "mair-ci (aarch64-darwin)", "home-manager mair (aarch64-darwin)" ] },
{ prefix: "darwin/mmini/", jobs: [ "mmini-ci (aarch64-darwin)" ] },
{ prefix: "darwin/JGWXHWDL4X/", jobs: [ "JGWXHWDL4X-ci (aarch64-darwin)" ] }
];
Expand Down
154 changes: 56 additions & 98 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,129 +1,87 @@
# Define common args
.DEFAULT_GOAL := help
.PHONY: help nixos darwin linux-home darwin-home

ARGS = -L --show-trace
HM_ARGS = -b backup
USERNAME ?= ihrachyshka

NIX_OPTS = \
--extra-experimental-features 'nix-command flakes'

NIXOS_CONFIGS = nix flake show --json 2>/dev/null | jq -r -c '.nixosConfigurations | keys[]'
VM_TYPES = $(NIXOS_CONFIGS) | grep '^$(1)-.*vm$$' | sed 's/vm$$//' | sed 's/^$(1)-//'
define home-targets-for-system
nix eval --json --apply 'hc: builtins.mapAttrs (_: v: v.activationPackage.drvAttrs.system) hc' .#homeConfigurations \
| jq -r 'to_entries[] | select(.value=="$(1)") | .key' \
| sed 's/^$(USERNAME)@//'
endef

REMOTE ?= true
LOCAL_LOCAL_BUILDERS := $(shell ./scripts/get-local-builders.sh --local)
LOCAL_LOCAL_BUILDERS = $(shell nix run --quiet --option builders '' .#get-local-builders -- --local)

define builder-opts
$(if $(filter false,$(REMOTE)),--option builders '$(LOCAL_LOCAL_BUILDERS)',)
endef

define nix-vm-action
# $(1): VM prefix (local/prox)
# $(2): nix command (run/build)
# $(3): build output (vm/toplevel)
@if [ "x$(WHAT)" = "x" ]; then \
echo "Usage: make $@ WHAT=type"; echo; echo "Available vms:"; \
$(call VM_TYPES,$(1)); \
exit 1; \
fi

nix $(2) \
$(call builder-opts) \
.#nixosConfigurations.$(1)-$(WHAT)vm.config.system.build.$(3) $(ARGS)
endef

define nix-config-action
# $(1): build target attribute path
@if [ "x$(WHAT)" = "x" ]; then \
echo "Usage: make $@ WHAT=host"; \
echo "Usage: make $@ WHAT=host [REMOTE=false]"; \
exit 1; \
fi

nix build $(call builder-opts) $(1) $(ARGS)
endef

# Also the default target (just call `make`)
inputs-update:
nix flake update

########### tests
bats:
nix build .#checks.$(shell nix eval --impure --raw --expr builtins.currentSystem).bats-tests --no-link

########### local vms
local-vm:
$(call nix-vm-action,local,run,vm)

build-local-vm:
$(call nix-vm-action,local,build,vm)

########### nixos vms
nixos-run-vm:
$(call nix-vm-action,prox,run,vm)

nixos-build-vm:
$(call nix-vm-action,prox,build,vm)

########### nixos qemu
nixos-build-vm-qemu:
# Build standalone QEMU host package check output (no nixosConfigurations coupling).
$(eval QEMU_CHECK_SYSTEM := $(if $(filter Darwin,$(shell uname -s)),aarch64-darwin,x86_64-linux))
nix build .#packages.$(QEMU_CHECK_SYSTEM).qemu-host-package $(ARGS)

########### proxmox iso
nixos-build-prox-iso:
@if [ "x$(WHAT)" = "x" ]; then \
echo "Usage: make $@ WHAT=type"; echo; echo "Available vms:"; \
$(call VM_TYPES,prox); \
define standalone-home-build-action
@if [ "x$(TARGET)" = "x" ]; then \
echo "Usage: make $@ TARGET=profile [USERNAME=<name>] [REMOTE=false]"; \
echo; \
echo "Available $(1) home profiles:"; \
$(call home-targets-for-system,$(2)); \
exit 1; \
fi
# Proxmox VMs are x86_64 in this setup; use prox-* VM configs.
nix build $(call builder-opts) .#nixosConfigurations.prox-$(WHAT)vm.config.virtualisation.proxmox.iso $(ARGS)

########### nixos
nixos-build-target:
$(call nix-config-action,.#nixosConfigurations.$(WHAT).config.system.build.toplevel)

nixos-build:
nix build $(call builder-opts) .#nixosConfigurations.$(shell hostname).config.system.build.toplevel $(ARGS)

nixos-switch:
sudo nixos-rebuild switch --flake .#$(shell hostname) $(call builder-opts) $(ARGS)

disko-install:
@if [ "x$(WHAT)" = "x" -o "x$(DEV)" = "x" ]; then \
echo "Usage: make $@ WHAT=host DEV=/dev/XXX"; \
@if ! ($(call home-targets-for-system,$(2)) | grep -Fxq "$(TARGET)"); then \
echo "Unknown $(1) home profile: $(TARGET)"; \
echo; \
echo "Available $(1) home profiles:"; \
$(call home-targets-for-system,$(2)); \
exit 1; \
fi
sudo nix $(NIX_OPTS) run $(ARGS) \
'github:nix-community/disko/latest#disko-install' -- --flake .#$(WHAT) --disk main $(DEV)

########### darwin
darwin-build:
nix build .#darwinConfigurations.$(shell hostname).config.system.build.toplevel $(ARGS)

darwin-build-target:
$(call nix-config-action,.#darwinConfigurations.$(WHAT).system)
nix build $(call builder-opts) .#homeConfigurations.$(USERNAME)@$(TARGET).activationPackage $(ARGS)
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flake attribute path includes @ in the attribute name segment ($(USERNAME)@$(TARGET)), which is not a standard unquoted Nix identifier and is commonly represented as a quoted attribute (e.g., "user@profile" in nix flake show). To avoid selector parsing failures, quote/escape the $(USERNAME)@$(TARGET) segment when building homeConfigurations activation packages.

Suggested change
nix build $(call builder-opts) .#homeConfigurations.$(USERNAME)@$(TARGET).activationPackage $(ARGS)
nix build $(call builder-opts) ".#homeConfigurations.\"$(USERNAME)@$(TARGET)\".activationPackage" $(ARGS)

Copilot uses AI. Check for mistakes.
endef

darwin-switch:
sudo -H nix run nix-darwin -- switch --flake .#$(shell hostname) $(ARGS)
help:
@echo "Available targets:"
@echo " make nixos WHAT=<host> [REMOTE=false]"
@echo " make darwin WHAT=<host> [REMOTE=false]"
@echo " make linux-home TARGET=<profile> [USERNAME=<name>] [REMOTE=false]"
@echo " make darwin-home TARGET=<profile> [USERNAME=<name>] [REMOTE=false]"

switch:
@if [ "$(shell uname -s)" = "Darwin" ]; then \
$(MAKE) darwin-switch; \
elif [ "$(shell uname -s)" = "Linux" ]; then \
$(MAKE) nixos-switch; \
else \
echo "Unsupported OS: $(shell uname -s)" >&2; \
nixos:
@if [ "x$(WHAT)" = "x" ]; then \
echo "Usage: make $@ WHAT=host [REMOTE=false]"; \
exit 1; \
fi
@resolved="$(WHAT)"; \
known="$$(nix eval --json .#nixosConfigurations --apply builtins.attrNames | jq -r '.[]')"; \
if ! printf '%s\n' "$$known" | grep -Fxq "$$resolved"; then \
for candidate in "prox-$(WHAT)vm" "local-$(WHAT)vm"; do \
if printf '%s\n' "$$known" | grep -Fxq "$$candidate"; then \
resolved="$$candidate"; \
break; \
fi; \
done; \
fi; \
if ! printf '%s\n' "$$known" | grep -Fxq "$$resolved"; then \
echo "Unknown nixos host: $(WHAT)"; \
echo; \
echo "Available nixos hosts:"; \
printf '%s\n' "$$known"; \
exit 1; \
fi; \
nix build $(call builder-opts) ".#nixosConfigurations.$$resolved.config.system.build.toplevel" $(ARGS)

########### standalone home-manager
home-build-nv:
nix run nixpkgs#home-manager -- build --flake .#${USERNAME}@nv $(ARGS)
darwin:
$(call nix-config-action,.#darwinConfigurations.$(WHAT).system)

home-switch-nv:
nix run nixpkgs#home-manager -- switch --flake .#${USERNAME}@nv $(ARGS) $(HM_ARGS)
linux-home:
$(call standalone-home-build-action,linux,x86_64-linux)

############# raspberry pi
pi-image:
nix build .#nixosConfigurations.pi5.config.system.build.sdImage -o pi5.sd $(ARGS)
darwin-home:
$(call standalone-home-build-action,darwin,aarch64-darwin)
Loading
Loading