modules: users: add systemType and isGraphical options
systemType describes the type of a system, e.g. a laptop, desktop or server. isGraphical takes this to determine whether a system needs programs such as a compositor, graphical applications etc.
This commit is contained in:
parent
64db6a4d5f
commit
8f19e283d8
2 changed files with 45 additions and 12 deletions
|
@ -5,7 +5,10 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) elemAt;
|
inherit (builtins) elemAt;
|
||||||
inherit (lib.options) mkOption mkEnableOption;
|
inherit (lib.options) mkOption mkEnableOption;
|
||||||
inherit (lib.types) enum listOf str nullOr bool package;
|
inherit (lib.types) enum listOf str nullOr bool oneOf;
|
||||||
|
inherit (lib.lists) elem;
|
||||||
|
|
||||||
|
inherit (config.modules.system) systemType;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
# configuration options for nixos activation scripts
|
# configuration options for nixos activation scripts
|
||||||
|
@ -44,7 +47,7 @@ in {
|
||||||
|
|
||||||
users = mkOption {
|
users = mkOption {
|
||||||
type = listOf str;
|
type = listOf str;
|
||||||
default = ["charlie"];
|
default = ["cr"];
|
||||||
description = "A list of users on the system.";
|
description = "A list of users on the system.";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,6 +60,23 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemType = mkOption {
|
||||||
|
type = nullOr (enum ["desktop" "laptop" "server"]);
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
The type of the current system. This is used to determine whether things like graphical
|
||||||
|
environments and power-saving programs should be installed or not.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
isGraphical = mkOption {
|
||||||
|
type = bool;
|
||||||
|
default = elem systemType ["desktop" "laptop"];
|
||||||
|
description = ''
|
||||||
|
Whether the current system is a graphical system.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
yubikeySupport = {
|
yubikeySupport = {
|
||||||
enable = mkEnableOption "yubikey support";
|
enable = mkEnableOption "yubikey support";
|
||||||
deviceType = mkOption {
|
deviceType = mkOption {
|
||||||
|
@ -72,6 +92,7 @@ in {
|
||||||
impermanence = {
|
impermanence = {
|
||||||
enable = mkEnableOption "Enable Impermanence";
|
enable = mkEnableOption "Enable Impermanence";
|
||||||
};
|
};
|
||||||
|
|
||||||
video = {
|
video = {
|
||||||
enable = mkEnableOption "video drivers and programs that require a graphical user interface";
|
enable = mkEnableOption "video drivers and programs that require a graphical user interface";
|
||||||
nvidia = mkEnableOption "Nvidia graphics drivers";
|
nvidia = mkEnableOption "Nvidia graphics drivers";
|
||||||
|
@ -92,15 +113,6 @@ in {
|
||||||
default = [];
|
default = [];
|
||||||
description = "A list of extra drivers to enable for printing";
|
description = "A list of extra drivers to enable for printing";
|
||||||
};
|
};
|
||||||
|
|
||||||
"3d" = {
|
|
||||||
enable = mkEnableOption "3D printing suite";
|
|
||||||
extraPrograms = mkOption {
|
|
||||||
type = listOf package;
|
|
||||||
default = [];
|
|
||||||
description = "A list of extra programs to enable for 3D printing";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) elemAt;
|
inherit (builtins) elemAt;
|
||||||
inherit (lib.options) mkOption;
|
inherit (lib.options) mkOption;
|
||||||
inherit (lib.types) listOf str;
|
inherit (lib.types) listOf str package;
|
||||||
|
|
||||||
inherit (config.meta.mainUser) username;
|
inherit (config.meta.mainUser) username;
|
||||||
in {
|
in {
|
||||||
|
@ -27,6 +27,7 @@ in {
|
||||||
The main user for each system. This is the first element of the list of users by default.
|
The main user for each system. This is the first element of the list of users by default.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
gitSigningKey = mkOption {
|
gitSigningKey = mkOption {
|
||||||
type = str;
|
type = str;
|
||||||
description = ''
|
description = ''
|
||||||
|
@ -36,9 +37,28 @@ in {
|
||||||
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAAWEDj/Yib6Mqs016jx7rtecWpytwfVl28eoHtPYCM9TVLq81VIHJSN37lbkc/JjiXCdIJy2Ta3A3CVV5k3Z37NbgAu23oKA2OcHQNaRTLtqWlcBf9fk9suOkP1A3NzAqzivFpBnZm3ytaXwU8LBJqxOtNqZcFVruO6fZxJtg2uE34mAw==
|
ecdsa-sha2-nistp521 AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1MjEAAACFBAAWEDj/Yib6Mqs016jx7rtecWpytwfVl28eoHtPYCM9TVLq81VIHJSN37lbkc/JjiXCdIJy2Ta3A3CVV5k3Z37NbgAu23oKA2OcHQNaRTLtqWlcBf9fk9suOkP1A3NzAqzivFpBnZm3ytaXwU8LBJqxOtNqZcFVruO6fZxJtg2uE34mAw==
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# TODO: clean this up and move it somewhere else.
|
||||||
|
defaultShell = {
|
||||||
|
name = mkOption {
|
||||||
|
type = str;
|
||||||
|
default = "nushell";
|
||||||
|
description = ''
|
||||||
|
The default shell of a user. This is not the main system shell, but the shell used in terminals.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
package = mkOption {
|
||||||
|
type = package;
|
||||||
|
default = pkgs.nushell;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
config = {
|
config = {
|
||||||
|
programs.zsh = {
|
||||||
|
enable = true;
|
||||||
|
enableBashCompletion = true;
|
||||||
|
};
|
||||||
users = {
|
users = {
|
||||||
mutableUsers = true;
|
mutableUsers = true;
|
||||||
users = {
|
users = {
|
||||||
|
@ -53,6 +73,7 @@ in {
|
||||||
"nix"
|
"nix"
|
||||||
"docker"
|
"docker"
|
||||||
];
|
];
|
||||||
|
# shell = self.packages.${pkgs.stdenv.system}.fish;
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
# hashedPasswordFile = "/etc/passwords/cr";
|
# hashedPasswordFile = "/etc/passwords/cr";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue