Skip to content

Instantly share code, notes, and snippets.

@YellowOnion
Created November 25, 2025 03:40
Show Gist options
  • Select an option

  • Save YellowOnion/19733d55a73a2e9e436b046d0adb0715 to your computer and use it in GitHub Desktop.

Select an option

Save YellowOnion/19733d55a73a2e9e436b046d0adb0715 to your computer and use it in GitHub Desktop.
#!/nix/store/qsydfxm1vq6q9jac2kq3r8kn0xdmsldf-bash-5.3p3/bin/bash
source /nix/store/mhxn5kwnri3z9hdzi3x0980id65p0icn-lib.sh
systemConfig='/nix/store/4apz0fzp0cpyvys2wds8hh7m8cp71x26-nixos-system-Purple-Sunrise-25.11.20251116.50a96ed'
export PATH=/empty
for i in /nix/store/jbz6j4iwnrvki1zl34hwcyj2i0m6l2y1-coreutils-9.8 /nix/store/x1hg09529m2m87r2yf5v51xws1mqcrls-gnugrep-3.12 /nix/store/pgsjyfvzfn83mbixpgcn94mdm7ii5v0q-findutils-4.10.0 /nix/store/3nin821m7blrgdxr3hnh7azsgbgr6asb-getent-glibc-2.40-66 /nix/store/m2xd3g6ckfagyhk8qn67a6kkxvyv7pvf-glibc-2.40-66-bin /nix/store/117zjnjzaw0n22z0xinp17qpbdv3wsra-shadow-4.18.0 /nix/store/8yv0a9iygf45bj3nly8cc314gdhj67w0-util-linux-2.41.2-bin; do
PATH=$PATH:$i/bin:$i/sbin
done
_status=0
trap "_status=1 _localstatus=\$?" ERR
# Ensure a consistent umask.
umask 0022
#### Activation script snippet stdio:
_localstatus=0
if (( _localstatus > 0 )); then
printf "Activation script snippet '%s' failed (%s)\n" "stdio" "$_localstatus"
fi
#### Activation script snippet binsh:
_localstatus=0
# Create the required /bin/sh symlink; otherwise lots of things
# (notably the system() function) won't work.
mkdir -p /bin
chmod 0755 /bin
ln -sfn "/nix/store/cfn5wfckmy8hs13zxy4bj2zlavl5z90w-bash-interactive-5.3p3/bin/sh" /bin/.sh.tmp
mv /bin/.sh.tmp /bin/sh # atomically replace /bin/sh
if (( _localstatus > 0 )); then
printf "Activation script snippet '%s' failed (%s)\n" "binsh" "$_localstatus"
fi
#### Activation script snippet users:
_localstatus=0
install -m 0700 -d /root
install -m 0755 -d /home
/nix/store/0ka5vp1vl568carzd6cp6hpmnxr58zh1-perl-5.40.0-env/bin/perl \
-w /nix/store/7sb1nkpf82nb5kj7qc4bbqkwj1l1mdv9-update-users-groups.pl /nix/store/124lnmrid30x77hgwk4ak0abasc3b1sp-users-groups.json
if (( _localstatus > 0 )); then
printf "Activation script snippet '%s' failed (%s)\n" "users" "$_localstatus"
fi
#### Activation script snippet groups:
_localstatus=0
if (( _localstatus > 0 )); then
printf "Activation script snippet '%s' failed (%s)\n" "groups" "$_localstatus"
fi
#### Activation script snippet specialfs:
_localstatus=0
specialMount() {
local device="$1"
local mountPoint="$2"
local options="$3"
local fsType="$4"
if mountpoint -q "$mountPoint"; then
local options="remount,$options"
else
mkdir -p "$mountPoint"
chmod 0755 "$mountPoint"
fi
mount -t "$fsType" -o "$options" "$device" "$mountPoint"
}
source /nix/store/809bzpn6fk545lcbr3s0pspasknvh4yl-mounts.sh
if (( _localstatus > 0 )); then
printf "Activation script snippet '%s' failed (%s)\n" "specialfs" "$_localstatus"
fi
#### Activation script snippet etc:
_localstatus=0
# Set up the statically computed bits of /etc.
echo "setting up /etc..."
/nix/store/3dk1v7q87c4wlh9cgl58ij49pcggjsf0-perl-5.40.0-env/bin/perl /nix/store/rg5rf512szdxmnj9qal3wfdnpfsx38qi-setup-etc.pl /nix/store/4vganch4mfw9950wwjkwkn19mkxf6n3b-etc/etc
if (( _localstatus > 0 )); then
printf "Activation script snippet '%s' failed (%s)\n" "etc" "$_localstatus"
fi
#### Activation script snippet hashes:
_localstatus=0
users=()
while IFS=: read -r user hash _; do
if [[ "$hash" = "$"* && ! "$hash" =~ ^\$(y|gy|7|2b|2y|2a|6)\$ ]]; then
users+=("$user")
fi
done </etc/shadow
if (( "${#users[@]}" )); then
echo "
WARNING: The following user accounts rely on password hashing algorithms
that have been removed. They need to be renewed as soon as possible, as
they do prevent their users from logging in."
printf ' - %s\n' "${users[@]}"
fi
if (( _localstatus > 0 )); then
printf "Activation script snippet '%s' failed (%s)\n" "hashes" "$_localstatus"
fi
#### Activation script snippet modprobe:
_localstatus=0
# Allow the kernel to find our wrapped modprobe (which searches
# in the right location in the Nix store for kernel modules).
# We need this when the kernel (or some module) auto-loads a
# module.
echo /nix/store/y127cip4q910imb073h1fgm082k9vp14-kmod-31/bin/modprobe > /proc/sys/kernel/modprobe
if (( _localstatus > 0 )); then
printf "Activation script snippet '%s' failed (%s)\n" "modprobe" "$_localstatus"
fi
#### Activation script snippet udevd:
_localstatus=0
# The deprecated hotplug uevent helper is not used anymore
if [ -e /proc/sys/kernel/hotplug ]; then
echo "" > /proc/sys/kernel/hotplug
fi
# Allow the kernel to find our firmware.
if [ -e /sys/module/firmware_class/parameters/path ]; then
echo -n "/nix/store/awv2g6i05csnhmk4fp7jwdy2zbvqn084-firmware/lib/firmware" > /sys/module/firmware_class/parameters/path
fi
if (( _localstatus > 0 )); then
printf "Activation script snippet '%s' failed (%s)\n" "udevd" "$_localstatus"
fi
#### Activation script snippet usrbinenv:
_localstatus=0
mkdir -p /usr/bin
chmod 0755 /usr/bin
ln -sfn /nix/store/jbz6j4iwnrvki1zl34hwcyj2i0m6l2y1-coreutils-9.8/bin/env /usr/bin/.env.tmp
mv /usr/bin/.env.tmp /usr/bin/env # atomically replace /usr/bin/env
if (( _localstatus > 0 )); then
printf "Activation script snippet '%s' failed (%s)\n" "usrbinenv" "$_localstatus"
fi
#### Activation script snippet var:
_localstatus=0
if (( _localstatus > 0 )); then
printf "Activation script snippet '%s' failed (%s)\n" "var" "$_localstatus"
fi
# Make this configuration the current configuration.
# The readlink is there to ensure that when $systemConfig = /system
# (which is a symlink to the store), /run/current-system is still
# used as a garbage collection root.
ln -sfn "$(readlink -f "$systemConfig")" /run/current-system
exit $_status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment