Initial sync script

Uses the hostname to store the nixos configuration.
This commit is contained in:
Eli Ribble 2024-07-02 17:27:08 -07:00
parent 34491dc303
commit 16f42f829e
1 changed files with 18 additions and 0 deletions

18
sync Executable file
View File

@ -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()