[PATCH 7/8] nixos: drop stale top-level nixos/ entrypoint

Daniel Gomez <[email protected]> Thu, 23 Apr 2026 00:48:45 +0200
Newsgroups dev.linux.lists.kdevops
Message-ID <20260423-kdevops-series-b-nixos-qemu-v1-7-209154ae54f8@samsung.com>
From: Daniel Gomez <[email protected]>

After the role refactor, per-node NixOS configurations are
rendered at scripts/nixos-qemu/configurations/<host>/default.nix
from the nixos-qemu flake. The top-level nixos/flake.nix
referenced ./generated/configuration.nix,
./generated/hardware-configuration.nix, and
./generated/workflow-deps.nix, all produced by the old inline
playbooks/templates/nixos/*.j2 templates that this series
deleted. Nothing in the new role reads nixos/flake.nix or writes
nixos/generated/, and neither path can evaluate anymore.

Remove nixos/flake.nix, drop the nixos/generated/ .gitignore
rule, strip the matching "rm -rf nixos/generated ..." line from
the clean_nixos_cache target in scripts/nixos.Makefile, and
update docs/kdevops-nixos.md to point at the new subtree layout.

Generated-by: Claude AI
Signed-off-by: Daniel Gomez <[email protected]>
---
 .gitignore             |  3 ---
 docs/kdevops-nixos.md  |  8 +++++---
 nixos/flake.nix        | 32 --------------------------------
 scripts/nixos.Makefile |  1 -
 4 files changed, 5 insertions(+), 39 deletions(-)

diff --git a/.gitignore b/.gitignore
index 89c2898e..ef2399e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -108,9 +108,6 @@ Kconfig.passthrough_libvirt.generated
 
 archive/
 
-# NixOS generated files
-nixos/generated/
-
 # Dyanmic cloud kconfig files
 terraform/datacrunch/kconfigs/Kconfig.compute.generated
 terraform/datacrunch/kconfigs/Kconfig.images.generated
diff --git a/docs/kdevops-nixos.md b/docs/kdevops-nixos.md
index f22fddf3..57c18e87 100644
--- a/docs/kdevops-nixos.md
+++ b/docs/kdevops-nixos.md
@@ -200,9 +200,11 @@ scripts/status_nixos.sh
 ### Key Configuration Files
 
 - `kconfigs/Kconfig.nixos`: NixOS-specific options
-- `nixos/flake.nix`: Nix flake for reproducible builds
-- `nixos/generated/`: Generated NixOS configurations
-- `playbooks/nixos.yml`: Ansible playbook for VM management
+- `scripts/nixos-qemu/`: Nix flake subtree with reusable NixOS modules
+  (libvirt and imageless backends, shares, storage, devel, workflows)
+- `scripts/nixos-qemu/configurations/<host>/default.nix`: per-node
+  NixOS configuration rendered by the role from the subtree's flake
+- `playbooks/roles/nixos/`: Ansible role that drives NIXOS bringup
 
 ### Configuration Options
 
diff --git a/nixos/flake.nix b/nixos/flake.nix
deleted file mode 100644
index 530d5980..00000000
--- a/nixos/flake.nix
+++ /dev/null
@@ -1,32 +0,0 @@
-{
-  description = "kdevops NixOS VMs";
-
-  inputs = {
-    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
-  };
-
-  outputs = { self, nixpkgs }: {
-    nixosConfigurations = {
-      "kdevops" = nixpkgs.lib.nixosSystem {
-        system = "x86_64-linux";
-        modules = [
-          ./generated/configuration.nix
-          ./generated/hardware-configuration.nix
-          ./generated/workflow-deps.nix
-          ({ ... }: {
-            networking.hostName = "kdevops";
-          })
-        ];
-      };
-    };
-
-    # Build all VMs
-    defaultPackage.x86_64-linux =
-      nixpkgs.legacyPackages.x86_64-linux.writeShellScriptBin "build-vms" ''
-        echo "Building NixOS VMs..."
-        echo "Building kdevops..."
-        nix build .#nixosConfigurations.kdevops.config.system.build.vm
-        echo "All VMs built successfully!"
-      '';
-  };
-}
diff --git a/scripts/nixos.Makefile b/scripts/nixos.Makefile
index 7ed49b05..44c606c2 100644
--- a/scripts/nixos.Makefile
+++ b/scripts/nixos.Makefile
@@ -87,7 +87,6 @@ clean_nixos_cache: destroy_nixos
 	$(Q)sudo /nix/store/*/bin/nix-collect-garbage -d 2>/dev/null || \
 		sudo nix-collect-garbage -d 2>/dev/null || \
 		echo "Warning: Could not run nix garbage collection"
-	$(Q)rm -rf nixos/generated nixos/result nixos/*.qcow2 2>/dev/null || true
 	$(Q)rm -rf /xfs1/libvirt/kdevops/nixos/nixos-image-* 2>/dev/null || true
 	$(Q)echo "NixOS cache cleaned"
 PHONY += clean_nixos_cache

-- 
2.53.0