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
|
||||
inherit (builtins) elemAt;
|
||||
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 {
|
||||
imports = [
|
||||
# configuration options for nixos activation scripts
|
||||
|
@ -44,7 +47,7 @@ in {
|
|||
|
||||
users = mkOption {
|
||||
type = listOf str;
|
||||
default = ["charlie"];
|
||||
default = ["cr"];
|
||||
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 = {
|
||||
enable = mkEnableOption "yubikey support";
|
||||
deviceType = mkOption {
|
||||
|
@ -72,6 +92,7 @@ in {
|
|||
impermanence = {
|
||||
enable = mkEnableOption "Enable Impermanence";
|
||||
};
|
||||
|
||||
video = {
|
||||
enable = mkEnableOption "video drivers and programs that require a graphical user interface";
|
||||
nvidia = mkEnableOption "Nvidia graphics drivers";
|
||||
|
@ -92,15 +113,6 @@ in {
|
|||
default = [];
|
||||
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
|
||||
inherit (builtins) elemAt;
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.types) listOf str;
|
||||
inherit (lib.types) listOf str package;
|
||||
|
||||
inherit (config.meta.mainUser) username;
|
||||
in {
|
||||
|
@ -27,6 +27,7 @@ in {
|
|||
The main user for each system. This is the first element of the list of users by default.
|
||||
'';
|
||||
};
|
||||
|
||||
gitSigningKey = mkOption {
|
||||
type = str;
|
||||
description = ''
|
||||
|
@ -36,9 +37,28 @@ in {
|
|||
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 = {
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableBashCompletion = true;
|
||||
};
|
||||
users = {
|
||||
mutableUsers = true;
|
||||
users = {
|
||||
|
@ -53,6 +73,7 @@ in {
|
|||
"nix"
|
||||
"docker"
|
||||
];
|
||||
# shell = self.packages.${pkgs.stdenv.system}.fish;
|
||||
shell = pkgs.zsh;
|
||||
# hashedPasswordFile = "/etc/passwords/cr";
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue