mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Merge pull request #3588 from prusnak/nix-skip-channel-add
Introduce NIX_INSTALLER_NO_CHANNEL_ADD which skips nix-channel --add
This commit is contained in:
commit
ecd4e52a58
1 changed files with 45 additions and 30 deletions
|
@ -40,30 +40,43 @@ elif [ "$(uname -s)" = "Linux" ] && [ -e /run/systemd/system ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
INSTALL_MODE=no-daemon
|
INSTALL_MODE=no-daemon
|
||||||
# Trivially handle the --daemon / --no-daemon options
|
|
||||||
if [ "x${1:-}" = "x--no-daemon" ]; then
|
|
||||||
INSTALL_MODE=no-daemon
|
|
||||||
elif [ "x${1:-}" = "x--daemon" ]; then
|
|
||||||
INSTALL_MODE=daemon
|
|
||||||
elif [ "x${1:-}" != "x" ]; then
|
|
||||||
(
|
|
||||||
echo "Nix Installer [--daemon|--no-daemon]"
|
|
||||||
|
|
||||||
echo "Choose installation method."
|
# handle the command line flags
|
||||||
echo ""
|
while [ "x${1:-}" != "x" ]; do
|
||||||
echo " --daemon: Installs and configures a background daemon that manages the store,"
|
if [ "x${1:-}" = "x--no-daemon" ]; then
|
||||||
echo " providing multi-user support and better isolation for local builds."
|
INSTALL_MODE=no-daemon
|
||||||
echo " Both for security and reproducibility, this method is recommended if"
|
elif [ "x${1:-}" = "x--daemon" ]; then
|
||||||
echo " supported on your platform."
|
INSTALL_MODE=daemon
|
||||||
echo " See https://nixos.org/nix/manual/#sect-multi-user-installation"
|
elif [ "x${1:-}" = "x--no-channel-add" ]; then
|
||||||
echo ""
|
NIX_INSTALLER_NO_CHANNEL_ADD=1
|
||||||
echo " --no-daemon: Simple, single-user installation that does not require root and is"
|
elif [ "x${1:-}" = "x--no-modify-profile" ]; then
|
||||||
echo " trivial to uninstall."
|
NIX_INSTALLER_NO_MODIFY_PROFILE=1
|
||||||
echo " (default)"
|
elif [ "x${1:-}" != "x" ]; then
|
||||||
echo ""
|
(
|
||||||
) >&2
|
echo "Nix Installer [--daemon|--no-daemon] [--no-channel-add] [--no-modify-profile]"
|
||||||
exit
|
|
||||||
fi
|
echo "Choose installation method."
|
||||||
|
echo ""
|
||||||
|
echo " --daemon: Installs and configures a background daemon that manages the store,"
|
||||||
|
echo " providing multi-user support and better isolation for local builds."
|
||||||
|
echo " Both for security and reproducibility, this method is recommended if"
|
||||||
|
echo " supported on your platform."
|
||||||
|
echo " See https://nixos.org/nix/manual/#sect-multi-user-installation"
|
||||||
|
echo ""
|
||||||
|
echo " --no-daemon: Simple, single-user installation that does not require root and is"
|
||||||
|
echo " trivial to uninstall."
|
||||||
|
echo " (default)"
|
||||||
|
echo ""
|
||||||
|
echo " --no-channel-add: Don't add any channels. nixpkgs-unstable is installed by default."
|
||||||
|
echo ""
|
||||||
|
echo " --no-modify-profile: Skip channel installation. When not provided nixpkgs-unstable"
|
||||||
|
echo " is installed by default."
|
||||||
|
echo ""
|
||||||
|
) >&2
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
if [ "$INSTALL_MODE" = "daemon" ]; then
|
if [ "$INSTALL_MODE" = "daemon" ]; then
|
||||||
printf '\e[1;31mSwitching to the Daemon-based Installer\e[0m\n'
|
printf '\e[1;31mSwitching to the Daemon-based Installer\e[0m\n'
|
||||||
|
@ -130,13 +143,15 @@ if [ -z "$NIX_SSL_CERT_FILE" ] || ! [ -f "$NIX_SSL_CERT_FILE" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Subscribe the user to the Nixpkgs channel and fetch it.
|
# Subscribe the user to the Nixpkgs channel and fetch it.
|
||||||
if ! $nix/bin/nix-channel --list | grep -q "^nixpkgs "; then
|
if [ -z "$NIX_INSTALLER_NO_CHANNEL_ADD" ]; then
|
||||||
$nix/bin/nix-channel --add https://nixos.org/channels/nixpkgs-unstable
|
if ! $nix/bin/nix-channel --list | grep -q "^nixpkgs "; then
|
||||||
fi
|
$nix/bin/nix-channel --add https://nixos.org/channels/nixpkgs-unstable
|
||||||
if [ -z "$_NIX_INSTALLER_TEST" ]; then
|
fi
|
||||||
if ! $nix/bin/nix-channel --update nixpkgs; then
|
if [ -z "$_NIX_INSTALLER_TEST" ]; then
|
||||||
echo "Fetching the nixpkgs channel failed. (Are you offline?)"
|
if ! $nix/bin/nix-channel --update nixpkgs; then
|
||||||
echo "To try again later, run \"nix-channel --update nixpkgs\"."
|
echo "Fetching the nixpkgs channel failed. (Are you offline?)"
|
||||||
|
echo "To try again later, run \"nix-channel --update nixpkgs\"."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue