{
  config,
  lib,
  pkgs,
  self,
  ...
}:

let
  nix-flake-repl = pkgs.writeShellScriptBin "nix-flake-repl" ''
    source /etc/set-environment
    target="''${1:-$(pwd)}"
    nix repl --expr "builtins.getFlake \"''$target\""
  '';
  nix-self-repl = pkgs.writeShellScriptBin "nix-self-repl" ''
    source /etc/set-environment
    nix repl --expr 'builtins.getFlake "${self}"'
  '';
in
{
  imports = [ ];

  options.me = {
    nix_repl.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      example = true;
      description = "Whether we want to install nix_repl.";
    };
  };

  config = lib.mkIf config.me.nix_repl.enable {
    environment.systemPackages = [
      nix-flake-repl
      nix-self-repl
    ];
  };
}
