nixos/modules/tank-nvme-luks.nix
2024-07-31 00:18:30 -05:00

34 lines
994 B
Nix

{config,...}:
# to use this, you must have created the lvm devices for the host
# in this example, my hostname is sobble and the disk is /dev/sda:
#
# fdisk /dev/sda
# n # new partition, assuming this is a blank disk.
# # (enter for all defauls until you're back at the prompt)
# t # set type
# 1 # first partition, again assuming this was a blank disk
# 8e # lvm
# w # write and quit
#
# either make the lv inside an existing vg like the root luks one
# ----------
# lvcreate -L50G -n sobble-tank-nvme sobble-luks
# --- or ---
# pvcreate /dev/nvme0n2p15
# vgcreate sobble-tank-nvme /dev/nvme0n2p15
# lvcreate -l 100%FREE -n sobble-tank-nvme sobble-tank-nvme
# -- then --
# mkfs.ext4 /dev/sobble-tank-nvme/sobble-tank-nvme
let
m = "${config.networking.hostName}-luks";
n = "${config.networking.hostName}-tank-nvme";
in
{
fileSystems."/tank/nvme" = {
device = "/dev/${m}/${n}";
fsType = "ext4";
};
}