-
-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Plan, phase 1 #1341
base: master
Are you sure you want to change the base?
The Plan, phase 1 #1341
Changes from all commits
f960064
985f847
1b9a5d6
f2806c8
687ece6
c5b7672
046cdad
ba8c0be
fa5d426
4c82d2f
a4d08c9
d55f395
c023dc6
7ebf5f7
803e215
0d9daef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,35 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
let | ||
activationPath = | ||
lib.makeBinPath ( | ||
[ | ||
pkgs.gnugrep | ||
pkgs.coreutils | ||
] ++ lib.optionals config.nix.enable [ config.nix.package ] | ||
) | ||
+ lib.optionalString (!config.nix.enable) '' | ||
$( | ||
# If `nix.enable` is off, there might be an unmanaged Nix | ||
# installation (say in `/nix/var/nix/profiles/default`) that | ||
# activation scripts (such as Home Manager) want to find on the | ||
# `$PATH`. Search for it directly to avoid polluting the | ||
# activation script environment with everything on the | ||
# `environment.systemPath`. | ||
if nixEnvPath=$( | ||
PATH="${config.environment.systemPath}" command -v nix-env | ||
); then | ||
printf ':' | ||
${lib.getExe' pkgs.coreutils "dirname"} -- "$( | ||
${lib.getExe' pkgs.coreutils "readlink"} \ | ||
--canonicalize-missing \ | ||
-- "$nixEnvPath" | ||
)" | ||
fi | ||
)'' | ||
+ ":/usr/bin:/bin:/usr/sbin:/sbin"; | ||
in | ||
|
||
{ | ||
imports = [ | ||
(lib.mkRemovedOptionModule [ "services" "activate-system" "enable" ] "The `activate-system` service is now always enabled as it is necessary for a working `nix-darwin` setup.") | ||
|
@@ -10,7 +40,17 @@ | |
script = '' | ||
set -e | ||
set -o pipefail | ||
export PATH="${pkgs.gnugrep}/bin:${pkgs.coreutils}/bin:@out@/sw/bin:/usr/bin:/bin:/usr/sbin:/sbin" | ||
|
||
PATH="${activationPath}" | ||
|
||
export PATH | ||
export USER=root | ||
export LOGNAME=root | ||
export HOME=~root | ||
export MAIL=/var/mail/root | ||
export SHELL=$BASH | ||
export LANG=C | ||
export LC_CTYPE=UTF-8 | ||
|
||
systemConfig=$(cat ${config.system.profile}/systemConfig) | ||
|
||
|
@@ -25,7 +65,7 @@ | |
ln -sfn /run/current-system /nix/var/nix/gcroots/current-system | ||
fi | ||
|
||
${config.system.activationScripts.etcChecks.text} | ||
${config.system.activationScripts.checks.text} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The one thing I am concerned about here is if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The activation daemon only activates system configurations that were previously current. So in theory it should never be trying to delete users and so on. What other checks do you think might be problematic here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, good point. I don't have any problematic checks I can think of, and they should be read-only anyway, so I'm good with this. |
||
${config.system.activationScripts.etc.text} | ||
${config.system.activationScripts.keyboard.text} | ||
''; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate that I can't think of a better way to check that this option wasn't changed from the default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only way I've done it, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it’s awful and I hate it. But I hate not giving good error messages when doing complicated migrations even more.