This commit is contained in:
parent
64b158ed2a
commit
eb516819fa
8 changed files with 79 additions and 89 deletions
|
@ -1,4 +1,4 @@
|
|||
{ config, pkgs, ... }:
|
||||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [ ../common ];
|
||||
|
@ -13,17 +13,6 @@
|
|||
notes.enable = true;
|
||||
ranger.enable = true;
|
||||
starship.enable = true;
|
||||
|
||||
tmux-sessionizer.enable = true;
|
||||
tmux-sessionizer.searchPaths =
|
||||
let
|
||||
inherit (config.xdg) userDirs;
|
||||
in
|
||||
[
|
||||
"${userDirs.extraConfig.XDG_REPOS_DIR}:2"
|
||||
"${userDirs.documents}:1"
|
||||
];
|
||||
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
|
|
|
@ -21,18 +21,6 @@
|
|||
ranger.enable = true;
|
||||
sxhkd.enable = true;
|
||||
starship.enable = true;
|
||||
|
||||
tmux-sessionizer.enable = true;
|
||||
tmux-sessionizer.searchPaths =
|
||||
let
|
||||
inherit (config.xdg) userDirs;
|
||||
in
|
||||
[
|
||||
"${userDirs.extraConfig.XDG_REPOS_DIR}:2"
|
||||
"${userDirs.documents}:1"
|
||||
"${config.home.homeDirectory}/tmp"
|
||||
];
|
||||
|
||||
zsh.enable = true;
|
||||
};
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
./screenkey.nix
|
||||
./starship.nix
|
||||
./sxhkd.nix
|
||||
./tmux-sessionizer.nix
|
||||
./zsh
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.features.cli.tmux-sessionizer;
|
||||
in
|
||||
{
|
||||
options.features.cli.tmux-sessionizer = {
|
||||
enable = mkEnableOption "Enable tmux-sessionizer";
|
||||
enableDmenuIntegration = mkEnableOption "Enable dmenu integration";
|
||||
|
||||
searchPaths = mkOption {
|
||||
default = [ config.home.homeDirectory ];
|
||||
type = types.listOf types.str;
|
||||
description = "List of search paths for tmux-sessionizer to use.";
|
||||
};
|
||||
|
||||
# TODO: add TS_EXTRA_SEARCH_PATHS.
|
||||
# TODO: add TS_MAX_DEPTH.
|
||||
# TODO: add TS_SESSION_COMMANDS once I figure out what they're for.
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
tmux-sessionizer
|
||||
];
|
||||
|
||||
home.file.".tmux-sessionizer".source = "${
|
||||
pkgs.writeShellApplication {
|
||||
name = ".tmux-sessionizer";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
tmux
|
||||
];
|
||||
|
||||
text = ''
|
||||
set +o errexit
|
||||
set +o nounset
|
||||
|
||||
if [[ "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/os" || "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/personal" || "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/work" ]]; then
|
||||
clear
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
tmux new-window -d -n scratch
|
||||
nvim .
|
||||
clear
|
||||
'';
|
||||
}
|
||||
}/bin/.tmux-sessionizer";
|
||||
|
||||
xdg.configFile."tmux-sessionizer/tmux-sessionizer.conf".text = ''
|
||||
TS_SEARCH_PATHS=(${builtins.concatStringsSep " " cfg.searchPaths})
|
||||
TS_SESSION_COMMANDS=(nvim .)
|
||||
'';
|
||||
};
|
||||
}
|
15
modules2/hosts/t480/tmux-sessionizer.nix
Normal file
15
modules2/hosts/t480/tmux-sessionizer.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
flake.modules.homeManager.base =
|
||||
{ config, ... }:
|
||||
{
|
||||
programs.tmux-sessionizer.searchPaths =
|
||||
let
|
||||
inherit (config.xdg) userDirs;
|
||||
in
|
||||
[
|
||||
"${userDirs.extraConfig.XDG_REPOS_DIR}:2"
|
||||
"${userDirs.documents}:1"
|
||||
"${config.home.homeDirectory}/tmp"
|
||||
];
|
||||
};
|
||||
}
|
26
modules2/tmux-sessionizer/config.nix
Normal file
26
modules2/tmux-sessionizer/config.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
flake.modules.homeManager.base =
|
||||
{ config, ... }:
|
||||
{
|
||||
options.programs.tmux-sessionizer = {
|
||||
searchPaths = lib.mkOption {
|
||||
default = [ config.home.homeDirectory ];
|
||||
type = lib.types.listOf lib.types.str;
|
||||
description = "List of search paths for tmux-sessionizer to use.";
|
||||
};
|
||||
|
||||
# TODO: add TS_EXTRA_SEARCH_PATHS.
|
||||
# TODO: add TS_MAX_DEPTH.
|
||||
# TODO: add TS_SESSION_COMMANDS once I figure out what they're for.
|
||||
};
|
||||
|
||||
config = {
|
||||
xdg.configFile."tmux-sessionizer/tmux-sessionizer.conf".text = ''
|
||||
TS_SEARCH_PATHS=(${builtins.concatStringsSep " " config.programs.tmux-sessionizer.searchPaths})
|
||||
TS_SESSION_COMMANDS=(nvim .)
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
30
modules2/tmux-sessionizer/default.nix
Normal file
30
modules2/tmux-sessionizer/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
flake.modules.homeManager.base =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
home.file.".tmux-sessionizer".source = "${
|
||||
pkgs.writeShellApplication {
|
||||
name = ".tmux-sessionizer";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
tmux
|
||||
];
|
||||
|
||||
text = ''
|
||||
set +o errexit
|
||||
set +o nounset
|
||||
|
||||
if [[ "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/os" || "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/personal" || "$PWD" == "${config.xdg.userDirs.extraConfig.XDG_REPOS_DIR}/work" ]]; then
|
||||
clear
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
tmux new-window -d -n scratch
|
||||
nvim .
|
||||
clear
|
||||
'';
|
||||
}
|
||||
}/bin/.tmux-sessionizer";
|
||||
};
|
||||
}
|
7
modules2/tmux-sessionizer/package.nix
Normal file
7
modules2/tmux-sessionizer/package.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
flake.modules.homeManager.base =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [ tmux-sessionizer ];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue