blob: a1f80ef918a28f31cb9eec3ad834039cd268be9c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
{ config, pkgs, lib, ... }:
with builtins // lib;
let
devices = import ../../data/devices.nix;
hardware = mkOption {
type = types.strMatching ''^kobo\d+$'';
};
deviceID = mkOption {
type = types.strMatching ''00000000-0000-0000-0000-000000000\d\d\d'';
};
deviceInfo = types.submodule {
options = {
inherit hardware deviceID;
};
};
in {
options = {
_allDevices = mkOption {
default = devices;
readOnly = true;
internal = true;
type = types.attrsOf deviceInfo;
};
device = {
name = mkOption {
type = types.enum (attrNames devices);
};
affiliate = mkOption {
type = types.enum (import ../../data/affiliates.nix);
default = "kobo";
};
hardware = hardware // {
default = config._allDevices.${config.device.name}.hardware;
};
deviceID = deviceID // {
default = config._allDevices.${config.device.name}.deviceID;
};
};
};
}
|