git.iko.soy/typeable/nixpkgs
on master help sign in
systemd-boot: Support initrd secrets
commitb09490a3229dd5ac4169248ee38ca22e357c0aa2 authorShea Levy <shea@shealevy.com> dateSun 2 Apr 2017, 14:51 (10 years ago) parent59c0977
2 files changed+11−1
nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py+9−1 nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix+2
nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py+9−1
@@ -32,8 +32,11 @@ def write_loader_conf(generation):
3232 f.write("editor 0");
3333 os.rename("@efiSysMountPoint@/loader/loader.conf.tmp", "@efiSysMountPoint@/loader/loader.conf")
3434
35+def profile_path(generation, name):
36+ return os.readlink("%s/%s" % (system_dir(generation), name))
37+
3538def copy_from_profile(generation, name, dry_run=False):
36− store_file_path = os.readlink("%s/%s" % (system_dir(generation), name))
39+ store_file_path = profile_path(generation, name)
3740 suffix = os.path.basename(store_file_path)
3841 store_dir = os.path.basename(os.path.dirname(store_file_path))
3942 efi_file_path = "/efi/nixos/%s-%s.efi" % (store_dir, suffix)
@@ -44,6 +47,11 @@ def copy_from_profile(generation, name, dry_run=False):
4447def write_entry(generation, machine_id):
4548 kernel = copy_from_profile(generation, "kernel")
4649 initrd = copy_from_profile(generation, "initrd")
50+ try:
51+ append_initrd_secrets = profile_path(generation, "append-initrd-secrets")
52+ subprocess.check_call([append_initrd_secrets, "@efiSysMountPoint@%s" % (initrd)])
53+ except FileNotFoundError:
54+ pass
4755 entry_file = "@efiSysMountPoint@/loader/entries/nixos-generation-%d.conf" % (generation)
4856 generation_dir = os.readlink(system_dir(generation))
4957 tmp_path = "%s.tmp" % (entry_file)
nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix+2
@@ -65,6 +65,8 @@ in {
6565
6666 boot.loader.grub.enable = mkDefault false;
6767
68+ boot.loader.supportsInitrdSecrets = true;
69+
6870 system = {
6971 build.installBootLoader = gummibootBuilder;
7072