|
336 | 336 |
|
337 | 337 | }
|
338 | 338 | """
|
339 |
| - |
| 339 | +def env_is_set(name): |
| 340 | + envValue = os.environ.get(name) |
| 341 | + return not (envValue is None or envValue == "") |
| 342 | + |
| 343 | +def generateProxyStrings(): |
| 344 | + proxyEnv = [] |
| 345 | + if env_is_set('http_proxy'): |
| 346 | + proxyEnv.append('http_proxy={}'.format(os.environ.get('http_proxy'))) |
| 347 | + if env_is_set('https_proxy'): |
| 348 | + proxyEnv.append('https_proxy={}'.format(os.environ.get('https_proxy'))) |
| 349 | + if env_is_set('HTTP_PROXY'): |
| 350 | + proxyEnv.append('HTTP_PROXY={}'.format(os.environ.get('HTTP_PROXY'))) |
| 351 | + if env_is_set('HTTPS_PROXY'): |
| 352 | + proxyEnv.append('HTTPS_PROXY={}'.format(os.environ.get('HTTPS_PROXY'))) |
| 353 | + |
| 354 | + if len(proxyEnv) > 0: |
| 355 | + proxyEnv.insert(0, "env") |
| 356 | + |
| 357 | + return proxyEnv |
340 | 358 |
|
341 | 359 | def pretty_name():
|
342 | 360 | return _("Installing NixOS.")
|
@@ -791,13 +809,25 @@ def run():
|
791 | 809 | status = _("Installing NixOS")
|
792 | 810 | libcalamares.job.setprogress(0.3)
|
793 | 811 |
|
| 812 | + # build nixos-install command |
| 813 | + nixosInstallCmd = [ "pkexec" ] |
| 814 | + nixosInstallCmd.extend(generateProxyStrings()) |
| 815 | + nixosInstallCmd.extend( |
| 816 | + [ |
| 817 | + "nixos-install", |
| 818 | + "--no-root-passwd", |
| 819 | + "--root", |
| 820 | + root_mount_point |
| 821 | + ] |
| 822 | + ) |
| 823 | + |
794 | 824 | # Install customizations
|
795 | 825 | try:
|
796 | 826 | output = ""
|
797 | 827 | proc = subprocess.Popen(
|
798 |
| - ["pkexec", "nixos-install", "--no-root-passwd", "--root", root_mount_point], |
| 828 | + nixosInstallCmd, |
799 | 829 | stdout=subprocess.PIPE,
|
800 |
| - stderr=subprocess.STDOUT, |
| 830 | + stderr=subprocess.STDOUT |
801 | 831 | )
|
802 | 832 | while True:
|
803 | 833 | line = proc.stdout.readline().decode("utf-8")
|
|
0 commit comments