{ config, pkgs, lib, ... }:
{
  # system-wide shit

  environment.systemPackages = with pkgs; [
    micro
    edir
    xclip
    fzf
    rmate-sh # TODO: add to ssh config

    vimix-gtk-themes
    flat-remix-icon-theme
    feh
  ];
  # TODO: fzf for zsh
  programs.bash.shellInit = ''
    source "$(${pkgs.fzf}/bin/fzf-share)/key-bindings.bash"
    source "$(${pkgs.fzf}/bin/fzf-share)/completion.bash"
  '';
  programs.bash.shellAliases."ed" = "\${EDITOR:-micro}";
  environment.variables."EDITOR"  = "micro";

  # autologin: (put in host config)
  # services.displayManager.autoLogin.enable  = true;
  # services.displayManager.autoLogin.user = "pbsds";

  # user and home-manager

  #nix.trusted-users = [ "pbsds" ];

  # ./home/profiles/minimal
  # ./home/profiles/headless
  # ./home/profiles/comfy
  # ./home/profiles/desktop (gnome)
  home-manager.users.pbsds.imports = [
    (
      if config.services.desktopManager.gnome.enable then
        ./home/profiles/desktop/gnome
      else
        ./home/profiles/comfy
    )
    { home.stateVersion = config.system.stateVersion; }
  ];

  nix.settings.allowed-users = [ "pbsds" ];
  nix.settings.trusted-users = [ "pbsds" ];

  users.groups."pbsds".gid = 1001; # TODO: remove this, add a uid map to NFS instead
  users.users."pbsds" = {
    isNormalUser = true;
    uid = 1001; # TODO: uid mapping be done at nfs-mount level? That way we can enforce
    description = "pbsds";
    extraGroups = [
      "pbsds"
      "users" # backward compat
      "keys" # access tokens in nix.conf
      #"nix-community-builder"
      "libvirtd"
      "networkmanager"
      "audio"
      "sound"
      "video"
      "input"
      "tty"
      "wheel"
      # TODO: NAS stuff
    ] ++ lib.optionals config.virtualisation.docker.enable [
      "docker"
    # doesn't work...
    #] ++ lib.optionals config.services.headscale.enable [
    #  config.services.headscale.group
    ];

    initialHashedPassword = "$6$yNgxTHcP1UYkNwuZ$1sBehnKgPjVnDe0tSV8kyfynWpfjDzuohZX6SoTrMnYFa3/aiMOtI6JppYevl.M6qYhBIT0XBvL6TqSSFWn8B/"; # mkpasswd

    # TODO: fetch from github?
    open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GjIfZttjerhzsFE1V/RctCFToqHkW39439nCj6eFpgUiLHkx/mAUPz/whKP+9x5I3/DQkgYZ7qA424Msdz2wXWNi3465Mtrf5XPsjWNReEWt9I29W19K5OLO9QQVrkgdioSCvxoHLvQypPscPkLVF8srzCVA6npUOrOuJ5zZcK1ax2/0v8= pbsds@frotbjoff"
      #"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDX1n/zBp0Va5VPgUHDJ2tLhR8kzQmkWIdFNVy3WHMzfx2ppR0+ch05ksZ7VYp3ROSMpykdqcjDekM6fD+BJEaHx9MwmHlFgvIVyIVwMwqtheo1gAHW6InsF41c7VRv3dlZgX8ViM9kR6YxCsy8FLkwcRtnQkMnT24LpLvmI6dZA26jAmYvxDO0iSD+7jBf+k1MFJZMxg14tMIcqMnuUhR0OyfORslafM73MKSwFqPeNvJxTq96we5RNBoZfZ63LmAm+EJ/++xoCATWQuSnbrXzIC/tUfHLbn9JUE6OgbTLOCarf/aUQHD5jeevfmNu8DYwtjrqcQsjDt2RySTX1R0OgXDbJe+voOY+9a6mSkpYV37CL5rJGTZYFxLLlC2BZMhmhl/axsK/YGyki9z0zKey65MDl5GxOEaTmVqkextiLMp3qBxvCEOzE6/MsVrOkX/gbNglqFlCVPXxKDBsm5NM/KbqPFuntX+w9UReTAS8MBwBDLM3z0dqT8MaK400wmM= pbsds@noximilien"
      #"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBHdkKmRB0WjD3L+k8GNTVJDLpOUqLBMW17ld/Jzapo6 pbsds@bolle"
      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDpuDBMll1viLKd/wm1lCy9iozyKeXMBHDwhdJOpeRLe pbsds@nord"
      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOm2UFDD+qsnKvlBBZ/nhBqY9yeLewwF/bexD2SUL7E3 pbsds@sopp"
      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILocbYCqu63RT2+mE0l+ZWWw9RVHNcydtLXbLklg6oPe pederbs@pvv"

      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFZ8xR16u2v8YdGxHQXFA+SBZMzGQXwnhRat7VvTBbl8 furios@FuriPhoneFLX1"
      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIIGcGEhM6qo3ARAsHx8V/FhryVaG0gOLmL6J1NL3fyn user@pinebook"
    ];
  };

}
