124 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			124 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
| {
 | |
|   disko.devices = {
 | |
|     disk = {
 | |
|       main = {
 | |
|         type = "disk";
 | |
|         device = "/dev/disk/by-id/ata-APPLE_SSD_SM0512F_S1K5NYBF736152";
 | |
|         content = {
 | |
|           type = "gpt";
 | |
|           partitions = {
 | |
|             ESP = {
 | |
|               size = "256M";
 | |
|               type = "EF00";
 | |
|               content = {
 | |
|                 type = "filesystem";
 | |
|                 format = "vfat";
 | |
|                 mountpoint = "/boot";
 | |
|               };
 | |
|             };
 | |
|             zfs = {
 | |
|               size = "100%";
 | |
|               content = {
 | |
|                 type = "zfs";
 | |
|                 pool = "rpool";
 | |
|               };
 | |
|             };
 | |
|           };
 | |
|         };
 | |
|       };
 | |
|     };
 | |
|     zpool = {
 | |
|       rpool = {
 | |
|         type = "zpool";
 | |
|         options = {
 | |
|           ashift = "12";
 | |
|         };
 | |
|         rootFsOptions = {
 | |
|           canmount = "off";
 | |
|           mountpoint = "none";
 | |
|           dnodesize = "auto";
 | |
|           xattr = "sa";
 | |
|         };
 | |
|         mountpoint = "/";
 | |
|         postCreateHook = "zfs snapshot zroot@blank";
 | |
|         datasets = {
 | |
|           local = {
 | |
|             options = {
 | |
|               mountpoint = "none";
 | |
|             };
 | |
|           };
 | |
|           "local/nix" = {
 | |
|             mountpoint = "/nix";
 | |
|             options = {
 | |
|               atime = "off";
 | |
|               mountpoint = "legacy";
 | |
|             };
 | |
|           };
 | |
|           "local/tmp" = {
 | |
|             mountpoint = "/tmp";
 | |
|             options = {
 | |
|               setuid = "off";
 | |
|               devices = "off";
 | |
|               mountpoint = "legacy";
 | |
|             };
 | |
|           };
 | |
|           system = {
 | |
|             options = {
 | |
|               mountpoint = "none";
 | |
|               encryption = "aes-256-gcm";
 | |
|               keyformat = "passphrase";
 | |
|               keylocation = "file:///tmp/secret.key";
 | |
|             };
 | |
|             # use this to read the key during boot
 | |
|             postCreateHook = ''
 | |
|               zfs set keylocation="prompt" "rpool/$name";
 | |
|             '';
 | |
|           };
 | |
|           "system/var" = {
 | |
|             mountpoint = "/var";
 | |
|             options = {
 | |
|               mountpoint = "legacy";
 | |
|             };
 | |
|           };
 | |
|           "system/var/tmp" = {
 | |
|             mountpoint = "/var/tmp";
 | |
|             options = {
 | |
|               devices = "off";
 | |
|               mountpoint = "legacy";
 | |
|             };
 | |
|           };
 | |
|           "system/var/log" = {
 | |
|             mountpoint = "/var/log";
 | |
|             options = {
 | |
|               compression = "on";
 | |
|               acltype = "posix";
 | |
|               mountpoint = "legacy";
 | |
|             };
 | |
|           };
 | |
|           user = {
 | |
|             options = {
 | |
|               mountpoint = "none";
 | |
|               encryption = "aes-256-gcm";
 | |
|               keyformat = "passphrase";
 | |
|               keylocation = "file:///tmp/secret.key";
 | |
|             };
 | |
|             # use this to read the key during boot
 | |
|             postCreateHook = ''
 | |
|               zfs set keylocation="prompt" "rpool/$name";
 | |
|             '';
 | |
|           };
 | |
|           "user/home" = {
 | |
|             mountpoint = "/home";
 | |
|             options = {
 | |
|               setuid = "off";
 | |
|               devices = "off";
 | |
|               mountpoint = "legacy";
 | |
|             };
 | |
|           };
 | |
|         };
 | |
|       };
 | |
|     };
 | |
|   };
 | |
| }
 | |
| 
 |