1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-31 04:04:45 +00:00
nix-darwin/modules/system/primary-user.nix
Emily 424ac85232 {environment,nix}: remove references to $HOME
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.
2025-03-23 11:55:36 +00:00

67 lines
2.2 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
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 longterm migration to make
nix-darwin focus on systemwide activation and support firstclass
multiuser setups, all system activation now runs as `root`, and
these options instead apply to the `system.primaryUser` user.
You currently have the following primaryuserrequiring 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.
'';
}
];
};
}