Compare commits

...

3 Commits

9 changed files with 983 additions and 75 deletions

431
flake.lock generated
View File

@@ -1,5 +1,29 @@
{
"nodes": {
"alejandra": {
"inputs": {
"fenix": "fenix",
"flakeCompat": "flakeCompat",
"nixpkgs": [
"jj-cz",
"nixpkgs"
]
},
"locked": {
"lastModified": 1744324181,
"narHash": "sha256-Oi1n2ncF4/AWeY6X55o2FddIRICokbciqFYK64XorYk=",
"owner": "kamadorueda",
"repo": "alejandra",
"rev": "3e2a85506627062313e131bf8a85315f3387c8e0",
"type": "github"
},
"original": {
"owner": "kamadorueda",
"ref": "4.0.0",
"repo": "alejandra",
"type": "github"
}
},
"cachix": {
"inputs": {
"devenv": [
@@ -33,6 +57,43 @@
"type": "github"
}
},
"cachix_2": {
"inputs": {
"devenv": [
"jj-cz",
"devenv"
],
"flake-compat": [
"jj-cz",
"devenv",
"flake-compat"
],
"git-hooks": [
"jj-cz",
"devenv",
"git-hooks"
],
"nixpkgs": [
"jj-cz",
"devenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1760971495,
"narHash": "sha256-IwnNtbNVrlZIHh7h4Wz6VP0Furxg9Hh0ycighvL5cZc=",
"owner": "cachix",
"repo": "cachix",
"rev": "c5bfd933d1033672f51a863c47303fc0e093c2d2",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "latest",
"repo": "cachix",
"type": "github"
}
},
"caelestia-cli": {
"inputs": {
"caelestia-shell": [
@@ -126,6 +187,56 @@
"type": "github"
}
},
"devenv_2": {
"inputs": {
"cachix": "cachix_2",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts_2",
"git-hooks": "git-hooks_2",
"nix": "nix_2",
"nixd": "nixd_2",
"nixpkgs": [
"jj-cz",
"nixpkgs"
]
},
"locked": {
"lastModified": 1770304289,
"narHash": "sha256-+g+XMyB1zi50h2N38GE32l7ZONX4oW7Nw6QSXzfNiwk=",
"owner": "cachix",
"repo": "devenv",
"rev": "fd777e39027d393346e4df672d51ad2bf44b2a12",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "devenv",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"jj-cz",
"alejandra",
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1730615655,
"narHash": "sha256-2HBR3zLn57LXKNRtxBb+O+uDqHM4n0pz51rPayMl4cg=",
"owner": "nix-community",
"repo": "fenix",
"rev": "efeb50e2535b17ffd4a135e6e3e5fd60a525180c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@@ -142,6 +253,22 @@
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1761588595,
"narHash": "sha256-XKUZz9zewJNUj46b4AJdiRZJAvSZ0Dqj2BNfXvFlJC4=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "f387cd2afec9419c8ee37694406ca490c3f34ee5",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
@@ -163,6 +290,28 @@
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"jj-cz",
"devenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1760948891,
"narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-root": {
"locked": {
"lastModified": 1723604017,
@@ -178,6 +327,21 @@
"type": "github"
}
},
"flake-root_2": {
"locked": {
"lastModified": 1723604017,
"narHash": "sha256-rBtQ8gg+Dn4Sx/s+pvjdq3CB2wQNzx9XGFq/JVGCB6k=",
"owner": "srid",
"repo": "flake-root",
"rev": "b759a56851e10cb13f6b8e5698af7b59c44be26e",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "flake-root",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1678901627,
@@ -211,6 +375,40 @@
"type": "github"
}
},
"flake-utils_3": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flakeCompat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": [
@@ -237,6 +435,34 @@
"type": "github"
}
},
"git-hooks_2": {
"inputs": {
"flake-compat": [
"jj-cz",
"devenv",
"flake-compat"
],
"gitignore": "gitignore_2",
"nixpkgs": [
"jj-cz",
"devenv",
"nixpkgs"
]
},
"locked": {
"lastModified": 1760663237,
"narHash": "sha256-BflA6U4AM1bzuRMR8QqzPXqh8sWVCNDzOdsxXEguJIc=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
@@ -259,6 +485,29 @@
"type": "github"
}
},
"gitignore_2": {
"inputs": {
"nixpkgs": [
"jj-cz",
"devenv",
"git-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -279,6 +528,30 @@
"type": "github"
}
},
"jj-cz": {
"inputs": {
"alejandra": "alejandra",
"devenv": "devenv_2",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1774310517,
"narHash": "sha256-0wvZ4TBJM0pigw2ix1TWFT9CIKpYZSVu7jQDyM4e1jA=",
"ref": "refs/heads/develop",
"rev": "dda4aae87caf35cf03d5b1ce0e172807fa987e5c",
"revCount": 27,
"type": "git",
"url": "https://labs.phundrak.com/phundrak/jj-cz"
},
"original": {
"type": "git",
"url": "https://labs.phundrak.com/phundrak/jj-cz"
}
},
"nix": {
"inputs": {
"flake-compat": [
@@ -339,6 +612,52 @@
"type": "github"
}
},
"nix_2": {
"inputs": {
"flake-compat": [
"jj-cz",
"devenv",
"flake-compat"
],
"flake-parts": [
"jj-cz",
"devenv",
"flake-parts"
],
"git-hooks-nix": [
"jj-cz",
"devenv",
"git-hooks"
],
"nixpkgs": [
"jj-cz",
"devenv",
"nixpkgs"
],
"nixpkgs-23-11": [
"jj-cz",
"devenv"
],
"nixpkgs-regression": [
"jj-cz",
"devenv"
]
},
"locked": {
"lastModified": 1769708679,
"narHash": "sha256-uFKkp2/SjIqbu5HtINg/hwHN6qaqcxLIbL/om7dT3kI=",
"owner": "cachix",
"repo": "nix",
"rev": "72bec37fabbfe378d677868ec42eeb83acf07a4c",
"type": "github"
},
"original": {
"owner": "cachix",
"ref": "devenv-2.32",
"repo": "nix",
"type": "github"
}
},
"nixd": {
"inputs": {
"flake-parts": [
@@ -366,6 +685,35 @@
"type": "github"
}
},
"nixd_2": {
"inputs": {
"flake-parts": [
"jj-cz",
"devenv",
"flake-parts"
],
"flake-root": "flake-root_2",
"nixpkgs": [
"jj-cz",
"devenv",
"nixpkgs"
],
"treefmt-nix": "treefmt-nix_2"
},
"locked": {
"lastModified": 1763964548,
"narHash": "sha256-JTRoaEWvPsVIMFJWeS4G2isPo15wqXY/otsiHPN0zww=",
"owner": "nix-community",
"repo": "nixd",
"rev": "d4bf15e56540422e2acc7bc26b20b0a0934e3f5e",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixd",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1772624091,
@@ -384,11 +732,11 @@
},
"pumo-system-info": {
"inputs": {
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils_3",
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1748984111,
@@ -431,6 +779,7 @@
"copyparty": "copyparty",
"devenv": "devenv",
"home-manager": "home-manager",
"jj-cz": "jj-cz",
"nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs",
"pumo-system-info": "pumo-system-info",
@@ -440,7 +789,45 @@
"zen-browser": "zen-browser"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1730555913,
"narHash": "sha256-KNHZUlqsEibg3YtfUyOFQSofP8hp1HKoY+laoesBxRM=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "f17a5bbfd0969ba2e63a74505a80e55ecb174ed9",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"jj-cz",
"nixpkgs"
]
},
"locked": {
"lastModified": 1770260791,
"narHash": "sha256-ADTBfENFjRVDQMcCycyX/pAy6NFI/Ct6Mrar3gsmXI0=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "42ec85352e419e601775c57256a52f6d48a39906",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": {
"nixpkgs": [
"pumo-system-info",
@@ -486,7 +873,7 @@
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_2"
"systems": "systems_3"
},
"locked": {
"lastModified": 1772494187,
@@ -552,6 +939,21 @@
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
@@ -574,6 +976,29 @@
"type": "github"
}
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": [
"jj-cz",
"devenv",
"nixd",
"nixpkgs"
]
},
"locked": {
"lastModified": 1734704479,
"narHash": "sha256-MMi74+WckoyEWBRcg/oaGRvXC9BVVxDZNRMpL+72wBI=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "65712f5af67234dad91a5a4baee986a8b62dbf8f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"zen-browser": {
"inputs": {
"nixpkgs": [

View File

@@ -29,6 +29,11 @@
inputs.nixpkgs.follows = "nixpkgs";
};
jj-cz = {
url = "git+https://labs.phundrak.com/phundrak/jj-cz";
inputs.nixpkgs.follows = "nixpkgs";
};
pumo-system-info = {
url = "git+https://labs.phundrak.com/phundrak/pumo-system-info";
inputs.nixpkgs.follows = "nixpkgs";

View File

@@ -48,6 +48,10 @@ in {
enable = mkDefault true;
inherit (cfg) name email editor;
signing.sshKey = mkDefault (cfg.publicKey.file or cfg.publicKey.content);
cz = {
enable = mkDefault true;
alias = mkDefault true;
};
};
};
}

View File

@@ -2,10 +2,13 @@
lib,
config,
pkgs,
inputs,
...
}:
with lib; let
inherit (pkgs.stdenv.hostPlatform) system;
cfg = config.home.dev.vcs.jj;
jj-cz = inputs.jj-cz.packages.${system}.default;
in {
options.home.dev.vcs.jj = {
enable = mkEnableOption "enables jj";
@@ -33,83 +36,91 @@ in {
description = "Path to the private SSH key for signing.";
};
};
cz = {
enable = mkEnableOption "Enables jj-cz";
alias = mkEnableOption "Enable `jj cz` as an alias to `jj-cz`";
};
};
config.programs.jujutsu = mkIf cfg.enable {
enable = true;
settings = {
user = {
inherit (cfg) name email;
};
ui = {
default-command = "st";
pager = ":builtin";
show-cryptographic-signatures = true;
diff-editor = ":builtin";
merge-editort = ":builtin";
inherit (cfg) editor;
};
signing = mkIf cfg.signing.enable {
behavior = "own";
backend = "ssh";
key = cfg.signing.sshKey;
backends.ssh.allowed-signers = "${config.home.homeDirectory}/.ssh/allowed_signers";
backends.ssh.program = "${pkgs.openssh}/bin/ssh-keygen";
};
aliases = {
blame = ["file" "annotate"];
consume = ["squash" "--into" "@" "--from"];
eject = ["squash" "--from" "@" "--into"];
d = ["diff"];
dm = ["desc" "-m"];
gc = ["git" "clone"];
gcc = ["git" "clone" "--colocate"];
l = ["log"];
la = ["log" "-r" "::"];
lc = ["log" "-r" "(remote_bookmarks()..@)::"];
ll = ["log" "-T" "builtin_log_detailed"];
open = ["log" "-r" "open()"];
n = ["new"];
nd = ["new" "dev()"];
nt = ["new" "trunk()"];
revlog = ["evolog"];
s = ["show"];
tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-"];
};
colors.working_copy.underline = true;
git = {
private-commits = "blacklist()";
colocate = true;
subprocess = true;
};
revset-aliases = {
"immutable_heads()" = "present(trunk()) | tags()";
# Resolves by default to latest main/master remote bookmarks
"trunk()" = "latest((present(main) | present(master)) & remote_bookmarks())";
# Same as trunk() but for `dev` or `develop` bookmarks
"dev()" = "latest((present(dev) | present(develop)) & remote_bookmarks())";
config = mkIf cfg.enable {
home.packages = mkIf cfg.cz.enable [jj-cz];
programs.jujutsu = {
enable = true;
settings = {
user = {
inherit (cfg) name email;
};
ui = {
default-command = "st";
pager = ":builtin";
show-cryptographic-signatures = true;
diff-editor = ":builtin";
merge-editort = ":builtin";
inherit (cfg) editor;
};
signing = mkIf cfg.signing.enable {
behavior = "own";
backend = "ssh";
key = cfg.signing.sshKey;
backends.ssh.allowed-signers = "${config.home.homeDirectory}/.ssh/allowed_signers";
backends.ssh.program = "${pkgs.openssh}/bin/ssh-keygen";
};
aliases = {
blame = ["file" "annotate"];
consume = ["squash" "--into" "@" "--from"];
cz = mkIf cfg.cz.alias ["util" "exec" "--" "${jj-cz}/bin/jj-cz"];
eject = ["squash" "--from" "@" "--into"];
d = ["diff"];
dm = ["desc" "-m"];
gc = ["git" "clone"];
gcc = ["git" "clone" "--colocate"];
l = ["log"];
la = ["log" "-r" "::"];
lc = ["log" "-r" "(remote_bookmarks()..@)::"];
ll = ["log" "-T" "builtin_log_detailed"];
open = ["log" "-r" "open()"];
n = ["new"];
nd = ["new" "dev()"];
nt = ["new" "trunk()"];
revlog = ["evolog"];
s = ["show"];
tug = ["bookmark" "move" "--from" "heads(::@- & bookmarks())" "--to" "@-"];
};
colors.working_copy.underline = true;
git = {
private-commits = "blacklist()";
colocate = true;
subprocess = true;
};
revset-aliases = {
"immutable_heads()" = "present(trunk()) | tags()";
# Resolves by default to latest main/master remote bookmarks
"trunk()" = "latest((present(main) | present(master)) & remote_bookmarks())";
# Same as trunk() but for `dev` or `develop` bookmarks
"dev()" = "latest((present(dev) | present(develop)) & remote_bookmarks())";
"user(x)" = "author(x) | committer(x)";
"gh_pages()" = "ancestors(remote_bookmarks(exact:\"gh-pages\"))";
"user(x)" = "author(x) | committer(x)";
"gh_pages()" = "ancestors(remote_bookmarks(exact:\"gh-pages\"))";
#Private and WIP commits that should never be pushed
"wip()" = "description(glob:\"wip:*\")";
"private()" = "description(glob:\"private:*\")";
"blacklist()" = "wip() | private()";
#Private and WIP commits that should never be pushed
"wip()" = "description(glob:\"wip:*\")";
"private()" = "description(glob:\"private:*\")";
"blacklist()" = "wip() | private()";
# stack(x, n) is the set of mutable commits reachable from
# 'x', with 'n' parents. 'n' is often useful to customize the
# display and return set for certain operations. 'x' can be
# used to target the set of 'roots' to traverse, e.g. @ is the
# current stack.
"stack()" = "ancestors(reachable(@, mutable()), 2)";
"stack(x)" = "ancestors(reachable(x, mutable()), 2)";
"stack(x, n)" = "ancestors(reachable(x, mutable()), n)";
# stack(x, n) is the set of mutable commits reachable from
# 'x', with 'n' parents. 'n' is often useful to customize the
# display and return set for certain operations. 'x' can be
# used to target the set of 'roots' to traverse, e.g. @ is the
# current stack.
"stack()" = "ancestors(reachable(@, mutable()), 2)";
"stack(x)" = "ancestors(reachable(x, mutable()), 2)";
"stack(x, n)" = "ancestors(reachable(x, mutable()), n)";
"open()" = "stack(dev().. & mine(), 1)";
"ready()" = "open() ~ blacklist()::";
"open()" = "stack(dev().. & mine(), 1)";
"ready()" = "open() ~ blacklist()::";
};
remotes.origin.auto-track-bookmarks = "*";
};
remotes.origin.auto-track-bookmarks = "*";
};
};
}

View File

@@ -78,6 +78,7 @@ in {
./fish.nix
./starship.nix
./tmux.nix
./zellij.nix
./zsh.nix
./zoxide.nix
];

View File

@@ -0,0 +1,198 @@
{
pkgs,
lib,
config,
...
}:
with lib; let
cfg = config.home.shell.zellij;
isEmpty = list: list == [];
plugin = {
options = {
name = mkOption {
type = types.str;
example = "filepicket";
};
location = mkOption {
type = types.nullOr types.str;
example = "zellij:strider";
description = ''
When null, defaults to zellij:`name`
'';
};
config = mkOption {
type = types.nullOr types.attrs;
default = null;
};
};
};
pluginToLines = plugin: let
location =
if plugin ? location
then plugin.location
else "location=\"${plugin.name}\"";
in ''
${plugin.name} ${location}
'';
keybind = {
options = {
bind = mkOption {
type = types.either types.str (types.listOf types.str);
example = "Alt j";
description = "Value used as a string after `bind` in zellij config";
};
actions = mkOption {
type = with types; let
allowed = oneOf [int str];
in
attrsOf (either (listOf allowed) allowed);
default = {};
example = {
SwitchToMode = ["normal"];
SwitchFocus = [];
PaneNameInput = [0];
};
};
useUnlockFirst = mkOption {
type = types.bool;
default = false;
description = ''
Go back to locked mode after the actions are done.
Only works when `config.home.shell.zellij.useUnlockFirst` is true.
'';
};
};
};
convertBind = item: {
bind = let
useUnlockFirst = cfg.useUnlockFirst && item.useUnlockFirst;
children =
mapAttrsToList (action: args: let
actualArgs =
if isEmpty args
then {}
else {_args = lists.toList args;};
in {"${action}" = actualArgs;})
(item.actions
// (
if useUnlockFirst
then {SwitchToMode = ["locked"];}
else {}
));
in {
_args = lists.toList item.bind;
_children = children;
};
};
keybindsModule = {
options = mergeAttrsList (forEach [
"normal"
"locked"
"resize"
"pane"
"move"
"tab"
"scroll"
"search"
"entersearch"
"renametab"
"renamepane"
"session"
"tmux"
]
(x: {
"${x}" = mkOption {
type = types.listOf (types.submodule keybind);
default = [];
};
}));
};
makeKeybinds = keybinds: let
values =
attrsets.concatMapAttrs (
mode: binds:
if (isEmpty binds)
then {}
else {
"${mode}"._children = lists.forEach binds convertBind;
}
)
keybinds;
in
if values == {}
then {}
else {
keybinds = values;
};
in {
options.home.shell.zellij = {
enable = mkEnableOption "Enable Zellij";
clearDefaultKeybinds = mkEnableOption "Clear default keybinds";
settings = mkOption {
type = (pkgs.formats.yaml {}).type;
default = {};
};
layouts = mkOption {
type = (pkgs.formats.yaml {}).type;
default = {};
};
extraSettings = mkOption {
type = types.lines;
default = "";
description = ''
Extra configuration lines to add to `$XDG_CONFIG_HOME/zellij/config.kdl`
'';
};
useUnlockFirst = mkEnableOption "Use Unlock-First (non-colliding) behaviour by default";
plugins = mkOption {
type = types.listOf (types.submodule plugin);
default = {};
example = [
{name = "about";}
{
name = "filepicker";
location = "zellij:strider";
options = {
cwd = "/";
};
}
];
};
keybinds = mkOption {
type = types.submodule keybindsModule;
default = {};
example = {
pane = [
{
bind = "c";
actions = [
{
action = "SwitchToMode";
args = ["renamepane"];
}
{
action = "PaneNameInput";
args = [0];
}
];
}
];
};
};
};
config.programs.zellij = mkIf cfg.enable {
inherit (cfg) enable layouts;
extraConfig = cfg.extraSettings;
settings = let
resetKeybinds =
if cfg.clearDefaultKeybinds
then {
keybinds._props.clear-defaults = true;
}
else {};
keybinds = makeKeybinds cfg.keybinds;
in
cfg.settings // resetKeybinds // keybinds;
};
}

View File

@@ -67,7 +67,7 @@
caelestia.enable = true;
spotify = {
enable = true;
spicetify.enable = false;
spicetify.enable = true;
};
};
dev = {

View File

@@ -7,7 +7,7 @@
with lib; let
cfg = config.home.phundrak;
in {
imports = [../modules];
imports = [../modules ./zellij.nix];
options.home.phundrak = {
sshKey = {

264
users/phundrak/zellij.nix Normal file
View File

@@ -0,0 +1,264 @@
{lib, ...}: {
home.shell.zellij = with lib; {
enable = true;
clearDefaultKeybinds = true;
useUnlockFirst = true;
settings.copy_on_select = true;
extraSettings = ''
plugins {
about location="zellij:about"
compact-bar location="zellij:compact-bar"
configuration location="zellij:configuration"
filepicker location="zellij:strider" {
cwd "/"
}
plugin-manager location="zellij:plugin-manager"
session-manager location="zellij:session-manager"
status-bar location="zellij:status-bar"
strider location="zellij:strider"
tab-bar location="zellij:tab-bar"
welcome-screen location="zellij:session-manager" {
welcome_screen true
}
}
'';
keybinds = let
# bépo layout
left = ["c" "Left"];
down = ["t" "Down"];
up = ["s" "Up"];
right = ["r" "Right"];
numRow = ["\"" "«" "»" "(" ")" "@" "+" "-" "/" "*"];
in {
locked = [
{
bind = "Ctrl Alt g";
actions = {SwitchToMode = "normal";};
}
];
pane = [
{
bind = left;
actions = {MoveFocus = "Left";};
}
{
bind = down;
actions = {MoveFocus = "Down";};
}
{
bind = up;
actions = {MoveFocus = "Up";};
}
{
bind = right;
actions = {MoveFocus = "Right";};
}
{
bind = "n";
actions = {NewPane = [];};
useUnlockFirst = true;
}
{
bind = "T";
actions = {NewPane = "Down";};
useUnlockFirst = true;
}
{
bind = "R";
actions = {NewPane = "Right";};
useUnlockFirst = true;
}
{
bind = "S";
actions = {NewPane = "stacked";};
useUnlockFirst = true;
}
{
bind = "N";
actions = {SwitchToMode = "normal";};
}
{
bind = "e";
actions = {TogglePaneEmbedOrFloating = [];};
useUnlockFirst = true;
}
{
bind = "i";
actions = {TogglePanePinned = [];};
}
{
bind = "f";
actions = {ToggleFocusFullscreen = [];};
useUnlockFirst = true;
}
{
bind = "F";
actions = {ToggleFloatingPanes = [];};
}
{
bind = "q";
actions = {CloseFocus = [];};
useUnlockFirst = true;
}
{
bind = "p";
actions = {SwitchToMode = "normal";};
}
{
bind = "P";
actions = {
SwitchToMode = "renamepane";
PaneNameInput = 0;
};
}
{
bind = "z";
actions = {TogglePaneFrames = [];};
useUnlockFirst = true;
}
{
bind = "tab";
actions = {SwitchFocus = [];};
}
];
resize = [
{
bind = "n";
actions = {SwitchToMode = "locked";};
}
{
bind = left;
actions = {Resize = "Increase Left";};
}
{
bind = down;
actions = {Resize = "Increase Down";};
}
{
bind = up;
actions = {Resize = "Increase Up";};
}
{
bind = right;
actions = {Resize = "Increase Right";};
}
{
bind = "C";
actions = {Resize = "Decrease Left";};
}
{
bind = "T";
actions = {Resize = "Decrease Down";};
}
{
bind = "S";
actions = {Resize = "Decrease Up";};
}
{
bind = "R";
actions = {Resize = "Decrease Right";};
}
{
bind = "+";
actions = {Resize = "Increase";};
}
{
bind = "-";
actions = {Resize = "Decrease";};
}
];
move = [
{
bind = left;
actions = {MovePane = "left";};
}
{
bind = down;
actions = {MovePane = "down";};
}
{
bind = up;
actions = {MovePane = "up";};
}
{
bind = right;
actions = {MovePane = "right";};
}
{
bind = "m";
actions = {SwitchToMode = "normal";};
}
{
bind = ["n" "tab"];
actions = {MovePane = [];};
}
{
bind = "p";
actions = {MovePaneBackwards = [];};
}
];
tab =
[
{
bind = left ++ up;
actions = {GoToPreviousTab = [];};
}
{
bind = down ++ right;
actions = {GoToNextTab = [];};
}
{
bind = "[";
actions = {BreakPaneLeft = [];};
useUnlockFirst = true;
}
{
bind = "]";
actions = {BreakPaneRight = [];};
useUnlockFirst = true;
}
{
bind = "b";
actions = {BreakPane = [];};
useUnlockFirst = true;
}
{
bind = "n";
actions = {NewTab = [];};
useUnlockFirst = true;
}
{
bind = "R";
actions = {
SwitchToMode = "renametab";
TabNameInput = 0;
};
}
{
bind = "s";
actions = {ToggleActiveSyncTab = [];};
useUnlockFirst = true;
}
{
bind = "T";
actions = {SwitchToMode = "normal";};
}
{
bind = "x";
actions = {CloseTab = [];};
useUnlockFirst = true;
}
{
bind = "tab";
actions = {ToggleTab = [];};
}
]
++ (lists.imap1 (i: key: {
bind = key;
actions = {GoToTab = i;};
useUnlockFirst = true;
})
numRow);
};
};
}