Skip to content

Instantly share code, notes, and snippets.

@kuznero
Last active June 21, 2023 22:34
Show Gist options
  • Save kuznero/dfacede512d5cbec42b6150ba1208063 to your computer and use it in GitHub Desktop.
Save kuznero/dfacede512d5cbec42b6150ba1208063 to your computer and use it in GitHub Desktop.
Installing NixOS behind corporate proxy

In order to install NixOS behind corporate proxy do the usual stuff but before running nixos-install set this environment variable:

export CURL_NIX_FLAGS="-x http://user:password@proxy:port/"

In addition in case you have ties to cloning from GitHub (like vim plugins), you should export proxy related variables:

export HTTP_PROXY=http://user:password@proxy:port/
export HTTPS_PROXY=http://user:password@proxy:port/
export http_proxy=http://user:password@proxy:port/
export https_proxy=http://user:password@proxy:port/

After having stack setup --nix run, consider adding following into your ~/.stack/config.yaml file:

nix:

  # false by default. Must be present and set to `true` to enable Nix.
  # You can set set it in your `$HOME/.stack/config.yaml` to enable
  # Nix for all your projects without having to repeat it
  enable: true

  # true by default. Tells Nix whether to run in a pure shell or not.
  #pure: true

  # Empty by default. The list of packages you want to be
  # available in the nix-shell at build time (with `stack
  # build`) and run time (with `stack exec`).
  packages: [zlib]

  # Unset by default. You cannot set this option if `packages:`
  # is already present and not empty.
  #shell-file: shell.nix

  # A list of strings, empty by default. Additional options that
  # will be passed verbatim to the `nix-shell` command.
  #nix-shell-options: []

  # A list of strings, empty by default, such as
  # `[nixpkgs=/my/local/nixpkgs/clone]` that will be used to override
  # NIX_PATH.
  #path: []

  # false by default. Whether to add your nix dependencies as nix garbage
  # collection roots. This way, calling nix-collect-garbage will not remove
  # those packages from the nix store, saving you some time when running
  # stack build again with nix support activated.
  # This creates a `nix-gc-symlinks` directory in the project `.stack-work`.
  # To revert that, just delete this `nix-gc-symlinks` directory.
  #add-gc-roots: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment