chore: make namespace generic so people can copy easier

This commit is contained in:
Christoph Hollizeck 2024-10-11 00:17:03 +02:00
parent 88593f53a2
commit 7ad43f35c8
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 1763BB530F50279E
45 changed files with 249 additions and 217 deletions

View file

@ -1,8 +1,7 @@
{
lib,
config,
pkgs,
osConfig ? { },
namespace,
...
}:
let
@ -12,23 +11,14 @@ let
mkDefault
mkMerge
;
inherit (lib.wyrdgard) mkOpt;
inherit (lib.${namespace}) mkOpt;
cfg = config.wyrdgard.user;
cfg = config.${namespace}.user;
is-linux = pkgs.stdenv.isLinux;
is-darwin = pkgs.stdenv.isDarwin;
home-directory =
if cfg.name == null then
null
else if is-darwin then
"/Users/${cfg.name}"
else
"/home/${cfg.name}";
home-directory = if cfg.name == null then null else "/home/${cfg.name}";
in
{
options.wyrdgard.user = {
options.${namespace}.user = {
enable = mkOpt types.bool true "Whether to configure the user account.";
name = mkOpt (types.nullOr types.str) (config.snowfallorg.user.name or "cholli"
) "The user account.";
@ -44,11 +34,11 @@ in
assertions = [
{
assertion = cfg.name != null;
message = "wyrdgard.user.name must be set";
message = "${namespace}.user.name must be set";
}
{
assertion = cfg.home != null;
message = "wyrdgard.user.home must be set";
message = "${namespace}.user.home must be set";
}
];