diff --git a/pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs b/pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs index 61932cb55591..44047cbbb684 100644 --- a/pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs +++ b/pkgs/by-name/sw/switch-to-configuration-ng/src/src/main.rs @@ -970,10 +970,6 @@ fn do_system_switch(action: Action) -> anyhow::Result<()> { std::env::set_var("LOCALE_ARCHIVE", locale_archive); } - let current_system_bin = std::path::PathBuf::from("/run/current-system/sw/bin") - .canonicalize() - .context("/run/current-system/sw/bin is missing")?; - let os_release = parse_os_release().context("Failed to parse os-release")?; let distro_id_re = Regex::new(format!("^\"?{}\"?$", distro_id).as_str()) @@ -1033,6 +1029,11 @@ fn do_system_switch(action: Action) -> anyhow::Result<()> { std::process::exit(0); } + // Needs to be after the "boot" action exits, as this directory will not exist when doing a NIXOS_LUSTRATE install + let current_system_bin = std::path::PathBuf::from("/run/current-system/sw/bin") + .canonicalize() + .context("/run/current-system/sw/bin is missing")?; + let current_init_interface_version = std::fs::read_to_string("/run/current-system/init-interface-version").unwrap_or_default();