2024-12-20 22:37:44 -05:00
{
config ,
lib ,
pkgs ,
. . .
} :
2024-12-17 15:26:10 -05:00
2025-01-11 13:48:46 -05:00
let
zfs_clone_send =
( pkgs . writeScriptBin " z f s _ c l o n e _ s e n d " ( builtins . readFile ./files/zfs_clone_send.bash ) ) . overrideAttrs
( old : {
buildCommand = " ${ old . buildCommand } \n p a t c h S h e b a n g s $ o u t " ;
} ) ;
zfs_clone_recv =
( pkgs . writeScriptBin " z f s _ c l o n e _ r e c v " ( builtins . readFile ./files/zfs_clone_recv.bash ) ) . overrideAttrs
( old : {
buildCommand = " ${ old . buildCommand } \n p a t c h S h e b a n g s $ o u t " ;
2025-01-12 19:55:15 -05:00
} ) ;
zfs_clone_resume =
( pkgs . writeScriptBin " z f s _ c l o n e _ r e s u m e " ( builtins . readFile ./files/zfs_clone_resume.bash ) )
. overrideAttrs
( old : {
buildCommand = " ${ old . buildCommand } \n p a t c h S h e b a n g s $ o u t " ;
2025-01-11 13:48:46 -05:00
} ) ;
in
2024-12-17 15:26:10 -05:00
{
2024-12-20 22:37:44 -05:00
imports = [ ] ;
2024-12-17 15:26:10 -05:00
boot . zfs . devNodes = " / d e v / d i s k / b y - p a r t u u i d " ;
services . zfs = {
autoScrub = {
enable = true ;
interval = " m o n t h l y " ;
} ;
trim . enable = true ;
} ;
2025-01-11 13:48:46 -05:00
environment . systemPackages = with pkgs ; [
zfs_clone_send
zfs_clone_recv
2025-01-12 19:55:15 -05:00
zfs_clone_resume
2025-01-11 13:48:46 -05:00
] ;
2025-01-18 11:13:53 -05:00
environment . persistence . " / p e r s i s t " = lib . mkIf ( ! config . me . buildingIso ) {
hideMounts = true ;
directories = [
" / e t c / z f s / z p o o l . c a c h e " # Which zpools to import, the root zpool is already imported and does not need this cache file but this captures additional pools.
] ;
} ;
2024-12-17 15:26:10 -05:00
}