mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-10 19:11:06 +01:00
screen: add module
This commit is contained in:
parent
a8b6296a1e
commit
6bbc48804b
4 changed files with 96 additions and 0 deletions
55
modules/programs/screen.nix
Normal file
55
modules/programs/screen.nix
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
inherit (lib)
|
||||||
|
types
|
||||||
|
mkIf
|
||||||
|
mkEnableOption
|
||||||
|
mkPackageOption
|
||||||
|
mkOption
|
||||||
|
;
|
||||||
|
|
||||||
|
cfg = config.programs.screen;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = with lib.hm.maintainers; [ aguirre-matteo ];
|
||||||
|
options.programs.screen = {
|
||||||
|
enable = mkEnableOption "screen";
|
||||||
|
package = mkPackageOption pkgs "screen" { nullable = true; };
|
||||||
|
screenrc = mkOption {
|
||||||
|
type = with types; nullOr (either path lines);
|
||||||
|
default = null;
|
||||||
|
example = ''
|
||||||
|
screen -t rtorrent rtorrent
|
||||||
|
screen -t irssi irssi
|
||||||
|
screen -t centerim centerim
|
||||||
|
screen -t ncmpc ncmpc -c
|
||||||
|
screen -t bash4
|
||||||
|
screen -t bash5
|
||||||
|
screen -t bash6
|
||||||
|
screen -t bash7
|
||||||
|
screen -t bash8
|
||||||
|
screen -t bash9
|
||||||
|
altscreen on
|
||||||
|
term screen-256color
|
||||||
|
bind ',' prev
|
||||||
|
bind '.' next
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Config file for GNU Screen. All the details can be found here:
|
||||||
|
<https://www.gnu.org/software/screen/manual/screen.html>.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = mkIf (cfg.package != null) [ cfg.package ];
|
||||||
|
home.file.".screenrc" = mkIf (cfg.screenrc != null) {
|
||||||
|
source = if lib.isPath cfg.screenrc then cfg.screenrc else pkgs.writeText "screenrc" cfg.screenrc;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
1
tests/modules/programs/screen/default.nix
Normal file
1
tests/modules/programs/screen/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
{ screen-settings = ./settings.nix; }
|
||||||
14
tests/modules/programs/screen/screenrc
Normal file
14
tests/modules/programs/screen/screenrc
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
screen -t rtorrent rtorrent
|
||||||
|
screen -t irssi irssi
|
||||||
|
screen -t centerim centerim
|
||||||
|
screen -t ncmpc ncmpc -c
|
||||||
|
screen -t bash4
|
||||||
|
screen -t bash5
|
||||||
|
screen -t bash6
|
||||||
|
screen -t bash7
|
||||||
|
screen -t bash8
|
||||||
|
screen -t bash9
|
||||||
|
altscreen on
|
||||||
|
term screen-256color
|
||||||
|
bind ',' prev
|
||||||
|
bind '.' next
|
||||||
26
tests/modules/programs/screen/settings.nix
Normal file
26
tests/modules/programs/screen/settings.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
programs.screen = {
|
||||||
|
enable = true;
|
||||||
|
screenrc = ''
|
||||||
|
screen -t rtorrent rtorrent
|
||||||
|
screen -t irssi irssi
|
||||||
|
screen -t centerim centerim
|
||||||
|
screen -t ncmpc ncmpc -c
|
||||||
|
screen -t bash4
|
||||||
|
screen -t bash5
|
||||||
|
screen -t bash6
|
||||||
|
screen -t bash7
|
||||||
|
screen -t bash8
|
||||||
|
screen -t bash9
|
||||||
|
altscreen on
|
||||||
|
term screen-256color
|
||||||
|
bind ',' prev
|
||||||
|
bind '.' next
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
assertFileExists home-files/.screenrc
|
||||||
|
assertFileContent home-files/.screenrc ${./screenrc}
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue