{ pkgs, lib, config, ... }: let cfg = config.openssh; inherit (lib) types; in { options.openssh = { enable = lib.mkEnableOption "OpenSSH shell utilities"; sshConf = lib.mkOption { type = types.lines; apply = s: pkgs.writeText "ssh_config" s; default = '' ''; description = '' OpenSSH's ssh_config content. ''; }; }; config = lib.mkIf cfg.enable { nix-shell.buildInputs = let ssh = pkgs.writeShellScriptBin "ssh" '' ${pkgs.openssh}/bin/ssh -F ${cfg.sshConf} "$@" ''; in [ ssh ]; }; }