NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.73k stars 1.52k forks source link

`nix` fails to install packages that require building from behind a proxy #10491

Open ramboman opened 7 months ago

ramboman commented 7 months ago

Describe the bug

nix fails to install packages that require building from behind a proxy. It cannot download sources from behind a proxy.

Steps To Reproduce

export FTP_PROXY=127.0.0.1:8082 export HTTP_PROXY=$FTP_PROXY export HTTPS_PROXY=$FTP_PROXY

curl --location https://nixos.org/nix/install | sh -s -- "$@"

- Install nix from behind proxy:

$ sudo ~/tmp/install_nix.sh --daemon --yes % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 4052 100 4052 0 0 3633 0 0:00:01 0:00:01 --:--:-- 12353 downloading Nix 2.21.1 binary tarball for x86_64-linux from 'https://releases.nixos.org/nix/nix-2.21.1/nix-2.21.1-x86_64-linux.tar.xz' to '/tmp/nix-binary-tarball-unpack.WwE8IXm9zC'... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 21.8M 100 21.8M 0 0 2348k 0 0:00:09 0:00:09 --:--:-- 2842k Note: a multi-user installation is possible. See https://nixos.org/manual/nix/stable/installation/installing-binary.html#multi-user-installation Switching to the Multi-user Installer Welcome to the Multi-User Nix Installation

This installation tool will set up your computer with the Nix package manager. This will happen in a few stages:

  1. Make sure your computer doesn't already have Nix. If it does, I will show you instructions on how to clean up your old install.

  2. Show you what I am going to install and where. Then I will ask if you are ready to continue.

  3. Create the system users (uids [30001..30032]) and groups (gid 30000) that the Nix daemon uses to run builds. To create system users in a different range, exit and run this tool again with NIX_FIRST_BUILD_UID set.

  4. Perform the basic installation of the Nix files daemon.

  5. Configure your shell to import special Nix Profile files, so you can use Nix.

  6. Start the Nix daemon.

Would you like to see a more detailed list of what I will do? No TTY, assuming you would say yes :)

I will:

Ready to continue? No TTY, assuming you would say yes :)

~~> Checking for artifacts of previous installs Before I try to install, I'll check for signs Nix already is or has been installed on this system.

---- Nix config report --------------------------------------------------------- Temp Dir: /tmp/tmp.c6IZIDVwtz Nix Root: /nix Build Users: 32 Build Group ID: 30000 Build Group Name: nixbld

build users: Username: UID nixbld1: 30001 nixbld2: 30002 nixbld3: 30003 nixbld4: 30004 nixbld5: 30005 nixbld6: 30006 nixbld7: 30007 nixbld8: 30008 nixbld9: 30009 nixbld10: 30010 nixbld11: 30011 nixbld12: 30012 nixbld13: 30013 nixbld14: 30014 nixbld15: 30015 nixbld16: 30016 nixbld17: 30017 nixbld18: 30018 nixbld19: 30019 nixbld20: 30020 nixbld21: 30021 nixbld22: 30022 nixbld23: 30023 nixbld24: 30024 nixbld25: 30025 nixbld26: 30026 nixbld27: 30027 nixbld28: 30028 nixbld29: 30029 nixbld30: 30030 nixbld31: 30031 nixbld32: 30032

Ready to continue? No TTY, assuming you would say yes :)

~~> Setting up the build group nixbld

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo groupadd -g 30000 --system nixbld

Create the Nix build group, nixbld

        Created:    Yes

~~> Setting up the build user nixbld1

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 1 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30001 --password ! nixbld1

Creating the Nix build user, nixbld1

useradd warning: nixbld1's uid 30001 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 1 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld2

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 2 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30002 --password ! nixbld2

Creating the Nix build user, nixbld2

useradd warning: nixbld2's uid 30002 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 2 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld3

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 3 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30003 --password ! nixbld3

Creating the Nix build user, nixbld3

useradd warning: nixbld3's uid 30003 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 3 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld4

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 4 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30004 --password ! nixbld4

Creating the Nix build user, nixbld4

useradd warning: nixbld4's uid 30004 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 4 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld5

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 5 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30005 --password ! nixbld5

Creating the Nix build user, nixbld5

useradd warning: nixbld5's uid 30005 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 5 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld6

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 6 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30006 --password ! nixbld6

Creating the Nix build user, nixbld6

useradd warning: nixbld6's uid 30006 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 6 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld7

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 7 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30007 --password ! nixbld7

Creating the Nix build user, nixbld7

useradd warning: nixbld7's uid 30007 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 7 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld8

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 8 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30008 --password ! nixbld8

Creating the Nix build user, nixbld8

useradd warning: nixbld8's uid 30008 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 8 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld9

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 9 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30009 --password ! nixbld9

Creating the Nix build user, nixbld9

useradd warning: nixbld9's uid 30009 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 9 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld10

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 10 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30010 --password ! nixbld10

Creating the Nix build user, nixbld10

useradd warning: nixbld10's uid 30010 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 10 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld11

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 11 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30011 --password ! nixbld11

Creating the Nix build user, nixbld11

useradd warning: nixbld11's uid 30011 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 11 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld12

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 12 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30012 --password ! nixbld12

Creating the Nix build user, nixbld12

useradd warning: nixbld12's uid 30012 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 12 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld13

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 13 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30013 --password ! nixbld13

Creating the Nix build user, nixbld13

useradd warning: nixbld13's uid 30013 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 13 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld14

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 14 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30014 --password ! nixbld14

Creating the Nix build user, nixbld14

useradd warning: nixbld14's uid 30014 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 14 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld15

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 15 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30015 --password ! nixbld15

Creating the Nix build user, nixbld15

useradd warning: nixbld15's uid 30015 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 15 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld16

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 16 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30016 --password ! nixbld16

Creating the Nix build user, nixbld16

useradd warning: nixbld16's uid 30016 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 16 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld17

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 17 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30017 --password ! nixbld17

Creating the Nix build user, nixbld17

useradd warning: nixbld17's uid 30017 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 17 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld18

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 18 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30018 --password ! nixbld18

Creating the Nix build user, nixbld18

useradd warning: nixbld18's uid 30018 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 18 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld19

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 19 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30019 --password ! nixbld19

Creating the Nix build user, nixbld19

useradd warning: nixbld19's uid 30019 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 19 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld20

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 20 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30020 --password ! nixbld20

Creating the Nix build user, nixbld20

useradd warning: nixbld20's uid 30020 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 20 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld21

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 21 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30021 --password ! nixbld21

Creating the Nix build user, nixbld21

useradd warning: nixbld21's uid 30021 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 21 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld22

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 22 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30022 --password ! nixbld22

Creating the Nix build user, nixbld22

useradd warning: nixbld22's uid 30022 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 22 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld23

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 23 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30023 --password ! nixbld23

Creating the Nix build user, nixbld23

useradd warning: nixbld23's uid 30023 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 23 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld24

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 24 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30024 --password ! nixbld24

Creating the Nix build user, nixbld24

useradd warning: nixbld24's uid 30024 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 24 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld25

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 25 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30025 --password ! nixbld25

Creating the Nix build user, nixbld25

useradd warning: nixbld25's uid 30025 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 25 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld26

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 26 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30026 --password ! nixbld26

Creating the Nix build user, nixbld26

useradd warning: nixbld26's uid 30026 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 26 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld27

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 27 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30027 --password ! nixbld27

Creating the Nix build user, nixbld27

useradd warning: nixbld27's uid 30027 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 27 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld28

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 28 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30028 --password ! nixbld28

Creating the Nix build user, nixbld28

useradd warning: nixbld28's uid 30028 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 28 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld29

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 29 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30029 --password ! nixbld29

Creating the Nix build user, nixbld29

useradd warning: nixbld29's uid 30029 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 29 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld30

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 30 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30030 --password ! nixbld30

Creating the Nix build user, nixbld30

useradd warning: nixbld30's uid 30030 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 30 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld31

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 31 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30031 --password ! nixbld31

Creating the Nix build user, nixbld31

useradd warning: nixbld31's uid 30031 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 31 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the build user nixbld32

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo useradd --home-dir /var/empty --comment Nix build user 32 --gid 30000 --groups nixbld --no-user-group --system --shell /sbin/nologin --uid 30032 --password ! nixbld32

Creating the Nix build user, nixbld32

useradd warning: nixbld32's uid 30032 is greater than SYS_UID_MAX 999 Created: Yes Hidden: Yes Home Directory: /var/empty Note: Nix build user 32 Logins Disabled: Yes Member of nixbld: Yes PrimaryGroupID: 30000

~~> Setting up the basic directory structure

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo install -dv -m 0755 /nix /nix/var /nix/var/log /nix/var/log/nix /nix/var/log/nix/drvs /nix/var/nix /nix/var/nix/db /nix/var/nix/gcroots /nix/var/nix/profiles /nix/var/nix/temproots /nix/var/nix/userpool /nix/var/nix/daemon-socket /nix/var/nix/gcroots/per-user /nix/var/nix/profiles/per-user

to make the basic directory structure of Nix (part 1)

install: creating directory '/nix' install: creating directory '/nix/var' install: creating directory '/nix/var/log' install: creating directory '/nix/var/log/nix' install: creating directory '/nix/var/log/nix/drvs' install: creating directory '/nix/var/nix' install: creating directory '/nix/var/nix/db' install: creating directory '/nix/var/nix/gcroots' install: creating directory '/nix/var/nix/profiles' install: creating directory '/nix/var/nix/temproots' install: creating directory '/nix/var/nix/userpool' install: creating directory '/nix/var/nix/daemon-socket' install: creating directory '/nix/var/nix/gcroots/per-user' install: creating directory '/nix/var/nix/profiles/per-user'

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo install -dv -g nixbld -m 1775 /nix/store

to make the basic directory structure of Nix (part 2)

install: creating directory '/nix/store'

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo install -dv -m 0555 /etc/nix

to place the default nix daemon configuration (part 1)

install: creating directory '/etc/nix'

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo install -m 0664 /tmp/tmp.c6IZIDVwtz/.nix-channels /root/.nix-channels

to set up the default system channel (part 1)

~~> Installing Nix

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo cp -RPp ./store/1rkhjf55x59w6qm1pbhf80ks2wjpg973-libcpuid-0.6.4 ./store/2x7hmgm1h6xvpczz6k5p01p9hx0550hq-aws-checksums-0.1.17 ./store/390lzx2pal52yx3d6yafj6vjyb3dcfz2-gcc-12.3.0-lib ./store/47h1qcdfp2gp7qlzpa41zgmg6drvmrkz-nss-cacert-3.95 ./store/4gfi0ca6xy2w3pbb4rlqah4fd94iczjl-aws-c-sdkutils-0.1.12 ./store/4h5isrbr87jjw69rgdnhi8psi7hhk5im-libidn2-2.3.4 ./store/4z754a0vzl98asv0pa95i5d9szw5jqbs-lowdown-1.0.2-lib ./store/606cmwh52whpb9gw5xhq6233xgslndf5-libsodium-1.0.18 ./store/6b5d814pvq7wg2q8kq9v1m0n8h3afms3-curl-8.4.0 ./store/6hzcqnshb20588d33443jysym9mq67cy-s2n-tls-1.3.56 ./store/6payx2da66dbjl6vg15csxfb5hpf3df4-bash-5.2-p15 ./store/71d6hngrqdl5zvn768fjlhmakmfi5c2w-aws-sdk-cpp-1.11.118 ./store/7vxw7qds845m1nj5h1dkqnwygwn4pay2-aws-c-compression-0.2.17 ./store/7wd6v9cy1npassx19kqlcjgssniaf17v-aws-crt-cpp-0.20.3 ./store/80dld61hbpvy1ay1sdwaqyy4jzhm48xx-libunistring-1.1 ./store/8kg6s2b0ny3y0dh2xldh3sfxndg0qyhv-libgit2-20231018162940 ./store/adc0g3rq9gqvncmvp4p14hiiq4yp4inf-nghttp2-1.57.0-lib ./store/afdz855n59kp1i9xgb46idl80dvkzyzz-aws-c-io-0.13.29 ./store/bi914s08adc383fjixyzv9bqdi7xnjqq-brotli-1.1.0-lib ./store/bv7nrhmyqm5nckhbnra8imsbx6366jph-zstd-1.5.5 ./store/d3b9dhl5mn3prvn3mwlswi1656gc6lzi-aws-c-http-0.7.11 ./store/d5na8ciwbcp66gyj86m8g9vhapyd83yn-aws-c-common-0.8.23 ./store/dqzq96malpilvqg3hxc3xbzg5b8fynba-keyutils-1.6.3-lib ./store/f7rzsb0hmxivzvpz0j5lzviivgd2vpdk-aws-c-auth-0.7.0 ./store/fhws3x2s9j5932r6ah660nsh41bkrq27-xgcc-12.3.0-libgcc ./store/gdi8s6gljfdkxls0bxizjmljjms5lj18-bzip2-1.0.8 ./store/gfwlbxn1c5wqvbxqdr6sb39cmr9c7fri-libssh2-1.11.0 ./store/gnymvi8xmh2i7a4g2bslxxmjfl2vz7q0-gcc-12.3.0-libgcc ./store/ip2011mmp2g5c9h5flp22hzq6rmkm6iq-aws-c-s3-0.3.13 ./store/kgz2giwrwj7mdb3axf90zm884k3rcdwp-libseccomp-2.5.4-lib ./store/khsjrm79w1gxb52cy014p8rkp3869ipa-openssl-3.0.13 ./store/kxp3cd8x66vg4qz8mqgk8ac3zbqrm72y-libarchive-3.7.2-lib ./store/lc4ahmdiph9nzbp0lnmdhrvgllannhd2-aws-c-cal-0.6.0 ./store/myrbnrgp827n19m21xsvzb02ydlpcj6l-busybox-static-x86_64-unknown-linux-musl-1.36.1 ./store/n4whs68fysb708w8fxg1yd1x07q1qfs7-sqlite-3.43.2 ./store/ncr54xh14bz72zrb2cwy4fac2kq4kc5w-libkrb5-1.20.2 ./store/p4z9db6m7nkpc7bddp7w130yr506s0sd-editline-1.17.1 ./store/palgfnlg0b4csfpm90b6vp7xkc9qh5pw-aws-c-event-stream-0.3.1 ./store/q21mvp212rm88mmiycrqigq93pirlsa8-aws-c-mqtt-0.8.14 ./store/qbn51k6v4v9vawyzdmn8xk4b8q0ssp88-xz-5.4.4 ./store/qmn396qsswazb8gqwjg1nj1jc226q8j4-nix-2.21.1 ./store/vxmwq1pixb7dfmnv7d3q6q74bd2lrp2a-acl-2.3.1 ./store/wqwxmdyadnz2nyk8jxfacwr0yph4bm2m-boehm-gc-8.2.2 ./store/xgzy8655cm1xq92wy74w8hqs3gqga3hy-pcre-8.45 ./store/xmprbk52mlcdsljz66m8yf7cf0xf36n1-glibc-2.38-44 ./store/y62brx7f7hax4zc1gvk97riwsx7v1l7p-attr-2.5.1 ./store/ykh8zgm27qqhfxcq77jlap5ahrplrk54-zlib-1.3 ./store/ywwkiqpmfrfn4s3iblc798xqv6r6z3ld-http-parser-2.9.4 ./store/zi0gs62hqnl3q6kmninbg480656jwlqz-libxml2-2.11.7 /nix/store/

to copy the basic Nix files to the new store at /nix/store

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo chmod -R ugo-w /nix/store/

to make the new store non-writable at /nix/store

  Alright! We have our first nix at /nix/store/qmn396qsswazb8gqwjg1nj1jc226q8j4-nix-2.21.1

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo HOME=/root /nix/store/qmn396qsswazb8gqwjg1nj1jc226q8j4-nix-2.21.1/bin/nix-store --load-db

to load data for the first time in to the Nix Database

  Just finished getting the nix database ready.

~~> Setting up shell profiles: /etc/bashrc /etc/profile.d/nix.sh /etc/zshrc /etc/bash.bashrc /etc/zsh/zshrc

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo touch /etc/bashrc

to create a stub /etc/bashrc which will be updated

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo tee -a /etc/bashrc

extend your /etc/bashrc with nix-daemon settings

Nix

if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' fi

End Nix

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo touch /etc/profile.d/nix.sh

to create a stub /etc/profile.d/nix.sh which will be updated

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo tee -a /etc/profile.d/nix.sh

extend your /etc/profile.d/nix.sh with nix-daemon settings

Nix

if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' fi

End Nix

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo touch /etc/zshrc

to create a stub /etc/zshrc which will be updated

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo tee -a /etc/zshrc

extend your /etc/zshrc with nix-daemon settings

Nix

if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' fi

End Nix

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo cp /etc/bash.bashrc /etc/bash.bashrc.backup-before-nix

to back up your current /etc/bash.bashrc to /etc/bash.bashrc.backup-before-nix

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo tee -a /etc/bash.bashrc

extend your /etc/bash.bashrc with nix-daemon settings

Nix

if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' fi

End Nix

~~> Setting up shell profiles for Fish with conf.d/nix.fish inside /etc/fish /usr/local/etc/fish /opt/homebrew/etc/fish /opt/local/etc/fish

~~> Setting up the default profile

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo HOME=/root /nix/store/qmn396qsswazb8gqwjg1nj1jc226q8j4-nix-2.21.1/bin/nix-env -i /nix/store/qmn396qsswazb8gqwjg1nj1jc226q8j4-nix-2.21.1

to install a bootstrapping Nix in to the default profile

installing 'nix-2.21.1' building '/nix/store/jm9275iviwzms49p7f47bb19974g5wd0-user-environment.drv'...

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo HOME=/root /nix/store/qmn396qsswazb8gqwjg1nj1jc226q8j4-nix-2.21.1/bin/nix-env -i /nix/store/47h1qcdfp2gp7qlzpa41zgmg6drvmrkz-nss-cacert-3.95

to install a bootstrapping SSL certificate just for Nix in to the default profile

installing 'nss-cacert-3.95' building '/nix/store/811k3kdw4q839271f554mh0s9g3wdki2-user-environment.drv'...

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo HOME=/root NIX_SSL_CERT_FILE=/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt /nix/store/qmn396qsswazb8gqwjg1nj1jc226q8j4-nix-2.21.1/bin/nix-channel --update nixpkgs

to update the default channel in the default profile

unpacking 1 channels...

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo install -m 0664 /tmp/tmp.c6IZIDVwtz/nix.conf /etc/nix/nix.conf

to place the default nix daemon configuration (part 2)

~~> Setting up the nix-daemon systemd service

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo ln -sfn /nix/var/nix/profiles/default/lib/tmpfiles.d/nix-daemon.conf /etc/tmpfiles.d/nix-daemon.conf

to create the nix-daemon tmpfiles config

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo systemd-tmpfiles --create --prefix=/nix/var/nix

to run systemd-tmpfiles once to pick that path up

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo systemctl link /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.service

to set up the nix-daemon service

Created symlink /etc/systemd/system/nix-daemon.service → /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.service.

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo systemctl enable /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.socket

to set up the nix-daemon socket service

Created symlink /etc/systemd/system/nix-daemon.socket → /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.socket. Created symlink /etc/systemd/system/sockets.target.wants/nix-daemon.socket → /nix/var/nix/profiles/default/lib/systemd/system/nix-daemon.socket.

---- Configuring proxy for the nix-daemon service ------------------------------

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo mkdir -p /etc/systemd/system/nix-daemon.service.d

create directory for systemd unit override

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo tee /etc/systemd/system/nix-daemon.service.d/override.conf

create systemd unit override

[Service] Environment=HTTP_PROXY=127.0.0.1:8082 Environment=HTTPS_PROXY=127.0.0.1:8082 Environment=FTP_PROXY=127.0.0.1:8082

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo systemctl daemon-reload

to load the systemd unit for nix-daemon

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo systemctl start nix-daemon.socket

to start the nix-daemon.socket

---- sudo execution ------------------------------------------------------------ I am executing:

$ sudo systemctl restart nix-daemon.service

to start the nix-daemon.service

Alright! We're done! Try it! Open a new terminal, and type:

$ nix-shell -p nix-info --run "nix-info -m"

Thank you for using this installer. If you have any feedback or need help, don't hesitate:

You can open an issue at https://github.com/NixOS/nix/issues/new?labels=installer&template=installer.md

Or get in touch with the community: https://nixos.org/community

---- Reminders ----------------------------------------------------------------- [ 1 ] Nix won't work in active shell sessions until you restart them.

- Save the following code in `/etc/nix/nix.conf`:

experimental-features = nix-command flakes build-users-group = nixbld

- Restart terminal
- Install a package that requires building behind proxy (`nerdfonts`):

user@nix-debug:~$ export FTP_PROXY=127.0.0.1:8082 user@nix-debug:~$ export HTTP_PROXY=127.0.0.1:8082 user@nix-debug:~$ export HTTPS_PROXY=127.0.0.1:8082 user@nix-debug:~$ nix profile install nixpkgs#nerdfonts error: builder for '/nix/store/vznf9nf4myfq2wx01crg7a4r1lqcfspj-0xProto.tar.xz.drv' failed with exit code 1; last 14 log lines:

error checking the existence of https://tarballs.nixos.org/sha256/0vprpl49708c6hl99bc590gk26clzqvsc512kgg5377hl4jr1nyn: curl: (6) Could not resolve host: tarballs.nixos.org

trying https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.0/0xProto.tar.xz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com Warning: Problem : timeout. Will retry in 1 seconds. 3 retries left. 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com Warning: Problem : timeout. Will retry in 2 seconds. 2 retries left. 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com Warning: Problem : timeout. Will retry in 4 seconds. 1 retries left. 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com error: cannot download 0xProto.tar.xz from any mirror For full logs, run 'nix-store -l /nix/store/vznf9nf4myfq2wx01crg7a4r1lqcfspj-0xProto.tar.xz.drv'. error: 1 dependencies of derivation '/nix/store/yxxhnwf1bkbvh3xhnvssyfybhyn5a5s0-nerdfonts-3.2.0.drv' failed to build user@nix-debug:~$ user@nix-debug:~$ user@nix-debug:~$ user@nix-debug:~$ user@nix-debug:~$ nix-store -l /nix/store/vznf9nf4myfq2wx01crg7a4r1lqcfspj-0xProto.tar.xz.drv error checking the existence of https://tarballs.nixos.org/sha256/0vprpl49708c6hl99bc590gk26clzqvsc512kgg5377hl4jr1nyn: curl: (6) Could not resolve host: tarballs.nixos.org

trying https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.0/0xProto.tar.xz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed ^M 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com Warning: Problem : timeout. Will retry in 1 seconds. 3 retries left. ^M 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com Warning: Problem : timeout. Will retry in 2 seconds. 2 retries left. ^M 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com Warning: Problem : timeout. Will retry in 4 seconds. 1 retries left. ^M 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: github.com error: cannot download 0xProto.tar.xz from any mirror user@nix-debug:~$

- Result: `nix` can't connect to the internet the get the required source for a build
- Check if we can connect to the internet:

user@nix-debug:~$ nix profile install nixpkgs#hello user@nix-debug:~$ hello Hello, world! user@nix-debug:~$ which hello /home/user/.nix-profile/bin/hello user@nix-debug:~$ curl -L 'https://tarballs.nixos.org/sha256/0vprpl49708c6hl99bc590gk26clzqvsc512kgg5377hl4jr1nyn' > tarball % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 3 100 3 0 0 3 0 0:00:01 --:--:-- 0:00:01 3 user@nix-debug:~$ cat tarball 404user@nix-debug:~$ curl -LO https://github.com/ryanoasis/nerd-fonts/releases/download/v3.2.0/0xProto.tar.xz.xz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 1681k 100 1681k 0 0 616k 0 0:00:02 0:00:02 --:--:-- 2268k user@nix-debug:~$ tar --list -f 0xProto.tar.xz 0xProtoNerdFont-Regular.ttf 0xProtoNerdFontMono-Regular.ttf 0xProtoNerdFontPropo-Regular.ttf LICENSE README.md user@nix-debug:~$

- Result: `nix` can connect to the internet to install basic packages. `curl` can also access the internet.
- Check the environment override for `nix-daemon`:

user@nix-debug:~$ cat /etc/systemd/system/nix-daemon.service.d/override.conf [Service] Environment=HTTP_PROXY=127.0.0.1:8082 Environment=HTTPS_PROXY=127.0.0.1:8082 Environment=FTP_PROXY=127.0.0.1:8082 user@nix-debug:~$



**Expected behavior**

`nix` should check for proxy environment variables when it downloads sources

**Priorities**

Add :+1: to [issues you find important](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).
ramboman commented 6 months ago

Here is what I did afterward:

nixos-discourse commented 6 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-fails-to-install-packages-that-require-building-from-behind-a-proxy/43681/1

thufschmitt commented 6 months ago

It looks like Nixpkgs's fetchers only honors the lower case version of these variables: https://github.com/NixOS/nixpkgs/blob/cc5b30542b0202032f2ad5792cfa3955446fdfdf/lib/fetchers.nix#L10

Can you try with these in the systemd override to confirm?

ramboman commented 6 months ago

Yes, if I replace the uppercase proxy variables in the systemd override.conf with their lowercase counterpart, fetchurl works again.

Here is what I did next:

Different sections of the code honor different set of proxy variables.

thufschmitt commented 6 months ago

That's true. Feel free to send a patch to unify all that (also in https://github.com/NixOS/nixpkgs/blob/cc5b30542b0202032f2ad5792cfa3955446fdfdf/lib/fetchers.nix#L10 as linked above as it is the one causing you troubles)

Ericson2314 commented 6 months ago

I just don't know anything much about these variables. E.g. are there usually upper case and lower case pairs? That seems odd to me

ramboman commented 6 months ago

From my understanding, nix uses cURL and its library to perform downloads. cURL relies on these variables to perform downloads through a proxy. According to the cURL manual, in the Environment section, both lowercase and uppercase proxy variables are supported (except for http).

Regarding environment variables in general, they seems to be defined in uppercase:

$ env
<most if not all variables in uppercase>