diff options
author | Will Fancher <elvishjerricco@gmail.com> | 2022-04-24 14:49:45 -0400 |
---|---|---|
committer | Will Fancher <elvishjerricco@gmail.com> | 2022-04-28 14:12:16 -0400 |
commit | 50925651bb58db3232a5c64b60a0faac880d6954 (patch) | |
tree | 17cf45a972e0b577f7e77d0659f1d37351c9490c /nixos/modules/tasks/filesystems | |
parent | 69d804751678ca42175203252251cd74ff362812 (diff) | |
download | nixlib-50925651bb58db3232a5c64b60a0faac880d6954.tar nixlib-50925651bb58db3232a5c64b60a0faac880d6954.tar.gz nixlib-50925651bb58db3232a5c64b60a0faac880d6954.tar.bz2 nixlib-50925651bb58db3232a5c64b60a0faac880d6954.tar.lz nixlib-50925651bb58db3232a5c64b60a0faac880d6954.tar.xz nixlib-50925651bb58db3232a5c64b60a0faac880d6954.tar.zst nixlib-50925651bb58db3232a5c64b60a0faac880d6954.zip |
zfs: Sync pools on shutdown.
Diffstat (limited to 'nixos/modules/tasks/filesystems')
-rw-r--r-- | nixos/modules/tasks/filesystems/zfs.nix | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/nixos/modules/tasks/filesystems/zfs.nix b/nixos/modules/tasks/filesystems/zfs.nix index fbfc61177d38..5eca68798d5d 100644 --- a/nixos/modules/tasks/filesystems/zfs.nix +++ b/nixos/modules/tasks/filesystems/zfs.nix @@ -466,6 +466,11 @@ in '') rootPools)); }; + systemd.shutdownRamfs.contents."/etc/systemd/system-shutdown/zpool".source = pkgs.writeShellScript "zpool-sync-shutdown" '' + exec ${cfgZfs.package}/bin/zpool sync + ''; + systemd.shutdownRamfs.storePaths = ["${cfgZfs.package}/bin/zpool"]; + # TODO FIXME See https://github.com/NixOS/nixpkgs/pull/99386#issuecomment-798813567. To not break people's bootloader and as probably not everybody would read release notes that thoroughly add inSystem. boot.loader.grub = mkIf (inInitrd || inSystem) { zfsSupport = true; |