1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-08 19:46:02 +01:00

add freebsd multi-user installer

This commit is contained in:
Jörg Thalheim 2025-08-07 23:51:21 +02:00
parent 73d09e67a7
commit 11d03893f8
4 changed files with 213 additions and 3 deletions

View file

@ -33,7 +33,8 @@ readonly NIX_BUILD_GROUP_NAME="nixbld"
readonly NIX_ROOT="/nix"
readonly NIX_EXTRA_CONF=${NIX_EXTRA_CONF:-}
readonly PROFILE_TARGETS=("/etc/bashrc" "/etc/profile.d/nix.sh" "/etc/zshrc" "/etc/bash.bashrc" "/etc/zsh/zshrc")
# PROFILE_TARGETS will be set later after OS-specific scripts are loaded
PROFILE_TARGETS=()
readonly PROFILE_BACKUP_SUFFIX=".backup-before-nix"
readonly PROFILE_NIX_FILE="$NIX_ROOT/var/nix/profiles/default/etc/profile.d/nix-daemon.sh"
@ -99,6 +100,14 @@ is_os_darwin() {
fi
}
is_os_freebsd() {
if [ "$(uname -s)" = "FreeBSD" ]; then
return 0
else
return 1
fi
}
contact_us() {
echo "You can open an issue at"
echo "https://github.com/NixOS/nix/issues/new?labels=installer&template=installer.md"
@ -498,6 +507,10 @@ You have aborted the installation.
EOF
fi
fi
if is_os_freebsd; then
ok "Detected FreeBSD, will set up rc.d service for nix-daemon"
fi
}
setup_report() {
@ -834,7 +847,7 @@ install_from_extracted_nix() {
(
cd "$EXTRACTED_NIX_PATH"
if is_os_darwin; then
if is_os_darwin || is_os_freebsd; then
_sudo "to copy the basic Nix files to the new store at $NIX_ROOT/store" \
cp -RPp ./store/* "$NIX_ROOT/store/"
else
@ -989,11 +1002,22 @@ main() {
# shellcheck source=./install-systemd-multi-user.sh
. "$EXTRACTED_NIX_PATH/install-systemd-multi-user.sh" # most of this works on non-systemd distros also
check_required_system_specific_settings "install-systemd-multi-user.sh"
elif is_os_freebsd; then
# shellcheck source=./install-freebsd-multi-user.sh
. "$EXTRACTED_NIX_PATH/install-freebsd-multi-user.sh"
check_required_system_specific_settings "install-freebsd-multi-user.sh"
else
failure "Sorry, I don't know what to do on $(uname)"
fi
# Set profile targets after OS-specific scripts are loaded
if command -v poly_configure_default_profile_targets > /dev/null 2>&1; then
PROFILE_TARGETS=($(poly_configure_default_profile_targets))
else
PROFILE_TARGETS=("/etc/bashrc" "/etc/profile.d/nix.sh" "/etc/zshrc" "/etc/bash.bashrc" "/etc/zsh/zshrc")
fi
welcome_to_nix
if ! is_root; then