mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-28 02:37:09 +00:00
add activate-user script
This commit is contained in:
parent
7a6ee11373
commit
6af52615ed
4 changed files with 28 additions and 2 deletions
|
@ -81,7 +81,8 @@
|
|||
esac
|
||||
}
|
||||
|
||||
conf=$HOME/.nixpkgs/darwin-config.nix
|
||||
cfg=$HOME/.nixpkgs/darwin-config.nix
|
||||
darwin=$HOME/.nix-defexpr/darwin
|
||||
pkgs=$HOME/.nix-defexpr/nixpkgs
|
||||
'';
|
||||
|
||||
|
|
|
@ -59,12 +59,30 @@ in
|
|||
# Prevent the current configuration from being garbage-collected.
|
||||
ln -sfn /run/current-system /nix/var/nix/gcroots/current-system
|
||||
|
||||
${cfg.activationScripts.defaults.text}
|
||||
${cfg.activationScripts.etc.text}
|
||||
${cfg.activationScripts.launchd.text}
|
||||
|
||||
exit $_status
|
||||
'';
|
||||
|
||||
system.activationScripts.userScript.text = ''
|
||||
#! ${stdenv.shell}
|
||||
set -e
|
||||
set -o pipefail
|
||||
export PATH=${pkgs.coreutils}/bin:${config.environment.systemPath}:$PATH
|
||||
|
||||
systemConfig=@out@
|
||||
|
||||
_status=0
|
||||
trap "_status=1" ERR
|
||||
|
||||
# Ensure a consistent umask.
|
||||
umask 0022
|
||||
|
||||
${cfg.activationScripts.defaults.text}
|
||||
|
||||
exit $_status
|
||||
'';
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ in
|
|||
preferLocalBuild = true;
|
||||
|
||||
activationScript = cfg.activationScripts.script.text;
|
||||
activationUserScript = cfg.activationScripts.userScript.text;
|
||||
inherit (cfg) nixdarwinLabel;
|
||||
|
||||
buildCommand = ''
|
||||
|
@ -69,6 +70,11 @@ in
|
|||
chmod u+x $out/activate
|
||||
unset activationScript
|
||||
|
||||
echo "$activationUserScript" > $out/activate-user
|
||||
substituteInPlace $out/activate-user --subst-var out
|
||||
chmod u+x $out/activate-user
|
||||
unset activationUserScript
|
||||
|
||||
echo -n "$systemConfig" > $out/systemConfig
|
||||
|
||||
echo -n "$nixdarwinLabel" > $out/nixdarwin-version
|
||||
|
|
|
@ -39,4 +39,5 @@ fi
|
|||
if [ "$action" = switch ]; then
|
||||
sudo nix-env -p @profile@ --set $systemConfig
|
||||
sudo $systemConfig/activate
|
||||
$systemConfig/activate-user
|
||||
fi
|
||||
|
|
Loading…
Add table
Reference in a new issue