1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

openssh: add services.openssh.useAppleServer option

This commit is contained in:
Michael Hoang 2024-11-23 12:49:22 +11:00
parent 08487cd307
commit 7826fe3e32

View file

@ -9,14 +9,30 @@ in
type = lib.types.nullOr lib.types.bool;
default = null;
description = ''
Whether to enable Apple's built-in OpenSSH server.
Whether to enable an OpenSSH server.
The default is null which means let macOS manage the OpenSSH server.
'';
};
services.openssh.useAppleServer = lib.mkOption {
type = lib.types.bool;
default = true;
example = false;
description = ''
Whether to use Apple's built-in OpenSSH server.
'';
};
};
config = {
assertions = [
{
assertion = cfg.useAppleServer;
message = "Currently only using Apple's built-in OpenSSH server has been implemented.";
}
];
# We don't use `systemsetup -setremotelogin` as it requires Full Disk Access
system.activationScripts.launchd.text = lib.mkIf (cfg.enable != null) (if cfg.enable then ''
if [[ "$(systemsetup -getremotelogin | sed 's/Remote Login: //')" == "Off" ]]; then