From 16f42f829edf37b4827c1e362725960fb8dd8cff Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Tue, 2 Jul 2024 17:27:08 -0700 Subject: [PATCH] Initial sync script Uses the hostname to store the nixos configuration. --- sync | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 sync diff --git a/sync b/sync new file mode 100755 index 0000000..061b9f4 --- /dev/null +++ b/sync @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +from pathlib import Path +import shutil + + +def main() -> None: + with open("/etc/hostname", "r") as f: + content = f.read() + hostname = content.strip() + source = Path("/etc/nixos") + destination = Path(__file__).parent / hostname + print(source, destination) + shutil.copytree(source, destination, dirs_exist_ok=True) + + + +if __name__ == "__main__": + main()