summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2024-06-29 18:43:00 +0200
committerJörg Thalheim <joerg@thalheim.io>2024-06-29 19:09:38 +0200
commitebfee308fc25d61b53ea2313a12ec624a393ebd0 (patch)
treec29656c93dd8f5a604f5356ebf5a9c7ace148229
parent6d0be2bec14cea77fa731444a4de146a4822938e (diff)
systemd-boot-builder: use type literals
-rw-r--r--nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
index 393f42670bc3..71ef8695c2d8 100644
--- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
+++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
@@ -12,7 +12,7 @@ import subprocess
import sys
import warnings
import json
-from typing import NamedTuple, Dict, List
+from typing import NamedTuple, Any
from dataclasses import dataclass
# These values will be replaced with actual values during the package build
@@ -38,11 +38,11 @@ class BootSpec:
init: str
initrd: str
kernel: str
- kernelParams: List[str] # noqa: N815
+ kernelParams: list[str] # noqa: N815
label: str
system: str
toplevel: str
- specialisations: Dict[str, "BootSpec"]
+ specialisations: dict[str, "BootSpec"]
sortKey: str # noqa: N815
initrdSecrets: str | None = None # noqa: N815
@@ -51,7 +51,7 @@ libc = ctypes.CDLL("libc.so.6")
FILE = None | int
-def run(cmd: List[str], stdout: FILE = None) -> subprocess.CompletedProcess[str]:
+def run(cmd: list[str], stdout: FILE = None) -> subprocess.CompletedProcess[str]:
return subprocess.run(cmd, check=True, text=True, stdout=stdout)
class SystemIdentifier(NamedTuple):
@@ -130,7 +130,7 @@ def get_bootspec(profile: str | None, generation: int) -> BootSpec:
bootspec_json = json.loads(boot_json_str)
return bootspec_from_json(bootspec_json)
-def bootspec_from_json(bootspec_json: Dict) -> BootSpec:
+def bootspec_from_json(bootspec_json: dict[str, Any]) -> BootSpec:
specialisations = bootspec_json['org.nixos.specialisation.v1']
specialisations = {k: bootspec_from_json(v) for k, v in specialisations.items()}
systemdBootExtension = bootspec_json.get('org.nixos.systemd-boot', {})