]> Git — Sourcephile - sourcephile-nix.git/blob - shell/modules/tools/networking/openssh.nix
nix: improve shell.nix's modules system
[sourcephile-nix.git] / shell / modules / tools / networking / openssh.nix
1 { pkgs, lib, config, ... }:
2 let cfg = config.openssh;
3 inherit (lib) types;
4 in
5 {
6 options.openssh = {
7 enable = lib.mkEnableOption "OpenSSH shell utilities";
8 sshConf = lib.mkOption {
9 type = types.lines;
10 apply = s: pkgs.writeText "ssh_config" s;
11 default = ''
12 '';
13 description = ''
14 OpenSSH's ssh_config content.
15 '';
16 };
17 };
18 config = lib.mkIf cfg.enable {
19 nix-shell.buildInputs =
20 let ssh = pkgs.writeShellScriptBin "ssh" ''
21 ${pkgs.openssh}/bin/ssh -F ${cfg.sshConf} "$@"
22 '';
23 in
24 [ ssh ];
25 };
26 }