mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-09 16:33:57 -05:00
refactor: move zellij to shared module
This commit is contained in:
parent
362b9dda0f
commit
5b9d021b59
3 changed files with 39 additions and 18 deletions
|
|
@ -41,7 +41,6 @@
|
|||
vesktop
|
||||
gh
|
||||
nixfmt-rfc-style
|
||||
zellij
|
||||
tidal-hifi
|
||||
hyperfine
|
||||
|
||||
|
|
@ -135,23 +134,6 @@
|
|||
|
||||
zsh = {
|
||||
shellAliases.cd = "z";
|
||||
interactiveShellInit =
|
||||
let
|
||||
monitorScript = pkgs.replaceVarsWith {
|
||||
src = ./monitor.ps;
|
||||
replacements = builtins.mapAttrs (_: lib.getExe) {
|
||||
inherit (pkgs) perl xdotool;
|
||||
};
|
||||
isExecutable = true;
|
||||
};
|
||||
in
|
||||
''
|
||||
if [[ -z "$ZELLIJ" ]]; then
|
||||
MONITOR="$(${monitorScript} || true)"
|
||||
zellij attach -c "''${MONITOR:+"$MONITOR@"}$USER"
|
||||
exit
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
nix-index = {
|
||||
|
|
|
|||
39
nixosModules/zellij/default.nix
Normal file
39
nixosModules/zellij/default.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
}:
|
||||
{
|
||||
options.local.zellij = lib.mkEnableOption "zellij" // {
|
||||
default = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf config.local.zellij {
|
||||
local.packages = {
|
||||
inherit (pkgs) zellij;
|
||||
};
|
||||
|
||||
programs.zsh.interactiveShellInit =
|
||||
let
|
||||
monitorScript = pkgs.replaceVarsWith {
|
||||
src = ./monitor.ps;
|
||||
replacements = builtins.mapAttrs (_: lib.getExe) {
|
||||
inherit (pkgs) perl xdotool;
|
||||
};
|
||||
isExecutable = true;
|
||||
};
|
||||
in
|
||||
''
|
||||
if [[ -z "$ZELLIJ" ]]; then
|
||||
if [[ -n "$SSH_TTY" ]]; then
|
||||
zellij attach -c "SSH@$USER"
|
||||
else
|
||||
MONITOR="$(${monitorScript} || true)"
|
||||
zellij attach -c "''${MONITOR:+"$MONITOR@"}$USER"
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
'';
|
||||
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue