Skip to content

Commit e90b670

Browse files
authored
Merge pull request #51 from damidoug/feat/host-type
hosts: add laptop type and isPC bool
2 parents adc16c9 + 66d2408 commit e90b670

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

docs/src/extensions/all-extensions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ This section describes all official Denix extensions.
9090
| Name | Default Value | Description |
9191
| - | - | - |
9292
| `enable` | `true` | Whether to create an enum option `type` in the host submodule |
93-
| `generateIsType` | `true` | Whether to generate a boolean option for each value in `hosts.type.types`, formatted as `"is{Type}"` |
94-
| `types` | `["desktop" "server"]` | All allowed values for the `type` option in the host submodule. Note: to append to the list rather than overwrite it, use: `types = prev.types ++ ["newType"];` |
93+
| `generateIsType` | `true` | Whether to generate a boolean option for each value in `hosts.type.types`, formatted as `"is{Type}"`. Also creates `"isPC"`, with a value of `isDesktop \|\| isLaptop` |
94+
| `types` | `["desktop" "laptop" "server"]` | All allowed values for the `type` option in the host submodule. Note: to append to the list rather than overwrite it, use: `types = prev.types ++ ["newType"];` |
9595

9696
`hosts.features`
9797
| Name | Default Value | Description |

docs/src/ru/extensions/all-extensions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@
9090
| Название | Значение по умолчанию | Описание |
9191
| - | - | - |
9292
| `enable` | `true` | Создавать ли enum-опцию `type` в подмодуле хоста |
93-
| `generateIsType` | `true` | Генерировать ли булевую опцию для каждого `hosts.type.types` в следующем формате: `"is{Type}"` |
94-
| `types` | `["desktop" "server"]` | Все допустимые значения для опции `type` в подмодуле хоста. Заметьте, если вы хотите добавить новый элемент в список, а не полностью перезаписать его, то это делается так: `types = prev.types ++ ["newType"];` |
93+
| `generateIsType` | `true` | Генерировать ли булевую опцию для каждого `hosts.type.types` в следующем формате: `"is{Type}"`. Также создает `"isPC"` со значением `isDesktop \|\| isLaptop` |
94+
| `types` | `["desktop" "latop" "server"]` | Все допустимые значения для опции `type` в подмодуле хоста. Заметьте, если вы хотите добавить новый элемент в список, а не полностью перезаписать его, то это делается так: `types = prev.types ++ ["newType"];` |
9595

9696
`hosts.features`
9797
| Название | Значение по умолчанию | Описание |

lib/extensions/base/hosts.nix

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ delib.extension {
1616
generateIsType = true;
1717
types = [
1818
"desktop"
19+
"laptop"
1920
"server"
2021
];
2122
};
@@ -54,7 +55,15 @@ delib.extension {
5455
type = noDefault (enumOption types null);
5556
}
5657
// lib.optionalAttrs generateIsType (
57-
builtins.listToAttrs (
58+
{
59+
isPC = boolOption (
60+
lib.any (t: t == config.type) [
61+
"desktop"
62+
"laptop"
63+
]
64+
);
65+
}
66+
// builtins.listToAttrs (
5867
map (type: {
5968
name =
6069
let

0 commit comments

Comments
 (0)