diff --git a/flake.nix b/flake.nix index ee627a6..30898ea 100644 --- a/flake.nix +++ b/flake.nix @@ -16,9 +16,9 @@ pkgs = nixpkgs.legacyPackages.${system}; lib = pkgs.lib; + # These will get applied to both the configured user and the root user (if enabled) userOptions = config: { openssh.authorizedKeys.keyFiles = lib.optionals config.ssh [ ./personal_keys ]; - extraGroups = lib.optionals config.root [ "wheel" ]; shell = lib.mkIf config.enableShell pkgs.zsh; }; @@ -65,11 +65,10 @@ users.users.${config.user} = { isNormalUser = true; description = "John Lancaster"; - extraGroups = [ - "networkmanager" - "wheel" - "docker" - ]; + extraGroups = [] + ++ lib.optionals config.root [ "wheel" ] + ++ lib.optionals config.docker [ "docker" ] + ++ lib.optionals config.services.networkmanager.enable [ "networkmanager" ]; } // userOptions config; users.users.root = lib.mkIf config.root (userOptions config); @@ -82,6 +81,12 @@ programs.zsh.enable = lib.mkIf config.enableShell true; + virtualisation.docker = lib.mkIf config.docker { + enable = true; + enableOnBoot = true; + package = pkgs.docker; + }; + home-manager = { useUserPackages = true; extraSpecialArgs = { inherit inputs; }; diff --git a/nixosModules/options.nix b/nixosModules/options.nix index 16dd617..f20932d 100644 --- a/nixosModules/options.nix +++ b/nixosModules/options.nix @@ -53,4 +53,10 @@ default = []; description = "Additional Home Manager modules to import"; }; + + options.docker = lib.mkOption { + type = lib.types.bool; + default = false; + description = "Whether to enable docker stuff"; + }; }