2024-10-21 12:31:30 +07:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
unstable,
|
|
|
|
...
|
|
|
|
}:
|
2024-06-17 16:26:56 +07:00
|
|
|
let
|
|
|
|
cfg = config.profile.neovim;
|
|
|
|
inherit (lib) mkIf;
|
|
|
|
repository = "git@github.com:tigorlazuardi/nvim.git";
|
2024-06-17 17:28:32 +07:00
|
|
|
nvimCloneDir = "${config.home.homeDirectory}/.config/nvim";
|
2024-06-17 16:26:56 +07:00
|
|
|
in
|
2024-06-12 09:54:11 +07:00
|
|
|
{
|
2024-06-17 16:26:56 +07:00
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.user.services.clone-nvim = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Clone neovim configuration if not exists";
|
|
|
|
Wants = [ "network-online.target" ];
|
|
|
|
After = [ "nss-lookup.target" ];
|
|
|
|
StartLimitIntervalSec = 300;
|
|
|
|
StartLimitBurst = 10;
|
|
|
|
};
|
|
|
|
Service =
|
|
|
|
let
|
|
|
|
git = "${pkgs.git}/bin/git";
|
|
|
|
bash = "${pkgs.bash}/bin/bash";
|
|
|
|
ping = "${pkgs.unixtools.ping}/bin/ping";
|
|
|
|
host = "github.com";
|
|
|
|
sleep = "${pkgs.coreutils}/bin/sleep";
|
2024-10-21 12:31:30 +07:00
|
|
|
script =
|
|
|
|
pkgs.writeScriptBin "clone-nvim.sh" # bash
|
|
|
|
''
|
|
|
|
#!${bash}
|
2024-06-12 09:54:11 +07:00
|
|
|
|
2024-10-21 12:31:30 +07:00
|
|
|
if [ -d "${nvimCloneDir}" ]; then
|
|
|
|
exit 0;
|
|
|
|
fi
|
2024-06-17 16:26:56 +07:00
|
|
|
|
2024-10-21 12:31:30 +07:00
|
|
|
until ${ping} -c 1 ${host}; do
|
|
|
|
${sleep} 1;
|
|
|
|
done
|
2024-06-17 16:26:56 +07:00
|
|
|
|
2024-10-21 12:31:30 +07:00
|
|
|
mkdir -p ${nvimCloneDir}
|
2024-06-17 16:34:36 +07:00
|
|
|
|
2024-10-21 12:31:30 +07:00
|
|
|
${git} clone ${repository} ${nvimCloneDir}
|
|
|
|
'';
|
2024-06-17 16:26:56 +07:00
|
|
|
path = "${script}/bin/clone-nvim.sh";
|
|
|
|
in
|
|
|
|
{
|
|
|
|
Type = "simple";
|
2024-06-17 17:28:32 +07:00
|
|
|
ExecStart = "${bash} ${path}";
|
2024-06-17 16:26:56 +07:00
|
|
|
Restart = "on-failure";
|
|
|
|
RemainAfterExit = "yes";
|
2024-06-17 17:50:57 +07:00
|
|
|
Environment = [
|
|
|
|
''GIT_SSH_COMMAND=${pkgs.openssh}/bin/ssh -i ${config.sops.secrets."ssh/id_ed25519/private".path}''
|
|
|
|
];
|
2024-06-17 16:26:56 +07:00
|
|
|
};
|
|
|
|
Install = {
|
|
|
|
WantedBy = [ "default.target" ];
|
|
|
|
};
|
|
|
|
};
|
2024-06-12 19:19:13 +07:00
|
|
|
|
2024-06-17 16:26:56 +07:00
|
|
|
sops.secrets."copilot" = {
|
|
|
|
path = "${config.home.homeDirectory}/.config/github-copilot/hosts.json";
|
|
|
|
};
|
|
|
|
|
|
|
|
home.packages = with pkgs; [
|
|
|
|
stylua
|
|
|
|
docker-compose-language-service
|
|
|
|
emmet-ls
|
|
|
|
silicon # For code screenshots
|
2024-08-12 19:20:24 +07:00
|
|
|
lua-language-server
|
2024-08-13 08:03:48 +07:00
|
|
|
taplo
|
2024-08-14 21:41:46 +07:00
|
|
|
yaml-language-server
|
|
|
|
vscode-langservers-extracted
|
2024-06-17 16:26:56 +07:00
|
|
|
|
|
|
|
curl
|
|
|
|
cargo
|
|
|
|
|
|
|
|
gcc
|
|
|
|
python3
|
2024-08-14 21:41:46 +07:00
|
|
|
|
|
|
|
# Docker tools
|
|
|
|
dockerfile-language-server-nodejs
|
|
|
|
hadolint
|
|
|
|
|
2024-08-19 23:11:44 +07:00
|
|
|
# For Peek markdown viewer
|
|
|
|
deno
|
|
|
|
|
|
|
|
# Golang debuggers
|
2024-10-08 08:55:35 +07:00
|
|
|
unstable.delve
|
2024-08-19 23:11:44 +07:00
|
|
|
gdlv
|
|
|
|
|
|
|
|
luajitPackages.tiktoken_core # For copilot chat
|
|
|
|
luajitPackages.luarocks
|
|
|
|
lua51Packages.lua
|
2024-06-17 16:26:56 +07:00
|
|
|
];
|
|
|
|
};
|
2024-06-12 09:54:11 +07:00
|
|
|
}
|