chore: advance workstation workflow pilots
This commit is contained in:
1 parent
2c0338329b
commit
c9ee688537
18 files changed
+328
-553
No files matched your search
@@ -19,8 +19,28 @@ in
|
||||
};
|
||||
|
||||
flake.modules.homeManager.walker =
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
homeDir = config.home.homeDirectory;
|
||||
projectRoots =
|
||||
map
|
||||
(scope: {
|
||||
inherit scope;
|
||||
path = "${homeDir}/dev/${scope}";
|
||||
})
|
||||
[
|
||||
"work"
|
||||
"own"
|
||||
"ext"
|
||||
"forks"
|
||||
];
|
||||
walkerDefaults = builtins.fromTOML (builtins.readFile "${inputs.walker}/resources/config.toml");
|
||||
|
||||
launcher = pkgs.writeShellApplication {
|
||||
name = "walker-launcher";
|
||||
runtimeInputs = [ pkgs.libressl.nc ];
|
||||
@@ -28,22 +48,88 @@ in
|
||||
exec nc -U "$XDG_RUNTIME_DIR/walker/walker.sock"
|
||||
'';
|
||||
};
|
||||
openProject = pkgs.writeShellApplication {
|
||||
name = "open-project";
|
||||
text = ''
|
||||
project_path="''${1:-}"
|
||||
if [[ -z "$project_path" ]]; then
|
||||
IFS= read -r project_path
|
||||
fi
|
||||
|
||||
cd -- "$project_path"
|
||||
exec ${lib.getExe config.programs.kitty.package} --detach --directory "$PWD" \
|
||||
${lib.getExe pkgs.zsh} -lic 'nvim; exec zsh -l'
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [ inputs.walker.homeManagerModules.default ];
|
||||
|
||||
desktop.commands.launcher = [ (lib.getExe launcher) ];
|
||||
home.packages = [ openProject ];
|
||||
|
||||
xdg.configFile."elephant/menus/projects.lua".text = ''
|
||||
Name = "projects"
|
||||
NamePretty = "Projects"
|
||||
Description = "Git repositories"
|
||||
Icon = "folder"
|
||||
Action = "${lib.getExe openProject}"
|
||||
SearchName = true
|
||||
RefreshOnChange = {
|
||||
${lib.concatMapStringsSep "\n " (root: ''"${root.path}",'') projectRoots}
|
||||
}
|
||||
|
||||
local roots = {
|
||||
${lib.concatMapStringsSep "\n " (
|
||||
root: ''{ scope = "${root.scope}", path = "${root.path}" },''
|
||||
) projectRoots}
|
||||
}
|
||||
|
||||
local function repositories(root)
|
||||
return io.popen(
|
||||
"${lib.getExe pkgs.findutils} " .. root ..
|
||||
" -mindepth 1 \\( -type d \\( -name .archive -o -name .worktrees \\) -prune \\)" ..
|
||||
" -o \\( -name .git -print \\) 2>/dev/null"
|
||||
)
|
||||
end
|
||||
|
||||
function GetEntries()
|
||||
local entries = {}
|
||||
|
||||
for _, root in ipairs(roots) do
|
||||
local handle = repositories(root.path)
|
||||
if handle then
|
||||
for git_path in handle:lines() do
|
||||
local project = git_path:gsub("/%.git$", "")
|
||||
local relative = project:sub(#root.path + 2)
|
||||
table.insert(entries, {
|
||||
Text = project:match("([^/]+)$"),
|
||||
Subtext = root.scope .. " · " .. relative,
|
||||
Value = project,
|
||||
Keywords = { root.scope, relative, project },
|
||||
})
|
||||
end
|
||||
handle:close()
|
||||
end
|
||||
end
|
||||
|
||||
return entries
|
||||
end
|
||||
'';
|
||||
|
||||
programs.walker = {
|
||||
enable = true;
|
||||
runAsService = true;
|
||||
|
||||
config.providers.prefixes = [
|
||||
{
|
||||
provider = "bitwarden";
|
||||
prefix = "?";
|
||||
}
|
||||
];
|
||||
config.providers = {
|
||||
default = walkerDefaults.providers.default ++ [ "menus:projects" ];
|
||||
prefixes = walkerDefaults.providers.prefixes ++ [
|
||||
{
|
||||
provider = "bitwarden";
|
||||
prefix = "?";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user