Skip to content

Comments

Get rid of most of make targets#170

Merged
booxter merged 23 commits intomasterfrom
get-rid-of-make-targets
Feb 24, 2026
Merged

Get rid of most of make targets#170
booxter merged 23 commits intomasterfrom
get-rid-of-make-targets

Conversation

@booxter
Copy link
Owner

@booxter booxter commented Feb 23, 2026

  • Remove inputs-update target
  • Define default make target to print available targets
  • Untangle update script from make
  • flake: add fleet-upgrade app for machine updates
  • flake: expose pi-image package and drop make target
  • formatter: keep trailing newline in Makefile
  • make: remove switch convenience targets
  • make: drop unused local build convenience targets
  • make: remove bats convenience target
  • docs: clarify local test commands
  • make: clarify REMOTE support for darwin build target
  • ci: build qemu attrs directly and drop make wrapper
  • make: drop nixos-run-vm target
  • ci: drop nixos-build-vm make target
  • ci: use platform-specific home-manager build targets
  • apps: make fleet-apply a dispatcher for deploy and home
  • apps: add disko mode to fleet-apply and remove make target
  • apps: add vm app and drop make local-vm target
  • make: rename build targets and improve nixos host resolution
  • apps: rename fleet app to fleet-deploy and simplify docs
  • apps: add pinned get-local-builders app for make

Copilot AI review requested due to automatic review settings February 23, 2026 00:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR significantly refactors the repository's build and deployment infrastructure by removing most Makefile targets and replacing them with Nix flake apps. The Makefile is simplified to serve as a convenience wrapper for basic build commands, while more complex operations (fleet deployments, VM management, disk provisioning) are now implemented as proper flake apps. The update-machines.sh script is untangled from make dependencies and calls nix/nixos-rebuild commands directly.

Changes:

  • Simplified Makefile to 4 core targets (nixos, darwin, linux-home, darwin-home) with automatic VM host resolution
  • Added lib/fleet.nix with flake apps for fleet-deploy, vm, and get-local-builders
  • Auto-generated homeConfigurations for all Darwin hosts from darwinHosts attribute set
  • Updated CI workflow commands (but with critical bugs in target names)
  • Configured mbake formatter to ensure trailing newlines in Makefile

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
scripts/update-machines.sh Removed make target dependency, now directly calls nix-darwin/nixos-rebuild
lib/fleet.nix New file implementing fleet-deploy (with --home and --disko modes), vm, and get-local-builders apps
flake.nix Integrated fleet apps/packages, auto-generates homeConfigurations for Darwin hosts, updated formatter config
README.md Updated documentation to reflect new flake app commands and simplified Makefile usage
Makefile Streamlined to 4 build targets with smart host resolution; removed 20+ convenience targets
.github/workflows/build-targets.yml Updated build commands to use new target names (but contains critical bugs)
.bake.toml New configuration file for mbake formatter to ensure final newlines

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{ 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-build-target TARGET=nv USERNAME=ihrachyshka", os: "ubuntu-latest" },
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The make target linux-home-build-target does not exist in the new Makefile. Based on the Makefile changes, this should be linux-home (not linux-home-build-target).

Suggested change
{ name: "home-manager nv (x86_64-linux)", cmd: "make linux-home-build-target TARGET=nv USERNAME=ihrachyshka", os: "ubuntu-latest" },
{ name: "home-manager nv (x86_64-linux)", cmd: "make linux-home TARGET=nv USERNAME=ihrachyshka", os: "ubuntu-latest" },

Copilot uses AI. Check for mistakes.
{ 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-build-target TARGET=nv USERNAME=ihrachyshka", os: "ubuntu-latest" },
{ name: "home-manager mair (aarch64-darwin)", cmd: "make darwin-home-build-target TARGET=mair USERNAME=ihrachyshka", os: "macos-26" },
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The make target darwin-home-build-target does not exist in the new Makefile. Based on the Makefile changes, this should be darwin-home (not darwin-home-build-target).

Suggested change
{ name: "home-manager mair (aarch64-darwin)", cmd: "make darwin-home-build-target TARGET=mair USERNAME=ihrachyshka", os: "macos-26" },
{ name: "home-manager mair (aarch64-darwin)", cmd: "make darwin-home TARGET=mair USERNAME=ihrachyshka", os: "macos-26" },

Copilot uses AI. Check for mistakes.
Comment on lines 101 to 103
{ 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" },
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The make target darwin-build-target does not exist in the new Makefile. Based on the Makefile changes, this should be darwin (not darwin-build-target).

Suggested change
{ 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: "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" },

Copilot uses AI. Check for mistakes.
@booxter booxter enabled auto-merge February 23, 2026 00:33
Copilot AI review requested due to automatic review settings February 24, 2026 02:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +428 to +436
os="$(uname -s)"
host_name="$(hostname)"
case "$os" in
Darwin)
sudo -H nix run nix-darwin -- switch --flake ".#${host_name}" -L --show-trace
;;
Linux)
sudo nixos-rebuild switch --flake ".#${host_name}" -L --show-trace
;;
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.

host_name is derived from hostname (no -s/-f fallback), but flake configuration names commonly use the short hostname. If hostname returns an FQDN (or a value that doesn’t match the flake attr name), the --flake ".#${host_name}" lookup will fail. Consider matching the existing is_local_host logic (e.g., prefer hostname -s with a fallback) so the attribute name resolution is consistent and robust.

Copilot uses AI. Check for mistakes.
Comment on lines 343 to +353
basePackages = import ./pkgs inputs.nixpkgs.legacyPackages.${system};
fleetPackages = {
pi-image = self.nixosConfigurations.pi5.config.system.build.sdImage;
};
proxmox = import ./lib/proxmox-apps.nix {
inherit inputs system;
};
in
basePackages
// proxmox.packages
// fleetPackages
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.

pi-image is added to packages for every system, but the referenced derivation comes from self.nixosConfigurations.pi5 (likely aarch64-linux). This makes packages.<non-aarch64-linux>.pi-image point to a derivation for a different system, which is surprising for flake consumers and can break builds/evaluation in environments without appropriate remote builders. Prefer exposing pi-image only under the matching system (e.g., optionalAttrs (system == "aarch64-linux")) or otherwise structure it so packages.${system}.pi-image is buildable for that system.

Copilot uses AI. Check for mistakes.

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.
@booxter booxter merged commit d5775ae into master Feb 24, 2026
28 checks passed
@booxter booxter deleted the get-rid-of-make-targets branch February 24, 2026 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant