git.delta.rocks / jrsonnet / refs/commits / d58560c49134

difftreelog

refactor! disable sd-image module from sd-image target

Yaroslav Bolyukin2023-05-01parent: #15ef984.patch.diff
in: trunk

3 files changed

modifiedcmds/fleet/src/cmds/build_systems.rsdiffbeforeafterboth
--- a/cmds/fleet/src/cmds/build_systems.rs
+++ b/cmds/fleet/src/cmds/build_systems.rs
@@ -133,7 +133,14 @@
 			)
 			.args(&config.nix_args);
 
-		nix_build.run_nix().await?;
+		nix_build.run_nix().await.map_err(|e| {
+			if action.build_attr() == "sdImage" {
+				info!("sd-image build failed");
+				info!("Make sure you have imported modulesPath/installer/sd-card/sd-image-<arch>[-installer].nix (For installer, you may want to check config)");
+				info!("This module was automatically imported before, but was removed for better customization")
+			}
+			e
+		})?;
 		let built = std::fs::canonicalize(built)?;
 
 		match action {
modifiedlib/default.nixdiffbeforeafterboth
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -53,13 +53,21 @@
         inherit configuredHosts configuredSecrets configuredSystems;
         configUnchecked = root.config;
         buildSystems = {
-          toplevel = builtins.mapAttrs (_name: value: value.config.system.build.toplevel) (configuredSystemsWithExtraModules [ ]);
+          toplevel = builtins.mapAttrs (_name: value: value.config.system.build.toplevel) (configuredSystemsWithExtraModules [
+            ({...}: {
+              buildTarget = "toplevel";
+            })
+          ]);
           sdImage = builtins.mapAttrs (_name: value: value.config.system.build.sdImage) (configuredSystemsWithExtraModules [
-            (nixpkgs + "/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix")
+            #(nixpkgs + "/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix")
+            ({...}: {
+              buildTarget = "sd-image";
+            })
           ]);
           installationCd = builtins.mapAttrs (_name: value: value.config.system.build.isoImage) (configuredSystemsWithExtraModules [
             (nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix")
             ({ lib, ... }: {
+              buildTarget = "installation-cd";
               # Needed for https://github.com/NixOS/nixpkgs/issues/58959
               boot.supportedFilesystems = lib.mkForce [ "btrfs" "reiserfs" "vfat" "f2fs" "xfs" "ntfs" "cifs" ];
             })
modifiednixos/meta.nixdiffbeforeafterboth
24 };24 };
25 description = "Network definition of host";25 description = "Network definition of host";
26 };26 };
27 buildTarget = mkOption {
28 type = enum ["toplevel" "sd-image" "installation-cd"];
29 };
27 };30 };
28 config = {31 config = {
29 tags = [ "all" ];32 tags = [ "all" ];