{
  config,
  lib,
  pkgs,
  profiles,
  ...
}: {
  imports = [
    # profiles.networking
    #profiles.core
    "${
      fetchTarball {
        url = "https://github.com/NixOS/nixos-hardware/archive/8f1bf828d8606fe38a02df312cf14546ae200a72.tar.gz";
        sha256 = "11milap153g3f63fcrcv4777vd64f7wlfkk9p3kpxi6dqd2sxvh4";
      }
    }/raspberry-pi/4"
    profiles.users.root # make sure to configure ssh keys
    profiles.users.pub-solar
    profiles.base-user
    profiles.pub-solar-iso
  ];

  config = {
    pub-solar.core.iso-options.enable = true;

    fileSystems = {
      "/" = {
        device = "/dev/disk/by-label/NIXOS_SD";
        fsType = "ext4";
        options = ["noatime"];
      };
    };

    environment.systemPackages = with pkgs; [
      (kodi-gbm.withPackages (p: with p; [jellyfin netflix youtube]))
    ];

    services.openssh.enable = true;

    networking.firewall = {
      allowedTCPPorts = [8080];
      allowedUDPPorts = [8080];
    };

    security.sudo.extraConfig = lib.mkAfter ''
      %wheel    ALL=(ALL) NOPASSWD:ALL
    '';

    nix = {
      autoOptimiseStore = true;

      gc.automatic = true;

      optimise.automatic = true;

      useSandbox = true;

      allowedUsers = ["@wheel"];

      trustedUsers = ["root" "@wheel"];

      extraOptions = ''
        min-free = 536870912
        keep-outputs = true
        keep-derivations = true
        fallback = true
      '';
    };

    # Enable GPU acceleration
    hardware.raspberry-pi."4".fkms-3d.enable = true;

    # Define a user account for kodi
    users.extraUsers.kodi.isNormalUser = true;

    services.xserver = {
      enable = true;
      desktopManager.kodi.enable = true;
      desktopManager.kodi.package = pkgs.kodi-gbm;
      displayManager = {
        autoLogin.enable = true;
        autoLogin.user = "kodi";
      };
    };

    hardware.pulseaudio.enable = true;

    # custom raspi boot loader is already present
    boot.loader.systemd-boot.enable = lib.mkForce false;
    boot.kernelPackages = lib.mkForce pkgs.linuxPackages_rpi4;

    # This value determines the NixOS release from which the default
    # settings for stateful data, like file locations and database versions
    # on your system were taken. It‘s perfectly fine and recommended to leave
    # this value at the release version of the first install of this system.
    # Before changing this value read the documentation for this option
    # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
    system.stateVersion = "21.05"; # Did you read the comment?
  };
}