Skip to content

feat: ini iso - #1471

Merged
shunkakinoki merged 1 commit into
mainfrom
iso
Apr 14, 2026
Merged

feat: ini iso#1471
shunkakinoki merged 1 commit into
mainfrom
iso

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Apr 14, 2026

Copy link
Copy Markdown
Owner

Summary by cubic

Add live/installer ISO and VM workflows for named hosts and introduce the viper host. Shared base modules reduce duplication, and new Makefile targets make it easy to build and run VMs or ISOs.

  • New Features

    • Makefile: build-vm, run-vm, and build-iso (copies to ./<host>.iso).
    • Shared modules: named-hosts/shared/linux-base.nix and live-iso.nix for reusable host/ISO config.
    • New host viper with QEMU guest profile, GRUB on /dev/vda, and VM settings; ISO variant included.
    • Flake outputs: maticIso, viper, and viperIso; tests added for VM and ISO builds.
  • Refactors

    • matic host now imports linux-base.nix to remove duplicated user/network/nix settings.
    • Clipboard script prefers wl-copy, then falls back to pbcopy and xclip.
    • Pushover script only sources .env when vars are unset; blank vars disable notifications; network errors don’t fail the script.
    • .gitignore now ignores *.iso.

Written for commit 58a4547. Summary will update on new commits.

@mesa-dot-dev

mesa-dot-dev Bot commented Apr 14, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Apr 14, 2026

Copy link
Copy Markdown
📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added commands for building and running virtual machines with customizable hosts
    • Added ISO image build functionality for system configurations
    • Added new NixOS host configurations
  • Bug Fixes

    • Improved credential handling and error handling in notification scripts
    • Optimized clipboard backend selection logic
  • Tests

    • Added evaluation checks for new system configurations

Walkthrough

The PR adds new NixOS host configurations for VM and ISO image builds with shared module extraction, introduces Make targets for building and running VMs and ISOs, refactors the existing "matic" host configuration into shared modules, and adds minor shell script logic updates for credential handling and backend selection ordering.

Changes

Cohort / File(s) Summary
Build infrastructure
.gitignore, Makefile
Added *.iso ignore pattern and three new Make targets (build-vm, run-vm, build-iso) for building/running NixOS VMs and ISO images with HOST parameter resolution.
Flake configuration
flake.nix
Added four new NixOS configuration entries: maticIso, viper, and viperIso under nixosConfigurations, each importing corresponding host modules.
Home-manager scripts
home-manager/modules/local-scripts/clipboard-copy.sh, home-manager/modules/local-scripts/pushover-notify.sh
Reordered clipboard backend selection logic to check Wayland before macOS; changed Pushover credential sourcing to distinguish unset vs. blank variables and exit gracefully on curl failure.
Shared NixOS modules
named-hosts/shared/linux-base.nix, named-hosts/shared/live-iso.nix
Added new parameterized NixOS modules: linux-base.nix for common host configuration (networking, user, Nix setup) and live-iso.nix for minimal live ISO images.
Matic host configuration
named-hosts/matic/default.nix, named-hosts/matic/iso.nix
Refactored default.nix to use shared linux-base.nix module (removing duplicated settings); added new iso.nix for matic ISO image builds.
Viper host configuration
named-hosts/viper/default.nix, named-hosts/viper/iso.nix
Added new viper host configuration with QEMU guest profile, GRUB bootloader, OpenSSH, and corresponding ISO image configuration.
Test configurations
tests/eval.nix
Added three new NixOS evaluation checks for matic-iso, viper, and viper-iso configurations (x86_64-linux only).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #714: Modifies the same "matic" host configuration entries and Makefile host detection logic, suggesting coordinated infrastructure changes.
  • PR #1259: Overlaps in Nix configuration settings for "matic" host, particularly channel management, nix-path forcing, and trusted-users setup.
  • PR #1222: Applies statix-driven style changes to the same named-hosts/matic/default.nix file affected by this PR's refactoring.

Suggested labels

enhancement

Poem

🐰 A rabbit builds homes in the Nix,
VMs and ISOs—now that's the mix!
Shared modules extracted with care,
New viper nests float through the air,
One hop closer to perfect config there! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat: ini iso' is vague and unclear—'ini' is ambiguous and does not convey the actual changes (ISO/VM workflows, new host, refactoring). Consider a more descriptive title like 'feat: add ISO and VM build workflows with viper host' to clearly communicate the main changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description is well-detailed and clearly related to the changeset, covering all major additions, features, and refactors with organized formatting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch iso

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mesa-dot-dev

mesa-dot-dev Bot commented Apr 14, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Added initial setup for ISO.

What changed?

File-level changes are not available.

Description generated by Mesa. Update settings

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces new NixOS configurations for the 'matic' and 'viper' hosts, including support for building live ISOs and a shared 'linux-base' module to streamline configuration. It also adds Makefile targets for building and running VMs and ISOs. Key feedback includes ensuring Makefile recipes use '&&' to prevent execution on build failure and resolving a username inconsistency in the evaluation tests for the 'matic' ISO.

Comment thread Makefile
Comment on lines +664 to +665
$(MAKE) build-vm HOST="$$host"; \
script=$$(find ./result/bin -maxdepth 1 -type f \( -name 'run-*-vm' -o -name 'run-nixos-vm' \) | head -n 1); \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The use of ; between the build command and the script lookup allows the recipe to continue even if the build fails. This can lead to executing a stale VM launcher from a previous build or a different host if ./result still exists. Use && to ensure the build succeeded before proceeding.

	$(MAKE) build-vm HOST="$$host" && \
	script=$$(find ./result/bin -maxdepth 1 -type f \( -name 'run-*-vm' -o -name 'run-nixos-vm' \) | head -n 1); \

Comment thread Makefile
Comment on lines +683 to +684
$(NIX_ALLOW_UNFREE) $(NIX_EXEC) build .#nixosConfigurations.$$host"Iso".config.system.build.isoImage $(NIX_FLAGS) --impure --show-trace; \
iso_path=$$(find ./result -type f -name '*.iso' | head -n 1); \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using ; here allows the find and cp commands to run even if the nix build command fails. This could result in copying an ISO from a previous build (potentially for a different host) to the current host's destination. Use && to chain these commands.

	$(NIX_ALLOW_UNFREE) $(NIX_EXEC) build .#nixosConfigurations.$$host"Iso".config.system.build.isoImage $(NIX_FLAGS) --impure --show-trace && \
	iso_path=$$(find ./result -type f -name '*.iso' | head -n 1); \

Comment thread tests/eval.nix
mkEvalCheck "nixos-matic-iso"
(import ../named-hosts/matic/iso.nix {
inherit inputs;
username = "shunkakinoki";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The username used here (shunkakinoki) is inconsistent with the username defined for the maticIso host in flake.nix (skakinoki). This discrepancy means the evaluation test is not checking the actual configuration intended for this host.

          username = "skakinoki";

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

4 issues found across 12 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="home-manager/modules/local-scripts/pushover-notify.sh">

<violation number="1" location="home-manager/modules/local-scripts/pushover-notify.sh:17">
P2: This fallback still loads `~/.env` when one credential is intentionally blank and the other is unset, so an explicit disable can be overridden. Only source fallback credentials when both variables are truly unset.</violation>
</file>

<file name="named-hosts/viper/default.nix">

<violation number="1" location="named-hosts/viper/default.nix:26">
P1: Do not ship this host with a hard-coded known password; it creates a trivially guessable admin login.</violation>
</file>

<file name="Makefile">

<violation number="1" location="Makefile:645">
P2: Restrict the auto-detected fallback to hosts that actually have a NixOS VM output. As written, `HOST` omitted on `galactica` resolves to a missing `nixosConfigurations.galactica` attribute and the target fails.</violation>
</file>

<file name="named-hosts/shared/linux-base.nix">

<violation number="1" location="named-hosts/shared/linux-base.nix:7">
P0: Do not ship this base module with a known default password; it creates a trivial path to root on fresh installs.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

username,
hostname,
userExtraGroups ? [ ],
userInitialPassword ? "changemeow",

@cubic-dev-ai cubic-dev-ai Bot Apr 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P0: Do not ship this base module with a known default password; it creates a trivial path to root on fresh installs.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At named-hosts/shared/linux-base.nix, line 7:

<comment>Do not ship this base module with a known default password; it creates a trivial path to root on fresh installs.</comment>

<file context>
@@ -0,0 +1,46 @@
+  username,
+  hostname,
+  userExtraGroups ? [ ],
+  userInitialPassword ? "changemeow",
+  stateVersion ? "24.11",
+}:
</file context>
Fix with Cubic

(import ../shared/linux-base.nix {
inherit inputs pkgs username;
hostname = "viper";
userInitialPassword = "test";

@cubic-dev-ai cubic-dev-ai Bot Apr 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: Do not ship this host with a hard-coded known password; it creates a trivially guessable admin login.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At named-hosts/viper/default.nix, line 26:

<comment>Do not ship this host with a hard-coded known password; it creates a trivially guessable admin login.</comment>

<file context>
@@ -0,0 +1,65 @@
+    (import ../shared/linux-base.nix {
+      inherit inputs pkgs username;
+      hostname = "viper";
+      userInitialPassword = "test";
+    })
+    (
</file context>
Fix with Cubic

if [[ -z ${PUSHOVER_API_TOKEN:-} ]] || [[ -z ${PUSHOVER_USER_KEY:-} ]]; then
# Source credentials only when the vars are unset. Explicitly blank values
# should disable notifications instead of falling back to ~/.env.
if [[ -z ${PUSHOVER_API_TOKEN+x} ]] || [[ -z ${PUSHOVER_USER_KEY+x} ]]; then

@cubic-dev-ai cubic-dev-ai Bot Apr 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: This fallback still loads ~/.env when one credential is intentionally blank and the other is unset, so an explicit disable can be overridden. Only source fallback credentials when both variables are truly unset.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At home-manager/modules/local-scripts/pushover-notify.sh, line 17:

<comment>This fallback still loads `~/.env` when one credential is intentionally blank and the other is unset, so an explicit disable can be overridden. Only source fallback credentials when both variables are truly unset.</comment>

<file context>
@@ -12,8 +12,9 @@ priority="${3:-0}"
-if [[ -z ${PUSHOVER_API_TOKEN:-} ]] || [[ -z ${PUSHOVER_USER_KEY:-} ]]; then
+# Source credentials only when the vars are unset. Explicitly blank values
+# should disable notifications instead of falling back to ~/.env.
+if [[ -z ${PUSHOVER_API_TOKEN+x} ]] || [[ -z ${PUSHOVER_USER_KEY+x} ]]; then
   if [[ -f "$HOME/dotfiles/.env" ]]; then
     set -a
</file context>
Suggested change
if [[ -z ${PUSHOVER_API_TOKEN+x} ]] || [[ -z ${PUSHOVER_USER_KEY+x} ]]; then
if [[ -z ${PUSHOVER_API_TOKEN+x} ]] && [[ -z ${PUSHOVER_USER_KEY+x} ]]; then
Fix with Cubic

Comment thread Makefile
build-vm: ## Build a named host VM launcher (set HOST=<name>, e.g. make build-vm HOST=viper).
@host="$(HOST)"; \
if [ -z "$$host" ]; then \
host="$(DETECTED_HOST)"; \

@cubic-dev-ai cubic-dev-ai Bot Apr 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Restrict the auto-detected fallback to hosts that actually have a NixOS VM output. As written, HOST omitted on galactica resolves to a missing nixosConfigurations.galactica attribute and the target fails.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At Makefile, line 645:

<comment>Restrict the auto-detected fallback to hosts that actually have a NixOS VM output. As written, `HOST` omitted on `galactica` resolves to a missing `nixosConfigurations.galactica` attribute and the target fails.</comment>

<file context>
@@ -638,6 +638,57 @@ nix-setup-offline: ## Set up offline environment.
+build-vm: ## Build a named host VM launcher (set HOST=<name>, e.g. make build-vm HOST=viper).
+	@host="$(HOST)"; \
+	if [ -z "$$host" ]; then \
+		host="$(DETECTED_HOST)"; \
+	fi; \
+	if [ -z "$$host" ]; then \
</file context>
Fix with Cubic

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
named-hosts/viper/iso.nix (1)

1-29: LGTM!

The ISO configuration correctly wires all parameters through to the shared live-iso.nix module. The structure properly:

  • Creates a customized pkgs with overlays and config
  • Passes required parameters (inputs, pkgs, username, hostname, userInitialPassword) to the shared module
  • Returns a valid nixosSystem for x86_64-linux

Note: This file is nearly identical to matic/iso.nix. Consider extracting a shared mkIsoConfig helper if more hosts are added, though the current duplication is acceptable for two hosts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@named-hosts/viper/iso.nix` around lines 1 - 29, Extract the duplicated ISO
wiring into a shared helper (e.g., mkIsoConfig) and replace the near-identical
bodies in viper/iso.nix and matic/iso.nix with calls to that helper; the helper
should accept parameters used in the diff (inputs, username, system,
overlays/nixpkgsConfig or a prebuilt pkgs) and invoke import
../shared/live-iso.nix with inherit inputs pkgs username and allow passing
hostname and userInitialPassword, so both files simply construct any
host-specific values then call mkIsoConfig(hostname, userInitialPassword,
username, inputs).
named-hosts/viper/default.nix (1)

54-61: Redundant initialPassword override in vmVariant.

Line 26 already passes userInitialPassword = "test" to linux-base.nix, which sets users.users.${username}.initialPassword. The lib.mkForce "test" on line 60 is redundant unless the intent is to guard against future changes to the base module's default.

If intentional as a safeguard, consider adding a brief comment. Otherwise, the duplicate can be removed.

🔧 Proposed simplification (if not needed as safeguard)
         virtualisation.vmVariant = {
           virtualisation = {
             graphics = false;
             memorySize = 4096;
             cores = 4;
           };
-          users.users.${username}.initialPassword = lib.mkForce "test";
         };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@named-hosts/viper/default.nix` around lines 54 - 61, The
users.users.${username}.initialPassword override inside virtualisation.vmVariant
currently forces "test" with lib.mkForce while the same value is already passed
as userInitialPassword = "test" into linux-base.nix; remove the redundant
users.users.${username}.initialPassword = lib.mkForce "test" line from
virtualisation.vmVariant unless you intentionally want a safeguard against
base-module changes—if it is intentional, replace the override with a short
comment explaining that it is a deliberate hard-force protection and reference
userInitialPassword and linux-base.nix so future readers understand why both
exist.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@flake.nix`:
- Around line 137-148: The usernames are inconsistent: flake.nix sets matic and
maticIso to username = "skakinoki" while viper and viperIso use "shunkakinoki",
and tests/eval.nix evaluates the module with "shunkakinoki"; decide which is
correct and make them consistent — either change matic and maticIso in flake.nix
(symbols: matic, maticIso) to username = "shunkakinoki" to match tests and
viper, or update tests/eval.nix to use "skakinoki" if the split is intentional;
ensure the same username value is used wherever the same host/module is
evaluated so the test exercises the deployed configuration.

---

Nitpick comments:
In `@named-hosts/viper/default.nix`:
- Around line 54-61: The users.users.${username}.initialPassword override inside
virtualisation.vmVariant currently forces "test" with lib.mkForce while the same
value is already passed as userInitialPassword = "test" into linux-base.nix;
remove the redundant users.users.${username}.initialPassword = lib.mkForce
"test" line from virtualisation.vmVariant unless you intentionally want a
safeguard against base-module changes—if it is intentional, replace the override
with a short comment explaining that it is a deliberate hard-force protection
and reference userInitialPassword and linux-base.nix so future readers
understand why both exist.

In `@named-hosts/viper/iso.nix`:
- Around line 1-29: Extract the duplicated ISO wiring into a shared helper
(e.g., mkIsoConfig) and replace the near-identical bodies in viper/iso.nix and
matic/iso.nix with calls to that helper; the helper should accept parameters
used in the diff (inputs, username, system, overlays/nixpkgsConfig or a prebuilt
pkgs) and invoke import ../shared/live-iso.nix with inherit inputs pkgs username
and allow passing hostname and userInitialPassword, so both files simply
construct any host-specific values then call mkIsoConfig(hostname,
userInitialPassword, username, inputs).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e4b8e354-5e08-46dc-8db6-9b69fa12ad99

📥 Commits

Reviewing files that changed from the base of the PR and between c977aab and 58a4547.

📒 Files selected for processing (12)
  • .gitignore
  • Makefile
  • flake.nix
  • home-manager/modules/local-scripts/clipboard-copy.sh
  • home-manager/modules/local-scripts/pushover-notify.sh
  • named-hosts/matic/default.nix
  • named-hosts/matic/iso.nix
  • named-hosts/shared/linux-base.nix
  • named-hosts/shared/live-iso.nix
  • named-hosts/viper/default.nix
  • named-hosts/viper/iso.nix
  • tests/eval.nix

Comment thread flake.nix
Comment on lines +137 to +148
maticIso = import ./named-hosts/matic/iso.nix {
inherit inputs;
username = "skakinoki";
};
viper = import ./named-hosts/viper {
inherit inputs;
username = "shunkakinoki";
};
viperIso = import ./named-hosts/viper/iso.nix {
inherit inputs;
username = "shunkakinoki";
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Username inconsistency between flake.nix and tests/eval.nix.

The maticIso configuration uses username = "skakinoki" here, but tests/eval.nix evaluates the same module with username = "shunkakinoki" (line 81). While the evaluation check will still pass, this means the test doesn't exercise the exact configuration that will be deployed.

Also note the username difference between hosts:

  • matic/maticIso: "skakinoki"
  • viper/viperIso: "shunkakinoki"

If this is intentional (different hosts for different users), no action needed. If "skakinoki" is a typo for "shunkakinoki", consider aligning them.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@flake.nix` around lines 137 - 148, The usernames are inconsistent: flake.nix
sets matic and maticIso to username = "skakinoki" while viper and viperIso use
"shunkakinoki", and tests/eval.nix evaluates the module with "shunkakinoki";
decide which is correct and make them consistent — either change matic and
maticIso in flake.nix (symbols: matic, maticIso) to username = "shunkakinoki" to
match tests and viper, or update tests/eval.nix to use "skakinoki" if the split
is intentional; ensure the same username value is used wherever the same
host/module is evaluated so the test exercises the deployed configuration.

@shunkakinoki
shunkakinoki merged commit c321ec0 into main Apr 14, 2026
40 checks passed
@shunkakinoki
shunkakinoki deleted the iso branch April 14, 2026 05:38
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