PortValhalla/lib/modules/windows.nix

77 lines
2 KiB
Nix

{ lib, config, options, ... }:
let
inherit (lib)
mkOption
mkEnableOption
mkIf
types
;
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, ... }: {
options = {
setupUser = mkOption {
type = types.str;
description = "The name of the user for setting up Windows.";
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 = {
enable = mkEnableOption "dual boot";
linuxPercentage = mkOption {
type = types.number;
description = "The percentage of the disk size reserved for Linux.";
};
};
showFileExt = mkOption {
type = types.bool;
description = "A value indicating whether file extensions should be displayed in Windows Explorer.";
default = true;
};
legacyIconSpacing = mkEnableOption "legacy icon spacing" // {
default = true;
};
dynamicLighting = mkEnableOption "dynamic lighting";
adware = mkEnableOption "adware"; # Fuck you for displaying ads on an OS I fricking paid for!
};
config = {
dualboot.linuxPercentage = mkIf (!config.dualboot.enable) 0;
};
});
in {
options = {
valhalla = {
windows = mkOption {
type = winType;
description = "The options for setting up Windows.";
default = {};
};
};
};
}