-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathdevices.nix
52 lines (52 loc) · 1.53 KB
/
devices.nix
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
47
48
49
50
51
52
{ pkgs, lib, config, ... }:
with lib;
with types; {
options = {
device = mkOption { type = str; };
deviceSpecific = {
isLaptop = mkOption {
type = bool;
default =
!isNull (builtins.match ".*Laptop" config.networking.hostName);
};
isPhone = mkOption {
type = bool;
default = !isNull (builtins.match ".*Phone" config.networking.hostName);
};
devInfo = {
cpu = {
arch = mkOption { type = enum [ "x86_64" "aarch64" ]; };
vendor = mkOption { type = enum [ "amd" "intel" "broadcom" ]; };
clock = mkOption { type = int; };
cores = mkOption { type = int; };
};
drive = {
type = mkOption { type = enum [ "hdd" "ssd" ]; };
speed = mkOption { type = int; };
size = mkOption { type = int; };
};
ram = mkOption { type = int; };
legacy = mkOption { type = bool; default = false; };
bigScreen = mkOption {
type = bool;
default = true;
};
};
# Whether machine is powerful enough for heavy stuff
goodMachine = with config.deviceSpecific;
mkOption {
type = bool;
default = devInfo.cpu.clock * devInfo.cpu.cores >= 4000
&& devInfo.drive.size >= 100 && devInfo.ram >= 8;
};
isHost = mkOption {
type = bool;
default = false;
};
bigScreen = mkOption {
type = bool;
default = config.deviceSpecific.devInfo ? bigScreen;
};
};
};
}