lol

Merge pull request #262133 from h7x4/cleanup-screen-module

nixos/screen: clean up module

authored by

Peder Bergebakken Sundt and committed by
GitHub
1079eccc b1d8da63

+24 -16
+1 -1
nixos/doc/manual/release-notes/rl-2405.section.md
··· 8 8 9 9 <!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. --> 10 10 11 - - Create the first release note entry in this section! 11 + - `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. 12 12 13 13 ## New Services {#sec-release-24.05-new-services} 14 14
+23 -15
nixos/modules/programs/screen.nix
··· 1 1 { config, lib, pkgs, ... }: 2 2 3 3 let 4 - inherit (lib) mkOption mkIf types; 5 4 cfg = config.programs.screen; 6 5 in 7 6 8 7 { 9 - ###### interface 10 - 11 8 options = { 12 9 programs.screen = { 10 + enable = lib.mkEnableOption (lib.mdDoc "screen, a basic terminal multiplexer"); 13 11 14 - screenrc = mkOption { 15 - default = ""; 16 - description = lib.mdDoc '' 17 - The contents of /etc/screenrc file. 12 + package = lib.mkPackageOptionMD pkgs "screen" { }; 13 + 14 + screenrc = lib.mkOption { 15 + type = with lib.types; nullOr lines; 16 + example = '' 17 + defscrollback 10000 18 + startup_message off 18 19 ''; 19 - type = types.lines; 20 + description = lib.mdDoc "The contents of {file}`/etc/screenrc` file"; 20 21 }; 21 22 }; 22 23 }; 23 24 24 - ###### implementation 25 - 26 - config = mkIf (cfg.screenrc != "") { 27 - environment.etc.screenrc.text = cfg.screenrc; 28 - 29 - environment.systemPackages = [ pkgs.screen ]; 25 + config = { 26 + # TODO: Added in 24.05, remove before 24.11 27 + assertions = [ 28 + { 29 + assertion = cfg.screenrc != null -> cfg.enable; 30 + message = "`programs.screen.screenrc` has been configured, but `programs.screen.enable` is not true"; 31 + } 32 + ]; 33 + } // lib.mkIf cfg.enable { 34 + environment.etc.screenrc = { 35 + enable = cfg.screenrc != null; 36 + text = cfg.screenrc; 37 + }; 38 + environment.systemPackages = [ cfg.package ]; 30 39 security.pam.services.screen = {}; 31 40 }; 32 - 33 41 }