added needed for boot to user persist directories
This commit is contained in:
		
							parent
							
								
									b6f1704af3
								
							
						
					
					
						commit
						e54981fffc
					
				
					 1 changed files with 48 additions and 36 deletions
				
			
		|  | @ -259,7 +259,20 @@ in { | ||||||
|           normalUsers) |           normalUsers) | ||||||
|       ); |       ); | ||||||
| 
 | 
 | ||||||
|       fileSystems.${SOPS_AGE_KEY_DIRECTORY}.neededForBoot = true; |       fileSystems = lib.mkMerge [ | ||||||
|  |         { | ||||||
|  |           ${SOPS_AGE_KEY_DIRECTORY}.neededForBoot = true; | ||||||
|  |         } | ||||||
|  |         ( | ||||||
|  |           builtins.listToAttrs ( | ||||||
|  |             builtins.map (user: | ||||||
|  |               lib.attrsets.nameValuePair "/persist/home/${user.name}" { | ||||||
|  |                 neededForBoot = true; | ||||||
|  |               }) | ||||||
|  |             normalUsers | ||||||
|  |           ) | ||||||
|  |         ) | ||||||
|  |       ]; | ||||||
| 
 | 
 | ||||||
|       environment.persistence."/persist/system/root" = { |       environment.persistence."/persist/system/root" = { | ||||||
|         enable = true; |         enable = true; | ||||||
|  | @ -269,45 +282,44 @@ in { | ||||||
|         ]; |         ]; | ||||||
|       }; |       }; | ||||||
| 
 | 
 | ||||||
|       host.storage.pool.extraDatasets = lib.mkMerge [ |       host.storage.pool.extraDatasets = lib.mkMerge ( | ||||||
|         { |         [ | ||||||
|           # sops age key needs to be available to pre persist for user generation |           { | ||||||
|           "local/system/sops" = { |             # sops age key needs to be available to pre persist for user generation | ||||||
|             type = "zfs_fs"; |             "local/system/sops" = { | ||||||
|             mountpoint = SOPS_AGE_KEY_DIRECTORY; |               type = "zfs_fs"; | ||||||
|             options = { |               mountpoint = SOPS_AGE_KEY_DIRECTORY; | ||||||
|               atime = "off"; |               options = { | ||||||
|               relatime = "off"; |                 atime = "off"; | ||||||
|               canmount = "on"; |                 relatime = "off"; | ||||||
|  |                 canmount = "on"; | ||||||
|  |               }; | ||||||
|             }; |             }; | ||||||
|           }; |           } | ||||||
|         } |         ] | ||||||
|         ( |         ++ ( | ||||||
|           lib.mkMerge |           builtins.map (user: { | ||||||
|           ( |             "local/home/${user.name}" = { | ||||||
|             builtins.map (user: { |               type = "zfs_fs"; | ||||||
|               "local/home/${user.name}" = { |               mountpoint = "/home/${user.name}"; | ||||||
|                 type = "zfs_fs"; |               options = { | ||||||
|                 mountpoint = "/home/${user.name}"; |                 canmount = "on"; | ||||||
|                 options = { |  | ||||||
|                   canmount = "on"; |  | ||||||
|                 }; |  | ||||||
|                 postCreateHook = '' |  | ||||||
|                   zfs snapshot rpool/local/home/${user.name}@blank |  | ||||||
|                 ''; |  | ||||||
|               }; |               }; | ||||||
|               "persist/home/${user.name}" = { |               postCreateHook = '' | ||||||
|                 type = "zfs_fs"; |                 zfs snapshot rpool/local/home/${user.name}@blank | ||||||
|                 mountpoint = "/persist/home/${user.name}"; |               ''; | ||||||
|                 options = { |             }; | ||||||
|                   "com.sun:auto-snapshot" = "true"; |             "persist/home/${user.name}" = { | ||||||
|                 }; |               type = "zfs_fs"; | ||||||
|  |               mountpoint = "/persist/home/${user.name}"; | ||||||
|  |               options = { | ||||||
|  |                 "com.sun:auto-snapshot" = "true"; | ||||||
|               }; |               }; | ||||||
|             }) |             }; | ||||||
|             normalUsers |           }) | ||||||
|           ) |           normalUsers | ||||||
|         ) |         ) | ||||||
|       ]; |       ); | ||||||
|     }) |     }) | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue