refactor
This commit is contained in:
@@ -290,15 +290,11 @@ def main():
|
||||
# Set cores and jobs based on full-speed flag
|
||||
if args.full_speed:
|
||||
import multiprocessing
|
||||
|
||||
cores = jobs = multiprocessing.cpu_count()
|
||||
else:
|
||||
cores = 8
|
||||
jobs = 1
|
||||
|
||||
printfe("cyan", f"Limiting to {cores} cores with {jobs} jobs.")
|
||||
|
||||
# Home Manager update
|
||||
if args.ha:
|
||||
dotfiles_path = os.environ.get(
|
||||
"DOTFILES_PATH", os.path.expanduser("~/.dotfiles")
|
||||
@@ -306,7 +302,7 @@ def main():
|
||||
hostname = os.uname().nodename
|
||||
|
||||
printfe("cyan", "Updating Home Manager flake...")
|
||||
os.chdir(f"{dotfiles_path}/config/home-manager")
|
||||
os.chdir(f"{dotfiles_path}")
|
||||
status, output = run_command(
|
||||
[
|
||||
"nix",
|
||||
@@ -326,11 +322,6 @@ def main():
|
||||
# Check if home-manager is installed
|
||||
status, _ = run_command(["which", "home-manager"], shell=False)
|
||||
if status:
|
||||
printfe("cyan", "Cleaning old backup files...")
|
||||
backup_file = os.path.expanduser("~/.config/mimeapps.list.backup")
|
||||
if os.path.exists(backup_file):
|
||||
os.remove(backup_file)
|
||||
|
||||
printfe("cyan", "Upgrading Home Manager packages...")
|
||||
env = os.environ.copy()
|
||||
env["NIXPKGS_ALLOW_UNFREE"] = "1"
|
||||
@@ -377,12 +368,12 @@ def main():
|
||||
return 1
|
||||
|
||||
printfe("cyan", "Running Ansible playbook...")
|
||||
playbook_path = f"{dotfiles_path}/config/ansible/playbook.yml"
|
||||
playbook_path = f"{dotfiles_path}/ansible/playbook.yml"
|
||||
ansible_cmd = [
|
||||
"/usr/bin/env",
|
||||
"ansible-playbook",
|
||||
"-i",
|
||||
f"{dotfiles_path}/config/ansible/inventory.ini",
|
||||
f"{dotfiles_path}/ansible/inventory.ini",
|
||||
playbook_path,
|
||||
"--extra-vars",
|
||||
f"hostname={hostname}",
|
||||
|
||||
Reference in New Issue
Block a user