mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-08-11 14:24:38 -05:00
feat: simplified themes module
This commit is contained in:
parent
b0fdd1d958
commit
a5ec879db0
119 changed files with 2045 additions and 4624 deletions
|
@ -1,4 +1,5 @@
|
|||
{lib, ...}: let
|
||||
{ lib, ... }:
|
||||
let
|
||||
stringType = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
|
@ -17,27 +18,29 @@
|
|||
|
||||
numOptions = 20;
|
||||
|
||||
genOptions = config: prefix:
|
||||
genOptions =
|
||||
config: prefix:
|
||||
builtins.listToAttrs (
|
||||
map
|
||||
(i: {
|
||||
map (i: {
|
||||
name = "${prefix}${toString i}";
|
||||
value = config;
|
||||
})
|
||||
(builtins.genList (i: i) numOptions)
|
||||
}) (builtins.genList (i: i) numOptions)
|
||||
);
|
||||
|
||||
mkOptionsFromDir = path:
|
||||
builtins.listToAttrs (map
|
||||
(name: {
|
||||
name = builtins.substring 0 (builtins.stringLength name - 4) name;
|
||||
value = stringType;
|
||||
})
|
||||
(
|
||||
builtins.filter
|
||||
(name: builtins.match ".*\\.nix$" name != null)
|
||||
(builtins.attrNames (builtins.readDir path))
|
||||
));
|
||||
mkOptionsFromDir =
|
||||
path:
|
||||
builtins.listToAttrs (
|
||||
map
|
||||
(name: {
|
||||
name = builtins.substring 0 (builtins.stringLength name - 4) name;
|
||||
value = stringType;
|
||||
})
|
||||
(
|
||||
builtins.filter (name: builtins.match ".*\\.nix$" name != null) (
|
||||
builtins.attrNames (builtins.readDir path)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
userSubmodule = lib.types.submodule {
|
||||
options = {
|
||||
|
@ -71,13 +74,14 @@
|
|||
};
|
||||
|
||||
deviceSubmodule = lib.types.submodule {
|
||||
options = let
|
||||
mountConfig = {
|
||||
mount = stringType;
|
||||
device = stringType;
|
||||
options = listType;
|
||||
};
|
||||
in
|
||||
options =
|
||||
let
|
||||
mountConfig = {
|
||||
mount = stringType;
|
||||
device = stringType;
|
||||
options = listType;
|
||||
};
|
||||
in
|
||||
{
|
||||
boot = mountConfig;
|
||||
ip = genOptions stringType "address";
|
||||
|
@ -93,37 +97,48 @@
|
|||
themesSubmodule = lib.types.submodule {
|
||||
options = {
|
||||
currentTheme = stringType;
|
||||
elements = attrList;
|
||||
font = stringType;
|
||||
schemes = lib.mkOption {
|
||||
type = lib.types.attrsOf (lib.types.submodule {
|
||||
options = {
|
||||
colours = attrList;
|
||||
font = stringType;
|
||||
};
|
||||
});
|
||||
font = {
|
||||
name = stringType;
|
||||
size = {
|
||||
applications = stringType;
|
||||
desktop = stringType;
|
||||
popups = stringType;
|
||||
terminal = stringType;
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
palettes = lib.mkOption {
|
||||
type = lib.types.attrsOf (
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
colours = attrList;
|
||||
font = stringType;
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
in
|
||||
{
|
||||
options = {
|
||||
services = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
options =
|
||||
mkOptionsFromDir ./instances/config
|
||||
// {
|
||||
instances = lib.mkOption {
|
||||
type = lib.types.attrsOf instanceSubmodule;
|
||||
};
|
||||
options = mkOptionsFromDir ./instances/config // {
|
||||
instances = lib.mkOption {
|
||||
type = lib.types.attrsOf instanceSubmodule;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
machines = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
options = let
|
||||
devicesPath = ./devices/config;
|
||||
printerPath = devicesPath + /printers;
|
||||
in
|
||||
options =
|
||||
let
|
||||
devicesPath = ./devices/config;
|
||||
printerPath = devicesPath + /printers;
|
||||
in
|
||||
mkOptionsFromDir devicesPath
|
||||
// mkOptionsFromDir printerPath
|
||||
// {
|
||||
|
@ -135,24 +150,20 @@ in {
|
|||
};
|
||||
people = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
options =
|
||||
mkOptionsFromDir ./users/config
|
||||
// {
|
||||
users = lib.mkOption {
|
||||
type = lib.types.attrsOf userSubmodule;
|
||||
};
|
||||
options = mkOptionsFromDir ./users/config // {
|
||||
users = lib.mkOption {
|
||||
type = lib.types.attrsOf userSubmodule;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
aesthetics = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
options =
|
||||
mkOptionsFromDir ./themes
|
||||
// {
|
||||
themes = lib.mkOption {
|
||||
type = themesSubmodule;
|
||||
};
|
||||
options = mkOptionsFromDir ./themes // {
|
||||
themes = lib.mkOption {
|
||||
type = themesSubmodule;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue