mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-06 08:47:00 +00:00
Merge pull request #1303 from emilazy/push-ulxuwyrnkwpq
{activation-scripts,activate-system}: purify environment
This commit is contained in:
commit
5c12a6f4a1
2 changed files with 25 additions and 7 deletions
|
@ -10,7 +10,14 @@
|
||||||
script = ''
|
script = ''
|
||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
export PATH="${pkgs.gnugrep}/bin:${pkgs.coreutils}/bin:@out@/sw/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
export PATH="${pkgs.gnugrep}/bin:${pkgs.coreutils}/bin:@out@/sw/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
||||||
|
export USER=root
|
||||||
|
export LOGNAME=root
|
||||||
|
export HOME=~root
|
||||||
|
export SHELL=$BASH
|
||||||
|
export LANG=C
|
||||||
|
export LC_CTYPE=UTF-8
|
||||||
|
|
||||||
systemConfig=$(cat ${config.system.profile}/systemConfig)
|
systemConfig=$(cat ${config.system.profile}/systemConfig)
|
||||||
|
|
||||||
|
@ -28,7 +35,6 @@
|
||||||
${config.system.activationScripts.keyboard.text}
|
${config.system.activationScripts.keyboard.text}
|
||||||
'';
|
'';
|
||||||
serviceConfig.RunAtLoad = true;
|
serviceConfig.RunAtLoad = true;
|
||||||
serviceConfig.KeepAlive.SuccessfulExit = false;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,19 +37,33 @@ in
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
system.activationScripts.script.text = ''
|
system.activationScripts.script.text = ''
|
||||||
#! ${stdenv.shell}
|
#!/usr/bin/env -i ${stdenv.shell}
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# shellcheck disable=SC2096
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
export PATH="${pkgs.gnugrep}/bin:${pkgs.coreutils}/bin:@out@/sw/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
export PATH="${pkgs.gnugrep}/bin:${pkgs.coreutils}/bin:@out@/sw/bin:/usr/bin:/bin:/usr/sbin:/sbin"
|
||||||
|
export USER=root
|
||||||
|
export LOGNAME=root
|
||||||
|
export HOME=~root
|
||||||
|
export SHELL=$BASH
|
||||||
|
export LANG=C
|
||||||
|
export LC_CTYPE=UTF-8
|
||||||
|
|
||||||
systemConfig=@out@
|
systemConfig=@out@
|
||||||
|
|
||||||
_status=0
|
|
||||||
trap "_status=1" ERR
|
|
||||||
|
|
||||||
# Ensure a consistent umask.
|
# Ensure a consistent umask.
|
||||||
umask 0022
|
umask 0022
|
||||||
|
|
||||||
|
cd /
|
||||||
|
|
||||||
|
if [[ $(id -u) -ne 0 ]]; then
|
||||||
|
printf >&2 '\e[1;31merror: `activate` must be run as root\e[0m\n'
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
${cfg.activationScripts.preActivation.text}
|
${cfg.activationScripts.preActivation.text}
|
||||||
|
|
||||||
# We run `etcChecks` again just in case someone runs `activate`
|
# We run `etcChecks` again just in case someone runs `activate`
|
||||||
|
@ -82,8 +96,6 @@ in
|
||||||
|
|
||||||
# Prevent the current configuration from being garbage-collected.
|
# Prevent the current configuration from being garbage-collected.
|
||||||
ln -sfn /run/current-system /nix/var/nix/gcroots/current-system
|
ln -sfn /run/current-system /nix/var/nix/gcroots/current-system
|
||||||
|
|
||||||
exit $_status
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# FIXME: activationScripts.checks should be system level
|
# FIXME: activationScripts.checks should be system level
|
||||||
|
|
Loading…
Add table
Reference in a new issue