difftreelog
feat introduce toplevel-fleet build attribute
in: trunk
3 files changed
cmds/fleet/src/cmds/build_systems.rsdiffbeforeafterboth--- a/cmds/fleet/src/cmds/build_systems.rs
+++ b/cmds/fleet/src/cmds/build_systems.rs
@@ -22,9 +22,9 @@
#[derive(Parser, Clone)]
pub struct BuildSystems {
- /// Attribute to build. Systems are deployed from "toplevel" attr, well-known used attributes
+ /// Attribute to build. Systems are deployed from "toplevel-fleet" attr, well-known used attributes
/// are "sdImage"/"isoImage", and your configuration may include any other build attributes.
- #[clap(long, default_value = "toplevel")]
+ #[clap(long, default_value = "toplevel-fleet")]
build_attr: String,
}
@@ -114,7 +114,7 @@
set.spawn_local(
(async move {
- let built = match build_task(config.clone(), hostname.clone(), "toplevel").await
+ let built = match build_task(config.clone(), hostname.clone(), "toplevel-fleet").await
{
Ok(path) => path,
Err(e) => {
modules/nixos/module-list.nixdiffbeforeafterboth--- a/modules/nixos/module-list.nix
+++ b/modules/nixos/module-list.nix
@@ -4,4 +4,5 @@
./rollback.nix
./nix-sign.nix
./online.nix
+ ./top-level.nix
]
modules/nixos/top-level.nixdiffbeforeafterboth1{2 pkgs,3 config,4 lib,5}:6let7 inherit (lib.strings) optionalString;8 # FIXME: Should not be copy-pasted, instead nixpkgs should export systemBuilder directly9 systemBuilder = ''10 mkdir $out1112 ${13 ifconfig.boot.initrd.enable&&config.boot.initrd.systemd.enablethen14''15 # This must not be a symlink or the abs_path of the grub builder for the tests16 # will resolve the symlink and we end up with a path that doesn't point to a17 # system closure.18 cp "$systemd/lib/systemd/systemd" $out/init1920 ${lib.optionalString(!config.system.nixos-init.enable)''21 cp ${config.system.build.bootStage2} $out/prepare-root22 substituteInPlace $out/prepare-root --subst-var-by systemConfig $out23 ''}24 ''25else26''27 cp ${config.system.build.bootStage2} $out/init28 substituteInPlace $out/init --subst-var-by systemConfig $out29 ''30 }3132 ln -s ${config.system.build.etc}/etc $out/etc3334 ${lib.optionalStringconfig.system.etc.overlay.enable''35 ln -s ${config.system.build.etcMetadataImage} $out/etc-metadata-image36 ln -s ${config.system.build.etcBasedir} $out/etc-basedir37 ''}3839 ln -s ${config.system.path} $out/sw40 ln -s "$systemd" $out/systemd4142 echo -n "systemd ${toStringconfig.systemd.package.interfaceVersion}" > $out/init-interface-version43 echo -n "$nixosLabel" > $out/nixos-version44 echo -n "${config.boot.kernelPackages.stdenv.hostPlatform.system}" > $out/system4546 ${config.system.systemBuilderCommands}4748 cp "$extraDependenciesPath" "$out/extra-dependencies"4950 ${config.boot.bootspec.writer}51 ${optionalStringconfig.boot.bootspec.enableValidation''${config.boot.bootspec.validator} "$out/${config.boot.bootspec.filename}"''}52 '';53in54{55 system.build.toplevel-fleet = pkgs.stdenvNoCC.mkDerivation (56 {57 name = "nixos-system-${config.system.name}-${config.system.nixos.label}";58 preferLocalBuild = true;59 allowSubstitutes = false;60 passAsFile = [ "extraDependencies" ];61 buildCommand = systemBuilder;6263 systemd = config.systemd.package;6465 nixosLabel = config.system.nixos.label;6667 inherit (config.system) extraDependencies;68 }69 // config.system.systemBuilderArgs70 );71}