avahi: disable useless nssmdns6
[julm/julm-nix.git] / nixos / profiles / zfs.nix
index 168744c72302f489ee271c5cf573812f875ddabf..55cf0ca9255da991a0dd231150677fcac64a4b19 100644 (file)
@@ -1,4 +1,9 @@
-{ pkgs, lib, hostName, ... }:
+{
+  pkgs,
+  lib,
+  hostName,
+  ...
+}:
 {
   # none is the recommended elevator with ZFS (which has its own I/O scheduler)
   services.udev.extraRules = ''
@@ -28,7 +33,7 @@
   boot.zfs.forceImportRoot = true;
   boot.zfs.requestEncryptionCredentials = lib.mkDefault [ "${hostName}/root" ];
 
-  boot.zfs.enableUnstable = false;
+  #boot.zfs.package = pkgs.zfs_unstable;
 
   # Enables periodic scrubbing of ZFS pools.
   services.zfs.autoScrub.enable = true;
@@ -43,7 +48,7 @@
   # Hide ZFS mountpoints from gio, hence nautilus or caja
   systemd.services.zfs-mount.postStart = ''
     /run/wrappers/bin/mount -t zfs | cut -f 1 -d ' ' |
-    xargs -n 1 -r -t /run/wrappers/bin/mount -o remount,x-gvfs-hide
+    xargs -n 1 -r -t /run/wrappers/bin/mount -o remount,x-gvfs-hide || true
   '';
 
   environment.systemPackages = [
       PrivateTmp = true;
       SyslogIdentifier = "zfs-import@%i";
       Restart = "no";
-      ExecStart = pkgs.writeShellScript "zfs-import" ''
-        pool="$1"
-        set -eux
-        zpool import -lFd /dev/disk/by-id/ -o cachefile=none "$pool" ||
-        zpool reopen "$pool" ||
-        zpool import -lfd /dev/disk/by-id/ -o cachefile=none "$pool" ||
-        zpool clear -nFX "$pool"
-        ${pkgs.systemd}/bin/systemctl restart zfs-mount.service
-      '' + " %I";
+      ExecStart =
+        pkgs.writeShellScript "zfs-import" ''
+          pool="$1"
+          set -eux
+          zpool status "$pool" ||
+          zpool import -lFd /dev/disk/by-id/ -o cachefile=none "$pool" ||
+          zpool reopen "$pool" ||
+          zpool import -lfd /dev/disk/by-id/ -o cachefile=none "$pool" ||
+          zpool clear -nFX "$pool"
+          ${pkgs.systemd}/bin/systemctl restart zfs-mount.service
+        ''
+        + " %I";
     };
   };
 }