Reorganize imports
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
14
hosts/common/configs/system/timezone/default.nix
Normal file
14
hosts/common/configs/system/timezone/default.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{ lib, pkgs, ... }:
|
||||
{
|
||||
networking.networkmanager.dispatcherScripts = [
|
||||
{
|
||||
source = lib.meta.getExe (
|
||||
pkgs.writeShellApplication {
|
||||
name = "timezone-sync";
|
||||
runtimeInputs = with pkgs; [ curl ];
|
||||
text = builtins.readFile ./timezone.sh;
|
||||
}
|
||||
);
|
||||
}
|
||||
];
|
||||
}
|
7
hosts/common/configs/system/timezone/timezone.sh
Normal file
7
hosts/common/configs/system/timezone/timezone.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
case "$2" in
|
||||
connectivity-change)
|
||||
if timezone=$(curl --fail https://ipapi.co/timezone); then
|
||||
timedatectl set-timezone "${timezone}"
|
||||
fi
|
||||
;;
|
||||
esac
|
Reference in New Issue
Block a user