Add a dedicated user option for windows
This commit is contained in:
parent
995959f958
commit
7d33a7d33f
1 changed files with 21 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, options, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkOption
|
mkOption
|
||||||
|
@ -7,7 +7,16 @@
|
||||||
types
|
types
|
||||||
;
|
;
|
||||||
|
|
||||||
setupUser = lib.strings.stringToCharacters config.valhalla.setupUser.name;
|
users = config.valhalla.users;
|
||||||
|
setupUser = config.valhalla.setupUser.name;
|
||||||
|
|
||||||
|
capitalize = text:
|
||||||
|
let
|
||||||
|
chars = lib.strings.stringToCharacters text;
|
||||||
|
in lib.strings.concatStrings (
|
||||||
|
[(lib.strings.toUpper (builtins.elemAt chars 0))] ++
|
||||||
|
(lib.lists.drop 1 chars)
|
||||||
|
);
|
||||||
|
|
||||||
winType = types.submodule (
|
winType = types.submodule (
|
||||||
{ config, ... }: {
|
{ config, ... }: {
|
||||||
|
@ -15,10 +24,16 @@
|
||||||
setupUser = mkOption {
|
setupUser = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "The name of the user for setting up Windows.";
|
description = "The name of the user for setting up Windows.";
|
||||||
default = lib.strings.concatStrings (
|
default = capitalize setupUser;
|
||||||
[(lib.strings.toUpper (builtins.elemAt setupUser 0))] ++
|
};
|
||||||
(lib.lists.drop 1 setupUser)
|
|
||||||
);
|
users = mkOption {
|
||||||
|
type = options.valhalla.users.type;
|
||||||
|
description = "The users to add.";
|
||||||
|
default = lib.attrsets.concatMapAttrs (
|
||||||
|
name: options: {
|
||||||
|
${capitalize name} = options;
|
||||||
|
}) users;
|
||||||
};
|
};
|
||||||
|
|
||||||
dualboot = {
|
dualboot = {
|
||||||
|
|
Loading…
Reference in a new issue