NixOS/home/config/nvim/default.nix

78 lines
1.8 KiB
Nix
Raw Normal View History

{ config, pkgs, lib, unstable, ... }:
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";
in
2024-06-12 09:54:11 +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";
script = pkgs.writeScriptBin "clone-nvim.sh" ''
2024-06-17 17:28:32 +07:00
#!${bash}
2024-06-12 09:54:11 +07:00
if [ -d "${nvimCloneDir}" ]; then
exit 0;
fi
until ${ping} -c 1 ${host}; do
${sleep} 1;
done
mkdir -p ${nvimCloneDir}
${git} clone ${repository} ${nvimCloneDir}
'';
path = "${script}/bin/clone-nvim.sh";
in
{
Type = "simple";
2024-06-17 17:28:32 +07:00
ExecStart = "${bash} ${path}";
Restart = "on-failure";
RemainAfterExit = "yes";
};
Install = {
WantedBy = [ "default.target" ];
};
};
2024-06-12 19:19:13 +07:00
sops.secrets."copilot" = {
path = "${config.home.homeDirectory}/.config/github-copilot/hosts.json";
};
home.packages = with pkgs; [
stylua
lua-language-server
docker-compose-language-service
emmet-ls
silicon # For code screenshots
###### Golang development tools ######
gomodifytags
gotests
iferr
curl
cargo
nixpkgs-fmt
nil
gcc
python3
];
};
2024-06-12 09:54:11 +07:00
}