Add a dedicated user option for windows

This commit is contained in:
Manuel Thalmann 2024-08-08 04:45:27 +02:00
parent 995959f958
commit 7d33a7d33f

View file

@ -1,4 +1,4 @@
{ lib, config, ... }:
{ lib, config, options, ... }:
let
inherit (lib)
mkOption
@ -7,7 +7,16 @@
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 (
{ config, ... }: {
@ -15,10 +24,16 @@
setupUser = mkOption {
type = types.str;
description = "The name of the user for setting up Windows.";
default = lib.strings.concatStrings (
[(lib.strings.toUpper (builtins.elemAt setupUser 0))] ++
(lib.lists.drop 1 setupUser)
);
default = capitalize setupUser;
};
users = mkOption {
type = options.valhalla.users.type;
description = "The users to add.";
default = lib.attrsets.concatMapAttrs (
name: options: {
${capitalize name} = options;
}) users;
};
dualboot = {