{
  config,
  lib,
  namespace,
  ...
}:
let
  cfg = config.${namespace}.sops;
in
{
  imports = [ ./options.nix ];

  config = lib.mkIf cfg.enable {
    sops = {
      age.keyFile = "/home/${config.${namespace}.user.name}/.config/sops/age/keys.txt";
      defaultSopsFile = "/etc/nixos/secrets/secrets.yaml";
      validateSopsFiles = false;
      # secrets = {
      #   "github-token" = { };
      # };
      # templates = {
      #   ".env".content = ''
      #     GITHUB_TOKEN = "${config.sops.placeholder.github-token}"
      #   '';
      # };
    };
  };
}
