Skip to content

Commit

Permalink
nixos/screen: fix assertion to actually execute
Browse files Browse the repository at this point in the history
See NixOS#312194 (comment) for explanation why the assertion currently fails to run.
  • Loading branch information
tomfitzhenry committed May 17, 2024
1 parent 9744593 commit 3544cfe
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions nixos/modules/programs/screen.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ in
package = lib.mkPackageOptionMD pkgs "screen" { };

screenrc = lib.mkOption {
type = with lib.types; nullOr lines;
type = lib.types.lines;
default = "";
example = ''
defscrollback 10000
startup_message off
Expand All @@ -22,20 +23,22 @@ in
};
};

config = {
# TODO: Added in 24.05, remove before 24.11
assertions = [
{
assertion = cfg.screenrc != null -> cfg.enable;
message = "`programs.screen.screenrc` has been configured, but `programs.screen.enable` is not true";
}
];
} // lib.mkIf cfg.enable {
environment.etc.screenrc = {
enable = cfg.screenrc != null;
text = cfg.screenrc;
};
environment.systemPackages = [ cfg.package ];
security.pam.services.screen = {};
};
config = lib.mkMerge [
{
# TODO: Added in 24.05, remove before 24.11
assertions = [
{
assertion = cfg.screenrc != "" -> cfg.enable;
message = "`programs.screen.screenrc` has been configured, but `programs.screen.enable` is not true";
}
];
}
(lib.mkIf cfg.enable {
environment.etc.screenrc = {
text = cfg.screenrc;
};
environment.systemPackages = [ cfg.package ];
security.pam.services.screen = {};
})
];
}

0 comments on commit 3544cfe

Please sign in to comment.