nixos-config/modules/devices.nix

92 lines
2.5 KiB
Nix
Raw Normal View History

2019-08-27 23:41:02 +04:00
{ pkgs, lib, config, ... }:
with lib;
with types; {
options = {
2021-02-07 02:38:11 +03:00
device = mkOption { type = str; };
deviceSpecific = {
devInfo = {
2019-08-27 23:41:02 +04:00
cpu = {
2021-02-07 02:38:11 +03:00
arch = mkOption { type = enum [ "x86_64" "aarch64" ]; };
vendor = mkOption { type = enum [ "amd" "intel" "broadcom" ]; };
clock = mkOption { type = int; };
cores = mkOption { type = int; };
2019-08-27 23:41:02 +04:00
};
drive = {
2021-02-07 02:38:11 +03:00
type = mkOption { type = enum [ "hdd" "ssd" ]; };
speed = mkOption { type = int; };
size = mkOption { type = int; };
2019-08-27 23:41:02 +04:00
};
2021-02-07 02:38:11 +03:00
gpu = {
2021-09-15 18:37:57 +03:00
vendor = mkOption { type = enum [ "amd" "nvidia" "intel" "vm" "other" ]; };
2019-09-13 14:20:04 +04:00
};
2022-10-08 04:32:18 +03:00
fileSystem = mkOption { type = enum [ "btrfs" "zfs" "other" ]; default = "other"; };
2021-02-07 02:38:11 +03:00
ram = mkOption { type = int; };
legacy = mkOption { type = bool; default = false; };
bigScreen = mkOption {
type = bool;
default = true;
2019-09-13 14:20:04 +04:00
};
};
2021-02-07 02:38:11 +03:00
isLaptop = mkOption {
type = bool;
default =
2023-01-26 02:12:00 +03:00
(builtins.match ".*Laptop" config.networking.hostName) != null;
2021-02-07 02:38:11 +03:00
};
isVM = mkOption {
type = bool;
default =
2023-01-26 02:12:00 +03:00
(builtins.match ".*VM" config.networking.hostName) != null;
2021-10-24 23:12:25 +03:00
};
2021-10-25 23:13:24 +03:00
isServer = mkOption {
2021-10-24 23:12:25 +03:00
type = bool;
default =
2023-01-26 02:12:00 +03:00
(builtins.match ".*(Cloud|Server)" config.networking.hostName) != null;
2022-02-11 14:07:03 +03:00
};
isContainer = mkOption {
type = bool;
default =
2023-01-26 02:12:00 +03:00
(builtins.match ".*(CT|Container)" config.networking.hostName) != null;
2021-02-07 02:38:11 +03:00
};
2021-06-16 05:30:04 +03:00
isISO = mkOption {
type = bool;
default =
2023-01-26 02:12:00 +03:00
(builtins.match ".*ISO" config.networking.hostName) != null;
2021-06-16 05:30:04 +03:00
};
2021-09-15 18:37:57 +03:00
isDesktop = mkOption {
type = bool;
default = with config.deviceSpecific; (!isLaptop && !isVM && !isISO);
};
2021-02-07 02:38:11 +03:00
isHost = mkOption {
type = bool;
default = false;
};
isShared = mkOption {
type = bool;
default = false;
};
isGaming = mkOption {
type = bool;
default = false;
};
enableVirtualisation = mkOption {
type = bool;
default = config.deviceSpecific.isHost;
};
isSSD = mkOption {
type = bool;
default = config.deviceSpecific.devInfo.drive.type == "ssd";
2019-08-27 23:41:02 +04:00
};
2023-01-26 00:15:51 +03:00
vpn = {
mullvad.enable = mkOption {
2021-06-16 23:42:44 +03:00
type = bool;
default = false;
};
2023-01-26 00:15:51 +03:00
tailscale.enable = mkOption {
2021-06-16 23:42:44 +03:00
type = bool;
2023-01-26 00:15:51 +03:00
default = false;
2021-06-16 23:42:44 +03:00
};
};
2019-08-27 23:41:02 +04:00
};
};
}