about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-12-02 18:00:52 +0000
committerGitHub <noreply@github.com>2023-12-02 18:00:52 +0000
commit5f8f8a1514983d8785994d09bf1ae7388ea65327 (patch)
tree7ad832574e03833c42f53df7517eb6aa3934aae0 /nixos
parent0dff371f0d97ba0244fe0d53ee72623dc0a4fcf4 (diff)
parent7b80b3712d2c9f22ca930c4c9f1905897241b151 (diff)
downloadnixlib-5f8f8a1514983d8785994d09bf1ae7388ea65327.tar
nixlib-5f8f8a1514983d8785994d09bf1ae7388ea65327.tar.gz
nixlib-5f8f8a1514983d8785994d09bf1ae7388ea65327.tar.bz2
nixlib-5f8f8a1514983d8785994d09bf1ae7388ea65327.tar.lz
nixlib-5f8f8a1514983d8785994d09bf1ae7388ea65327.tar.xz
nixlib-5f8f8a1514983d8785994d09bf1ae7388ea65327.tar.zst
nixlib-5f8f8a1514983d8785994d09bf1ae7388ea65327.zip
Merge master into staging-next
Diffstat (limited to 'nixos')
-rw-r--r--nixos/doc/manual/release-notes/rl-2405.section.md2
-rw-r--r--nixos/modules/programs/screen.nix38
2 files changed, 24 insertions, 16 deletions
diff --git a/nixos/doc/manual/release-notes/rl-2405.section.md b/nixos/doc/manual/release-notes/rl-2405.section.md
index 84003d97d52c..1bff20db8989 100644
--- a/nixos/doc/manual/release-notes/rl-2405.section.md
+++ b/nixos/doc/manual/release-notes/rl-2405.section.md
@@ -8,7 +8,7 @@ In addition to numerous new and upgraded packages, this release has the followin
 
 <!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
 
-- Create the first release note entry in this section!
+- `screen`'s module has been cleaned, and will now require you to set `programs.screen.enable` in order to populate `screenrc` and add the program to the environment.
 
 ## New Services {#sec-release-24.05-new-services}
 
diff --git a/nixos/modules/programs/screen.nix b/nixos/modules/programs/screen.nix
index 68de9e52d7be..41bfb5d7809a 100644
--- a/nixos/modules/programs/screen.nix
+++ b/nixos/modules/programs/screen.nix
@@ -1,33 +1,41 @@
 { config, lib, pkgs, ... }:
 
 let
-  inherit (lib) mkOption mkIf types;
   cfg = config.programs.screen;
 in
 
 {
-  ###### interface
-
   options = {
     programs.screen = {
+      enable = lib.mkEnableOption (lib.mdDoc "screen, a basic terminal multiplexer");
+
+      package = lib.mkPackageOptionMD pkgs "screen" { };
 
-      screenrc = mkOption {
-        default = "";
-        description = lib.mdDoc ''
-          The contents of /etc/screenrc file.
+      screenrc = lib.mkOption {
+        type = with lib.types; nullOr lines;
+        example = ''
+          defscrollback 10000
+          startup_message off
         '';
-        type = types.lines;
+        description = lib.mdDoc "The contents of {file}`/etc/screenrc` file";
       };
     };
   };
 
-  ###### implementation
-
-  config = mkIf (cfg.screenrc != "") {
-    environment.etc.screenrc.text = cfg.screenrc;
-
-    environment.systemPackages = [ pkgs.screen ];
+  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 = {};
   };
-
 }