aboutsummaryrefslogtreecommitdiff
path: root/profiles/secureboot.nix
blob: 48eb868156258e0e8a3b246850fe074346d04033 (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
{ pkgs, lib, ... }:
{
  environment.persistence."/persist/save".directories = [
    "/var/lib/sbctl"
  ];

  environment.systemPackages = with pkgs; [
    sbctl
    tpm2-tools
  ];

  boot = {
    loader.systemd-boot.enable = lib.mkForce false;
    initrd.systemd.enable = true;
    lanzaboote = {
      enable = true;
      pkiBundle = "/var/lib/sbctl";
    };
  };

  security.tpm2 = {
    enable = true;
    pkcs11.enable = true;
    tctiEnvironment.enable = true;
  };

  environment.shellAliases = {
    # Requires a device argument (/dev//dev/nvme0n1p3)
    cryptenroll = "systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+2+7+12 --wipe-slot=tpm2";
  };
}