Secrets, scripts, clean..

This commit is contained in:
Hadi
2024-03-15 21:26:34 +01:00
parent 05fc3fbcd9
commit 5e98256a82
27 changed files with 141 additions and 66 deletions

View File

@@ -1 +1,6 @@
{ imports = [ ./sshconfig.nix ./cava/default.nix ]; }
{
imports = [
./cava/default.nix
./nextcloud.nix # REMOVE
];
}

27
home/misc/nextcloud.nix Normal file
View File

@@ -0,0 +1,27 @@
{ pkgs, ... }: {
systemd.user.services.watch-nextcloud = {
Unit = { Description = "Start Nextcloud if I'm on one of my network"; };
Install = { WantedBy = [ "default.target" ]; };
Service = {
ExecStart = "${pkgs.writeShellScript "watch-nextcloud" ''
while 1;do
ssid=$(nmcli -t -f name connection show --active | head -n1)
if [[ $ssid == "inthecloud" || $ssid == "Wired connection 2" ]]; then
status=$(systemctl --user status nextcloud-client)
service_status=$(echo "$status" | awk '/Active:/ {print $2}')
if [[ $service_status == "inactive" ]]; then
systemctl --user start nextcloud-client
fi
else
status=$(systemctl --user status nextcloud-client)
service_status=$(echo "$status" | awk '/Active:/ {print $2}')
if [[ $service_status == "active" ]]; then
systemctl --user stop nextcloud-client
fi
fi
sleep 120
done
''}";
};
};
}

View File

@@ -1,14 +0,0 @@
{
home.file = {
".ssh/config" = {
text = ''
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github
'';
executable = false;
};
};
}