fix: Make sure networking.nix is not imported

This commit is contained in:
Inex Code 2023-12-31 18:14:50 +03:00
parent 240391e62d
commit b7ea149f67

View file

@ -74,12 +74,6 @@ class MigrateToFlakes(Migration):
print("Moved") print("Moved")
print("Downloading the template of the new NixOS configuration") print("Downloading the template of the new NixOS configuration")
# subprocess.check_output(
# [
# "mkdir",
# "/etc/nixos",
# ]
# )
archive_url = "https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-template/archive/master.tar.gz" archive_url = "https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-template/archive/master.tar.gz"
temp_dir = tempfile.mkdtemp() temp_dir = tempfile.mkdtemp()
@ -98,14 +92,17 @@ class MigrateToFlakes(Migration):
print("Downloaded") print("Downloaded")
print("Copying hardware-configuration.nix") print("Copying hardware-configuration.nix")
subprocess.check_output( hardware_config_path = "/etc/nixos.pre-flakes/hardware-configuration.nix"
[ new_hardware_config_path = "/etc/nixos/hardware-configuration.nix"
"cp",
"-v", with open(hardware_config_path, "r") as hardware_config_file:
"/etc/nixos.pre-flakes/hardware-configuration.nix", hardware_config_lines = hardware_config_file.readlines()
"/etc/nixos/hardware-configuration.nix",
] # Check if the file contains the line with "./networking.nix" substring
) hardware_config_lines = [line for line in hardware_config_lines if "./networking.nix" not in line]
with open(new_hardware_config_path, "w") as new_hardware_config_file:
new_hardware_config_file.writelines(hardware_config_lines)
print("Copied") print("Copied")
print("Checking if /etc/nixos.pre-flakes/networking.nix exists") print("Checking if /etc/nixos.pre-flakes/networking.nix exists")