mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 17:38:29 +02:00
feat: shortname of zellij
feat: autostart zellij in nushell
This commit is contained in:
@@ -1,7 +1,31 @@
|
|||||||
_: {
|
let
|
||||||
|
shellAliases = {
|
||||||
|
"zj" = "zellij";
|
||||||
|
};
|
||||||
|
in {
|
||||||
programs.zellij = {
|
programs.zellij = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
# auto start zellij in nushell
|
||||||
|
programs.nushell.extraConfig = ''
|
||||||
|
# auto start zellij
|
||||||
|
if not "ZELLIJ" in $env {
|
||||||
|
if "ZELLIJ_AUTO_ATTACH" in $env and $env.ZELLIJ_AUTO_ATTACH == "true" {
|
||||||
|
zellij attach -c
|
||||||
|
} else {
|
||||||
|
zellij
|
||||||
|
}
|
||||||
|
|
||||||
|
# auto exit the shell session when zellij exit
|
||||||
|
if "ZELLIJ_AUTO_EXIT" in $env and $env.ZELLIJ_AUTO_EXIT == "true" {
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
|
||||||
|
# only works in bash/zsh, not nushell
|
||||||
|
home.shellAliases = shellAliases;
|
||||||
|
programs.nushell.shellAliases = shellAliases;
|
||||||
|
|
||||||
xdg.configFile."zellij/config.kdl".source = ./config.kdl;
|
xdg.configFile."zellij/config.kdl".source = ./config.kdl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ HTTP_PROXY = "http://127.0.0.1:7890"
|
|||||||
pl = plistlib.loads(NIX_DAEMON_PLIST.read_bytes())
|
pl = plistlib.loads(NIX_DAEMON_PLIST.read_bytes())
|
||||||
|
|
||||||
# set http proxy
|
# set http proxy
|
||||||
# pl["EnvironmentVariables"]["HTTP_PROXY"] = HTTP_PROXY
|
pl["EnvironmentVariables"]["HTTP_PROXY"] = HTTP_PROXY
|
||||||
# pl["EnvironmentVariables"]["HTTPS_PROXY"] = HTTP_PROXY
|
pl["EnvironmentVariables"]["HTTPS_PROXY"] = HTTP_PROXY
|
||||||
|
|
||||||
# remove http proxy
|
# remove http proxy
|
||||||
pl["EnvironmentVariables"].pop("HTTP_PROXY", None)
|
# pl["EnvironmentVariables"].pop("HTTP_PROXY", None)
|
||||||
pl["EnvironmentVariables"].pop("HTTPS_PROXY", None)
|
# pl["EnvironmentVariables"].pop("HTTPS_PROXY", None)
|
||||||
|
|
||||||
os.chmod(NIX_DAEMON_PLIST, 0o644)
|
os.chmod(NIX_DAEMON_PLIST, 0o644)
|
||||||
NIX_DAEMON_PLIST.write_bytes(plistlib.dumps(pl))
|
NIX_DAEMON_PLIST.write_bytes(plistlib.dumps(pl))
|
||||||
|
|||||||
Reference in New Issue
Block a user