added docker option

This commit is contained in:
John Lancaster
2025-07-03 23:17:56 -05:00
parent 7b315f9a39
commit 804b1e5723
2 changed files with 17 additions and 6 deletions

View File

@@ -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; };

View File

@@ -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";
};
}