{ pkgs, config, hostName, ... }:
{
  imports = [
    ../../nixos/profiles/hardware/T480.nix
    ../../nixos/profiles/zfs.nix
    ../../nixos/profiles/zramSwap.nix
  ];

  # Setting the machine-id avoids to reencrypt all credentials
  # when reinstalling NixOS on a new drive.
  # Manually generated with : uuidgen | tr -d -
  environment.etc.machine-id.source = ./machine-id.clear;

  # The 32-bit host id of the host, formatted as 8 hexadecimal characters.
  # You should try to make this id unique among your hosts.
  # Manually generated with : uuidgen | head -c8
  networking.hostId = "e6eba6c4";

  boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;

  boot.loader = {
    efi = {
      canTouchEfiVariables = true;
      efiSysMountPoint = "/boot/efi";
    };
    systemd-boot = {
      enable = true;
      #editor = false;
      # Roughly 25MiB (initrd) + 9MiB (kernel) per configuration
      configurationLimit = 6;
      memtest86.enable = true;
      /*
      extraInstallCommands = ''
        rm -rf /efiboot/efi2
        cp -r /efiboot/efi1 /efiboot/efi2
      '';
      */
      # FIXME: needs https://github.com/NixOS/nixpkgs/pull/246897
      #mirroredBoots = [ ];
    };

    #generationsDir.copyKernels = true;
  };

  hardware.enableRedistributableFirmware = true;

  fileSystems."/boot/efi" =
    {
      device = "/dev/disk/by-partlabel/${hostName}_ssd_efi";
      fsType = "vfat";
      options = [ "rw" "noexec" "nodev" "nofail" "X-mount.mkdir" "iocharset=iso8859-1" ];
    };
  swapDevices = [
    {
      device = "/dev/disk/by-partlabel/${hostName}_ssd_swap";
      randomEncryption = {
        enable = true;
        cipher = "aes-xts-plain64";
        source = "/dev/urandom";
      };
    }
  ];

  boot.supportedFilesystems = [ "ntfs" "vfat" ];

  fileSystems."/" =
    {
      device = "${hostName}/root";
      fsType = "zfs";
      options = [ "zfsutil" ];
    };
  fileSystems."/nix" =
    {
      device = "${hostName}/root/nix";
      fsType = "zfs";
      options = [ "X-mount.mkdir" "zfsutil" ];
    };
  fileSystems."/var" =
    {
      device = "${hostName}/root/var";
      fsType = "zfs";
      options = [ "X-mount.mkdir" "zfsutil" ];
    };

  services.pipewire.jack.enable = true;

}