From 9ed29c65a47a9e754f557e1b0258aa37d3a5849b Mon Sep 17 00:00:00 2001 From: Angelo Bulfone Date: Wed, 19 Mar 2025 00:32:09 -0700 Subject: [PATCH] nixos/limine: Fix reading generations and specialisations Previously, all generations for the primary system profile read their data from the currently active one rather than their own path, and specialisations in general all used their parent bootspec rather than their own. This fixes both issues. This commit still uses the parent path's build date for specialisations, but this is more minor issue and the times shouldn't be meaningfully different in most cases anyways. --- .../system/boot/loader/limine/limine-install.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/nixos/modules/system/boot/loader/limine/limine-install.py b/nixos/modules/system/boot/loader/limine/limine-install.py index 1db63aa271aa..44dee4645e05 100644 --- a/nixos/modules/system/boot/loader/limine/limine-install.py +++ b/nixos/modules/system/boot/loader/limine/limine-install.py @@ -29,10 +29,12 @@ def config(*path: List[str]) -> Optional[Any]: def get_system_path(profile: str = 'system', gen: Optional[str] = None, spec: Optional[str] = None) -> str: + basename = f'{profile}-{gen}-link' if gen is not None else profile + profiles_dir = '/nix/var/nix/profiles' if profile == 'system': - result = os.path.join('/nix', 'var', 'nix', 'profiles', 'system') + result = os.path.join(profiles_dir, basename) else: - result = os.path.join('/nix', 'var', 'nix', 'profiles', 'system-profiles', profile + f'-{gen}-link' if gen is not None else '') + result = os.path.join(profiles_dir, 'system-profiles', basename) if spec is not None: result = os.path.join(result, 'specialisation', spec) @@ -169,8 +171,8 @@ def generate_config_entry(profile: str, gen: str) -> str: boot_spec = bootjson_to_bootspec(boot_json) entry = config_entry(2, boot_spec, f'Generation {gen}', time) - for spec in boot_spec.specialisations: - entry += config_entry(2, boot_spec, f'Generation {gen}, Specialisation {spec}', str(time)) + for spec, spec_boot_spec in boot_spec.specialisations.items(): + entry += config_entry(2, spec_boot_spec, f'Generation {gen}, Specialisation {spec}', str(time)) return entry