Commit 05b0c497 authored by Tom Fitzhenry's avatar Tom Fitzhenry Committed by tomf
Browse files

nixos/screen: fix assertion to actually execute

See https://github.com/NixOS/nixpkgs/issues/312194#issuecomment-2115239401 for explanation why the assertion currently fails to run.
parent 9c58fc7f
Loading
Loading
Loading
Loading
+20 −17
Original line number Diff line number Diff line
@@ -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
@@ -22,20 +23,22 @@ in
    };
  };

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