summary refs log tree commit diff
path: root/host/initramfs/live.nix
blob: 2c520d86b7c2235e90360b7b542c9e9f5d9d14ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# SPDX-License-Identifier: EUPL-1.2
# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is>

{ pkgs ? import <nixpkgs> {} }:

let
  extfs = pkgs.pkgsStatic.callPackage ./extfs.nix { inherit pkgs; };
  rootfs = import ../rootfs { inherit pkgs; };
  initramfs = import ./. { inherit pkgs rootfs; };
in

with pkgs;

initramfs.overrideAttrs ({ buildFlags ? "", nativeBuildInputs ? [], ... }: {
  name = "spectrum-live.img";

  nativeBuildInputs = nativeBuildInputs ++ [
    cryptsetup dosfstools jq mtools util-linux
  ];

  EFI_STUB = "${systemd}/lib/systemd/boot/efi/linuxx64.efi.stub";
  EXT_FS = extfs;
  KERNEL = "${rootfs.kernel}/${stdenv.hostPlatform.linux-kernel.target}";
  ROOT_FS = rootfs;

  buildFlags = "${toString buildFlags} build/live.img";

  installPhase = ''
    runHook preInstall
    mv build/live.img $out
    runHook postInstall
  '';
})