nix-config/hosts/patricknix/fs.nix

64 lines
1.6 KiB
Nix
Raw Normal View History

2023-08-30 20:18:26 +02:00
{
2025-01-14 22:20:08 +01:00
config,
lib,
pkgs,
...
}:
{
2023-08-30 20:18:26 +02:00
disko.devices = {
disk = {
2024-03-02 16:09:11 +01:00
m2-ssd = rec {
2023-08-30 20:18:26 +02:00
type = "disk";
device = "/dev/disk/by-id/${config.secrets.secrets.local.disko.m2-ssd}";
content = with lib.disko.gpt; {
2024-03-02 16:09:11 +01:00
type = "gpt";
partitions = {
2024-07-26 22:12:48 +02:00
boot = (partEfi "1GiB") // {
device = "${device}-part1";
};
swap = (partSwap "16GiB") // {
device = "${device}-part2";
};
rpool = (partLuksZfs "rpool" "rpool" "100%") // {
device = "${device}-part3";
};
2024-03-02 16:09:11 +01:00
};
2023-08-30 20:18:26 +02:00
};
};
};
zpool = with lib.disko.zfs; {
2024-07-26 22:12:48 +02:00
rpool = mkZpool { datasets = impermanenceZfsDatasets; };
2023-05-26 17:30:37 +02:00
};
};
2023-10-15 22:09:08 +02:00
fileSystems."/state".neededForBoot = true;
2023-11-03 22:59:13 +01:00
fileSystems."/persist".neededForBoot = true;
2025-01-14 22:20:08 +01:00
boot.initrd.systemd.extraBin = {
jq = lib.getExe pkgs.jq;
};
# In ermergency shell type:
# ´systemctl disable check-pcrs´
# ´systemctl default´
# to continue booting
boot.initrd.systemd.services.check-pcrs = {
script = ''
echo "Checking PCRS tag: ctiectie"
if [[ $(systemd-analyze pcrs 15 --json=short | jq -r ".[0].sha256") != "a8cfdc8ec869f9edf4635129ba6bb19a076a5d234655cf4684286dc57e325a38" ]] ; then
echo "PCR 15 contains invalid hash"
exit 1
else
echo "PCR 15 checked"
fi
'';
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
};
unitConfig.DefaultDependencies = "no";
after = [ "cryptsetup.target" ];
before = [ "sysroot.mount" ];
requiredBy = [ "sysroot.mount" ];
};
}