Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

Merge pull request #267985 from JulienMalka/absent-bootspec

authored by Ryan Lahfa and committed by GitHub 65481ecf ccfe07c3

+44 -3
+14 -3
nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
··· 88 89 90 def get_bootspec(profile: str | None, generation: int) -> BootSpec: 91 - boot_json_path = os.path.realpath("%s/%s" % (system_dir(profile, generation, None), "boot.json")) 92 - boot_json_f = open(boot_json_path, 'r') 93 - bootspec_json = json.load(boot_json_f) 94 return bootspec_from_json(bootspec_json) 95 96 def bootspec_from_json(bootspec_json: Dict) -> BootSpec:
··· 88 89 90 def get_bootspec(profile: str | None, generation: int) -> BootSpec: 91 + system_directory = system_dir(profile, generation, None) 92 + boot_json_path = os.path.realpath("%s/%s" % (system_directory, "boot.json")) 93 + if os.path.isfile(boot_json_path): 94 + boot_json_f = open(boot_json_path, 'r') 95 + bootspec_json = json.load(boot_json_f) 96 + else: 97 + boot_json_str = subprocess.check_output([ 98 + "@bootspecTools@/bin/synthesize", 99 + "--version", 100 + "1", 101 + system_directory, 102 + "/dev/stdout"], 103 + universal_newlines=True) 104 + bootspec_json = json.loads(boot_json_str) 105 return bootspec_from_json(bootspec_json) 106 107 def bootspec_from_json(bootspec_json: Dict) -> BootSpec:
+2
nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
··· 16 17 systemd = config.systemd.package; 18 19 nix = config.nix.package.out; 20 21 timeout = optionalString (config.boot.loader.timeout != null) config.boot.loader.timeout;
··· 16 17 systemd = config.systemd.package; 18 19 + bootspecTools = pkgs.bootspec; 20 + 21 nix = config.nix.package.out; 22 23 timeout = optionalString (config.boot.loader.timeout != null) config.boot.loader.timeout;
+16
nixos/tests/systemd-boot.nix
··· 277 machine.wait_for_unit("multi-user.target") 278 ''; 279 }; 280 }
··· 277 machine.wait_for_unit("multi-user.target") 278 ''; 279 }; 280 + 281 + no-bootspec = makeTest 282 + { 283 + name = "systemd-boot-no-bootspec"; 284 + meta.maintainers = with pkgs.lib.maintainers; [ julienmalka ]; 285 + 286 + nodes.machine = { 287 + imports = [ common ]; 288 + boot.bootspec.enable = false; 289 + }; 290 + 291 + testScript = '' 292 + machine.start() 293 + machine.wait_for_unit("multi-user.target") 294 + ''; 295 + }; 296 }
+12
pkgs/tools/misc/bootspec/default.nix
··· 1 { lib 2 , rustPlatform 3 , fetchFromGitHub 4 }: 5 rustPlatform.buildRustPackage rec { 6 pname = "bootspec"; ··· 12 rev = "v${version}"; 13 hash = "sha256-5IGSMHeL0eKfl7teDejAckYQjc8aeLwfwIQSzQ8YaAg="; 14 }; 15 16 cargoHash = "sha256-eGSKVHjPnHK7WyGkO5LIjocNGHawahYQR3H5Lgk1C9s="; 17
··· 1 { lib 2 , rustPlatform 3 , fetchFromGitHub 4 + , fetchpatch 5 }: 6 rustPlatform.buildRustPackage rec { 7 pname = "bootspec"; ··· 13 rev = "v${version}"; 14 hash = "sha256-5IGSMHeL0eKfl7teDejAckYQjc8aeLwfwIQSzQ8YaAg="; 15 }; 16 + 17 + patches = [ 18 + # https://github.com/DeterminateSystems/bootspec/pull/127 19 + # Fixes the synthesize tool for aarch64-linux 20 + (fetchpatch { 21 + name = "aarch64-support.patch"; 22 + url = "https://github.com/DeterminateSystems/bootspec/commit/1d0e925f360f0199f13422fb7541225fd162fd4f.patch"; 23 + sha256 = "sha256-wU/jWnOqVBrU2swANdXbQfzRpNd/JIS4cxSyCvixZM0="; 24 + }) 25 + 26 + ]; 27 28 cargoHash = "sha256-eGSKVHjPnHK7WyGkO5LIjocNGHawahYQR3H5Lgk1C9s="; 29