From 1d0c88a0216b6a7e9cf89306e0ee679ad93ce115 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Thu, 3 Jul 2025 04:24:54 +0000 Subject: [PATCH] added root option --- flake.nix | 11 +++++------ homeManagerModules/shell.nix | 2 +- nixosModules/options.nix | 7 ++++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/flake.nix b/flake.nix index 5fec4ae..0dced5a 100644 --- a/flake.nix +++ b/flake.nix @@ -17,8 +17,8 @@ lib = pkgs.lib; userOptions = config: { - openssh.authorizedKeys.keyFiles = [ ./personal_keys ]; - extraGroups = [ "wheel" ]; + openssh.authorizedKeys.keyFiles = lib.optionals config.ssh [ ./personal_keys ]; + extraGroups = lib.optionals config.root [ "wheel" ]; shell = lib.mkIf config.shell pkgs.zsh; }; in @@ -47,14 +47,13 @@ ./nixosModules/scripts.nix inputs.home-manager.nixosModules.default ]; - - users.users.root = userOptions config; + nix.settings.trusted-users = [ "root" "@wheel" ]; users.users.${config.user} = { isNormalUser = true; } // userOptions config; - nix.settings.trusted-users = [ "root" "@wheel" ]; - security.sudo-rs = { + users.users.root = lib.mkIf config.root (userOptions config); + security.sudo-rs = lib.mkIf config.root { enable = true; execWheelOnly = false; wheelNeedsPassword = false; diff --git a/homeManagerModules/shell.nix b/homeManagerModules/shell.nix index b611abf..0fe3591 100644 --- a/homeManagerModules/shell.nix +++ b/homeManagerModules/shell.nix @@ -10,7 +10,7 @@ enable = true; enableCompletion = true; autosuggestion.enable = true; - syntaxHighlighting.enable = true; + # syntaxHighlighting.enable = true; oh-my-zsh = { enable = true; theme = "risto"; diff --git a/nixosModules/options.nix b/nixosModules/options.nix index 62b31b0..63dfb4b 100644 --- a/nixosModules/options.nix +++ b/nixosModules/options.nix @@ -15,7 +15,6 @@ # release notes. options.stateVersion = lib.mkOption { type = lib.types.str; - # default = "25.01"; description = "The state version when the configuration was initially created"; }; @@ -25,6 +24,12 @@ 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 { type = lib.types.bool; default = true;