mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 20:25:32 +03:00
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.
This commit is contained in:
parent
b6eaf97c69
commit
9ed29c65a4
1 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue