Skip to content

Commit 9679012

Browse files
nixos/pam: fix writeFile no longer taking null as an argument warning
> evaluation warning: pkgs.writeText "motd": The second argument should be a string, but it's a null instead, which is deprecated. Use `toString` to convert the value to a string first.
1 parent 6614b28 commit 9679012

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

nixos/modules/security/pam.nix

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ let
866866
{ name = "limits"; enable = cfg.limits != []; control = "required"; modulePath = "${package}/lib/security/pam_limits.so"; settings = {
867867
conf = "${makeLimitsConf cfg.limits}";
868868
}; }
869-
{ name = "motd"; enable = cfg.showMotd && (config.users.motd != null || config.users.motdFile != null); control = "optional"; modulePath = "${package}/lib/security/pam_motd.so"; settings = {
869+
{ name = "motd"; enable = cfg.showMotd && (config.users.motd != "" || config.users.motdFile != null); control = "optional"; modulePath = "${package}/lib/security/pam_motd.so"; settings = {
870870
inherit motd;
871871
}; }
872872
{ name = "apparmor"; enable = cfg.enableAppArmor && config.security.apparmor.enable; control = "optional"; modulePath = "${pkgs.apparmor-pam}/lib/security/pam_apparmor.so"; settings = {
@@ -1478,9 +1478,9 @@ in
14781478
'';
14791479

14801480
users.motd = mkOption {
1481-
default = null;
1481+
default = "";
14821482
example = "Today is Sweetmorn, the 4th day of The Aftermath in the YOLD 3178.";
1483-
type = types.nullOr types.lines;
1483+
type = types.lines;
14841484
description = "Message of the day shown to users when they log in.";
14851485
};
14861486

@@ -1498,7 +1498,7 @@ in
14981498
config = {
14991499
assertions = [
15001500
{
1501-
assertion = config.users.motd == null || config.users.motdFile == null;
1501+
assertion = config.users.motd == "" || config.users.motdFile == null;
15021502
message = ''
15031503
Only one of users.motd and users.motdFile can be set.
15041504
'';

0 commit comments

Comments
 (0)