{ pkgs, lib, config, inputs, hostName, ... }:
{
imports = [
  (inputs.julm-nix + "/nixos/profiles/zfs.nix")
];

fileSystems."/" = {
  device = "${hostName}/root";
  fsType = "zfs"; # TODO: options = [ "zfsutil" ];
};

# This will automatically load the zfs password prompt on login
# and kill the other prompt so boot can continue
# The pkill zfs kills the zfs load-key from the console
# allowing the boot to continue.
boot.initrd.network.postCommands = ''
  echo >>/root/.profile "zfs load-key rpool && pkill zfs"
'';
boot.zfs.requestEncryptionCredentials = [ hostName ];

fileSystems."/nix" = {
  device = "${hostName}/nix";
  fsType = "zfs";
};

fileSystems."/var" = {
  device = "${hostName}/var";
  fsType = "zfs";
};

fileSystems."/var/cache" = {
  device = "${hostName}/var/cache";
  fsType = "zfs";
};

fileSystems."/var/log" = {
  device = "${hostName}/var/log";
  fsType = "zfs";
};

fileSystems."/var/tmp" = {
  device = "${hostName}/var/tmp";
  fsType = "zfs";
};

fileSystems."/mnt/key" = {
  device = "/dev/disk/by-label/key";
  fsType = "vfat";
  options = [ "auto" "nofail" "uid=1000" "gid=users" "umask=111" "dmask=007" "utf8=yes" ];
};

# Allow members of the "adbusers" group to mount Android devices via MTP
services.udev.packages = [ pkgs.android-udev-rules ];
environment.systemPackages = [
  pkgs.go-mtpfs
  pkgs.ntfs3g
];

}