feat(nixos): Add marleyos.my module
This commit is contained in:
parent
e65fde6ead
commit
404f4a9294
2 changed files with 62 additions and 3 deletions
|
@ -1,10 +1,21 @@
|
||||||
{config, ...}: {
|
_: let
|
||||||
|
my = {
|
||||||
|
name = "marley";
|
||||||
|
username = "punkfairie";
|
||||||
|
fullName = "Marley Rae";
|
||||||
|
email = "marley@punkfairie.net";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
marleyos.my = {
|
||||||
|
inherit (my) name username fullName email;
|
||||||
|
};
|
||||||
|
|
||||||
users = {
|
users = {
|
||||||
mutableUsers = false;
|
mutableUsers = false;
|
||||||
|
|
||||||
users.users."${config.marleyos.my.name}" = {
|
users.users."${my.name}" = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
description = config.marleyos.my.fullName;
|
description = my.fullName;
|
||||||
extraGroups = ["networkmanager" "wheel"];
|
extraGroups = ["networkmanager" "wheel"];
|
||||||
hashedPassword = "$y$j9T$ztWf9WeUCENC2T12qS4mi1$51ihV/5cQ8mdJJrNe7MMguk4hPB61S5xHawsfi.1hL3";
|
hashedPassword = "$y$j9T$ztWf9WeUCENC2T12qS4mi1$51ihV/5cQ8mdJJrNe7MMguk4hPB61S5xHawsfi.1hL3";
|
||||||
};
|
};
|
||||||
|
|
48
modules/nixos/options/my/default.nix
Normal file
48
modules/nixos/options/my/default.nix
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
inherit
|
||||||
|
(lib)
|
||||||
|
mkOption
|
||||||
|
types
|
||||||
|
;
|
||||||
|
in {
|
||||||
|
options.marleyos.my = rec {
|
||||||
|
name = mkOption {
|
||||||
|
type = with types; str;
|
||||||
|
default = config.snowfallorg.user.name or "marley";
|
||||||
|
description = "Your username, for use as your login name.";
|
||||||
|
};
|
||||||
|
|
||||||
|
username = mkOption {
|
||||||
|
type = with types; str;
|
||||||
|
default = name;
|
||||||
|
description = "Your username, for external profiles.";
|
||||||
|
};
|
||||||
|
|
||||||
|
fullName = mkOption {
|
||||||
|
type = with types; str;
|
||||||
|
default = name;
|
||||||
|
description = "Your full name, for display purposes.";
|
||||||
|
};
|
||||||
|
|
||||||
|
email = mkOption {
|
||||||
|
type = with types; nullOr str;
|
||||||
|
default = null;
|
||||||
|
description = "Your email";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = let
|
||||||
|
cfg = config.marleyos.my;
|
||||||
|
in {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = cfg.name != null;
|
||||||
|
message = "marleyos.my.name must be set.";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue