mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-31 04:04:45 +00:00
These can’t be relied upon in a post‐user‐activation world. Technically a breaking change, if anyone has their home directory outside of `/Users` or is using `root` for this, but, well, I did my best and these are legacy defaults anyway.
67 lines
2.2 KiB
Nix
67 lines
2.2 KiB
Nix
{
|
||
lib,
|
||
options,
|
||
config,
|
||
...
|
||
}:
|
||
|
||
{
|
||
options = {
|
||
system.primaryUser = lib.mkOption {
|
||
type = lib.types.nullOr lib.types.str;
|
||
default = null;
|
||
description = ''
|
||
The user used for options that previously applied to the user
|
||
running `darwin-rebuild`.
|
||
|
||
This is a transition mechanism as nix-darwin reorganizes its
|
||
options and will eventually be unnecessary and removed.
|
||
'';
|
||
};
|
||
|
||
system.primaryUserHome = lib.mkOption {
|
||
internal = true;
|
||
type = lib.types.str;
|
||
default =
|
||
config.users.users.${config.system.primaryUser}.home or "/Users/${config.system.primaryUser}";
|
||
};
|
||
|
||
system.requiresPrimaryUser = lib.mkOption {
|
||
internal = true;
|
||
type = lib.types.listOf lib.types.str;
|
||
default = [ ];
|
||
};
|
||
};
|
||
|
||
config = {
|
||
assertions = [
|
||
{
|
||
assertion = config.system.primaryUser == null -> config.system.requiresPrimaryUser == [ ];
|
||
message = ''
|
||
Previously, some nix-darwin options applied to the user running
|
||
`darwin-rebuild`. As part of a long‐term migration to make
|
||
nix-darwin focus on system‐wide activation and support first‐class
|
||
multi‐user setups, all system activation now runs as `root`, and
|
||
these options instead apply to the `system.primaryUser` user.
|
||
|
||
You currently have the following primary‐user‐requiring options set:
|
||
|
||
${lib.concatMapStringsSep "\n" (name: "* `${name}`") (
|
||
lib.sort (name1: name2: name1 < name2) config.system.requiresPrimaryUser
|
||
)}
|
||
|
||
To continue using these options, set `system.primaryUser` to the name
|
||
of the user you have been using to run `darwin-rebuild`. In the long
|
||
run, this setting will be deprecated and removed after all the
|
||
functionality it is relevant for has been adjusted to allow
|
||
specifying the relevant user separately, moved under the
|
||
`users.users.*` namespace, or migrated to Home Manager.
|
||
|
||
If you run into any unexpected issues with the migration, please
|
||
open an issue at <https://github.com/LnL7/nix-darwin/issues/new>
|
||
and include as much information as possible.
|
||
'';
|
||
}
|
||
];
|
||
};
|
||
}
|