From 7b29378f133ed49c341d996698bb1207edc950a4 Mon Sep 17 00:00:00 2001 From: Quentin Aristote Date: Sun, 19 Feb 2023 17:09:32 +0100 Subject: openssh: handle NixOS 22.11 and 23.05 APIs --- modules/nixos/personal/networking.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/nixos/personal/networking.nix b/modules/nixos/personal/networking.nix index 0c9c3a7..2385abd 100644 --- a/modules/nixos/personal/networking.nix +++ b/modules/nixos/personal/networking.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, options, ... }: let cfg = config.personal.networking; @@ -47,14 +47,18 @@ in { services = lib.mkIf cfg.ssh.enable { openssh = { enable = true; + extraConfig = '' + AcceptEnv PS1 + ''; + } // (if options.services.openssh ? settings then { settings = { PermitRootLogin = "no"; PasswordAuthentication = false; }; - extraConfig = '' - AcceptEnv PS1 - ''; - }; + } else { + permitRootLogin = "no"; + passwordAuthentication = false; + }); fail2ban.enable = true; }; hardware.bluetooth.enable = cfg.bluetooth.enable; -- cgit v1.2.3