ssh: don't install a client by default (#4016)

Make use of the recently added nullable `mkPackageOption` feature
to disable installing an SSH client by default: most people should use
the client provided by their system.
This commit is contained in:
Naïm Favier 2023-05-27 14:11:50 +02:00 committed by GitHub
parent 6a19225683
commit 2d963854ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 8 additions and 24 deletions

View File

@ -1028,9 +1028,9 @@ in
time = "2023-05-13T14:34:21+00:00";
condition = config.programs.ssh.enable;
message = ''
The module 'programs.ssh' now installs an SSH client. The installed
The module 'programs.ssh' can now install an SSH client. The installed
client is controlled by the 'programs.ssh.package` option, which
defaults to 'pkgs.openssh'.
defaults to 'null'.
'';
}
{

View File

@ -361,7 +361,11 @@ in
options.programs.ssh = {
enable = mkEnableOption "SSH client configuration";
package = mkPackageOption pkgs "openssh" { };
package = mkPackageOption pkgs "openssh" {
nullable = true;
default = null;
extraDescription = "By default, the client provided by your system is used.";
};
forwardAgent = mkOption {
default = false;
@ -527,7 +531,7 @@ in
}
];
home.packages = [ cfg.package ];
home.packages = optional (cfg.package != null) cfg.package;
home.file.".ssh/config".text =
let

View File

@ -6,8 +6,6 @@ with lib;
config = {
programs.ssh = { enable = true; };
test.stubs.openssh = { };
home.file.assertions.text = builtins.toJSON
(map (a: a.message) (filter (a: !a.assertion) config.assertions));

View File

@ -17,8 +17,6 @@ with lib;
};
};
test.stubs.openssh = { };
test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ];
};
}

View File

@ -27,8 +27,6 @@ with lib;
home.file.result.text = builtins.toJSON
(map (a: a.message) (filter (a: !a.assertion) config.assertions));
test.stubs.openssh = { };
nmt.script = ''
assertFileExists home-files/.ssh/config
assertFileContent \

View File

@ -21,8 +21,6 @@ with lib;
};
};
test.stubs.openssh = { };
test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ];
};
}

View File

@ -21,8 +21,6 @@ with lib;
};
};
test.stubs.openssh = { };
test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ];
};
}

View File

@ -21,8 +21,6 @@ with lib;
};
};
test.stubs.openssh = { };
test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ];
};
}

View File

@ -21,8 +21,6 @@ with lib;
};
};
test.stubs.openssh = { };
test.asserts.assertions.expected = [ "Forwarded paths cannot have ports." ];
};
}

View File

@ -7,8 +7,6 @@
includes = [ "config.d/*" "other/dir" ];
};
test.stubs.openssh = { };
nmt.script = ''
assertFileExists home-files/.ssh/config
assertFileContains home-files/.ssh/config "Include config.d/* other/dir"

View File

@ -51,8 +51,6 @@ with lib;
home.file.assertions.text = builtins.toJSON
(map (a: a.message) (filter (a: !a.assertion) config.assertions));
test.stubs.openssh = { };
nmt.script = ''
assertFileExists home-files/.ssh/config
assertFileContent \

View File

@ -21,8 +21,6 @@ with lib;
home.file.assertions.text = builtins.toJSON
(map (a: a.message) (filter (a: !a.assertion) config.assertions));
test.stubs.openssh = { };
nmt.script = ''
assertFileExists home-files/.ssh/config
assertFileContent \