{ pkgs, lib, config, ... }:
let
  shellAliases = {
    update-boot = "sudo nixos-rebuild boot --max-jobs 10 --build-host admin@10.0.1.3";
    update-switch = "sudo nixos-rebuild switch --max-jobs 10 --build-host admin@10.0.1.3";
    update-flake = "nix flake update pi5-nixpkgs pi5-home-manager pi5-impermanence pi5-nixos-hardware pi5-sops-nix nixos-raspberrypi --flake /etc/nixos";
    update-nas = "nixos-rebuild switch --use-remote-sudo --target-host admin@10.0.1.3 --build-host admin@10.0.1.3 --flake ~/nix-config#jallen-nas";
    nas-ssh = "kitten ssh admin@10.0.1.3";
  };
in
{
  imports = [
    ../../share/home/defaults.nix
    ../../share/home/git.nix
    ../../share/home/gnome.nix
    ../../share/home/librewolf.nix
    ../../share/home/shell.nix
    ../../share/home/vscode.nix
  ];

  home.username = "matt";

  sops = {
    age.keyFile = "/home/matt/.config/sops/age/keys.txt";
    defaultSopsFile = "/etc/nixos/secrets/secrets.yaml";
    validateSopsFiles = false;
    secrets = {
      "ssh-keys-public/pi5" = {
        path = "/home/matt/.ssh/id_ed25519.pub";
        mode = "0644";
      };
      "ssh-keys-private/pi5" = {
        path = "/home/matt/.ssh/id_ed25519";
        mode = "0600";
      };
      "ssh-keys-public/jallen-nas" = { };

      "ssh-keys-public/jallen-nas-root" = { };

      "ssh-keys-public/desktop-nixos" = { };

      "ssh-keys-public/desktop-nixos-root" = { };

      "ssh-keys-public/desktop-windows" = { };

      "ssh-keys-public/macbook-macos" = { };
    };

    templates = {
      "authorized_keys" = {
        content = ''
          ${config.sops.placeholder."ssh-keys-public/jallen-nas"}
          ${config.sops.placeholder."ssh-keys-public/jallen-nas-root"}
          ${config.sops.placeholder."ssh-keys-public/desktop-nixos"}
          ${config.sops.placeholder."ssh-keys-public/desktop-nixos-root"}
          ${config.sops.placeholder."ssh-keys-public/macbook-macos"}
        '';
      };
    };
  };

  programs = {
    zsh.shellAliases = shellAliases;
  };
}
