added root option

This commit is contained in:
John Lancaster
2025-07-03 04:24:54 +00:00
parent 0db404fd58
commit 1d0c88a021
3 changed files with 12 additions and 8 deletions

View File

@@ -17,8 +17,8 @@
lib = pkgs.lib; lib = pkgs.lib;
userOptions = config: { userOptions = config: {
openssh.authorizedKeys.keyFiles = [ ./personal_keys ]; openssh.authorizedKeys.keyFiles = lib.optionals config.ssh [ ./personal_keys ];
extraGroups = [ "wheel" ]; extraGroups = lib.optionals config.root [ "wheel" ];
shell = lib.mkIf config.shell pkgs.zsh; shell = lib.mkIf config.shell pkgs.zsh;
}; };
in in
@@ -47,14 +47,13 @@
./nixosModules/scripts.nix ./nixosModules/scripts.nix
inputs.home-manager.nixosModules.default inputs.home-manager.nixosModules.default
]; ];
nix.settings.trusted-users = [ "root" "@wheel" ];
users.users.root = userOptions config;
users.users.${config.user} = { users.users.${config.user} = {
isNormalUser = true; isNormalUser = true;
} // userOptions config; } // userOptions config;
nix.settings.trusted-users = [ "root" "@wheel" ]; users.users.root = lib.mkIf config.root (userOptions config);
security.sudo-rs = { security.sudo-rs = lib.mkIf config.root {
enable = true; enable = true;
execWheelOnly = false; execWheelOnly = false;
wheelNeedsPassword = false; wheelNeedsPassword = false;

View File

@@ -10,7 +10,7 @@
enable = true; enable = true;
enableCompletion = true; enableCompletion = true;
autosuggestion.enable = true; autosuggestion.enable = true;
syntaxHighlighting.enable = true; # syntaxHighlighting.enable = true;
oh-my-zsh = { oh-my-zsh = {
enable = true; enable = true;
theme = "risto"; theme = "risto";

View File

@@ -15,7 +15,6 @@
# release notes. # release notes.
options.stateVersion = lib.mkOption { options.stateVersion = lib.mkOption {
type = lib.types.str; type = lib.types.str;
# default = "25.01";
description = "The state version when the configuration was initially created"; description = "The state version when the configuration was initially created";
}; };
@@ -25,6 +24,12 @@
description = "Profile type for the Home Manager configuration."; description = "Profile type for the Home Manager configuration.";
}; };
options.root = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Whether enable all the root user stuff";
};
options.shell = lib.mkOption { options.shell = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;