diff --git a/hosts/common/configs/user/console/docker/default.nix b/hosts/common/configs/user/console/docker/default.nix index f86199f..741ee18 100644 --- a/hosts/common/configs/user/console/docker/default.nix +++ b/hosts/common/configs/user/console/docker/default.nix @@ -1,6 +1,7 @@ { user ? throw "user argument is required", home ? throw "home argument is required", + rootless ? true, }: { config, @@ -8,45 +9,49 @@ pkgs, ... }: -{ - virtualisation.docker.rootless = { - enable = true; - setSocketVariable = true; - enableOnBoot = false; - storageDriver = "btrfs"; +lib.mkMerge ( + [ + { + virtualisation.docker.rootless = { + enable = rootless; + setSocketVariable = true; + enableOnBoot = false; + storageDriver = "btrfs"; - daemon.settings = { - experimental = true; - ipv6 = true; - fixed-cidr-v6 = "fd00::/80"; + daemon.settings = { + experimental = true; + ipv6 = true; + fixed-cidr-v6 = "fd00::/80"; + }; + + autoPrune = { + enable = true; + flags = [ "--all" ]; + }; + }; + + home-manager.users.${user}.home = { + packages = with pkgs; [ docker-compose ]; + + sessionVariables = { + DOCKER_CONFIG = "${home}/.config/docker"; + }; + }; + } + ] + ++ (lib.lists.optional rootless { + environment.persistence."/persist"."${home}/.local/share/docker" = { }; + + systemd.user = { + services.docker.after = [ + config.environment.persistence."/persist"."${home}/.local/share/docker".mount + ]; + sockets.docker.after = [ + config.environment.persistence."/persist"."${home}/.local/share/docker".mount + ]; }; - - autoPrune = { - enable = true; - flags = [ "--all" ]; - }; - }; - - home-manager.users.${user}.home = { - packages = with pkgs; [ docker-compose ]; - - sessionVariables = { - DOCKER_CONFIG = "${home}/.config/docker"; - }; - }; -} -// lib.mkIf config.virtualisation.docker.rootless.enable { - environment.persistence."/persist"."${home}/.local/share/docker" = { }; - - systemd.user = { - services.docker.after = [ - config.environment.persistence."/persist"."${home}/.local/share/docker".mount - ]; - sockets.docker.after = [ - config.environment.persistence."/persist"."${home}/.local/share/docker".mount - ]; - }; -} -// lib.mkIf (!config.virtualisation.docker.rootless.enable) { - users.users.${user}.extraGroups = [ "docker" ]; -} + }) + ++ (lib.lists.optional (!rootless) { + users.users.${user}.extraGroups = [ "docker" ]; + }) +) diff --git a/hosts/common/configs/user/console/kubernetes/default.nix b/hosts/common/configs/user/console/kubernetes/default.nix index 69660d1..31554db 100644 --- a/hosts/common/configs/user/console/kubernetes/default.nix +++ b/hosts/common/configs/user/console/kubernetes/default.nix @@ -12,12 +12,16 @@ }) ]; - environment.persistence."/cache"."${home}/.kube/cache" = { }; + environment.persistence = { + "/persist"."${home}/.kube" = { }; + "/cache"."${home}/.kube/cache" = { }; + }; home-manager.users.${user} = { home.packages = with pkgs; [ kubectl kubernetes-helm + kustomize kind ]; diff --git a/hosts/common/configs/user/console/zsh/default.nix b/hosts/common/configs/user/console/zsh/default.nix index 0cbe471..c3a11a9 100644 --- a/hosts/common/configs/user/console/zsh/default.nix +++ b/hosts/common/configs/user/console/zsh/default.nix @@ -4,10 +4,7 @@ }: { config, pkgs, ... }: { - environment = { - sessionVariables.ZDOTDIR = "$HOME/.config/zsh"; - persistence."/persist"."${home}/.local/share/zsh" = { }; - }; + environment.persistence."/persist"."${home}/.local/share/zsh" = { }; home-manager.users.${user} = { imports = [ ./options.nix ]; @@ -36,6 +33,9 @@ ''; }; - home.file.".zshenv".enable = false; + home = { + file.".zshenv".enable = false; + sessionVariables.ZDOTDIR = "${home}/.config/zsh"; + }; }; } diff --git a/hosts/elara/users/nikara/configs/console/docker/default.nix b/hosts/elara/users/nikara/configs/console/docker/default.nix index ff9dbb9..e20e881 100644 --- a/hosts/elara/users/nikara/configs/console/docker/default.nix +++ b/hosts/elara/users/nikara/configs/console/docker/default.nix @@ -4,9 +4,7 @@ }: { lib, ... }: { - virtualisation.docker.rootless.enable = lib.mkForce false; - - sops.secrets = { + home-manager.users.${user}.sops.secrets = { "docker" = { sopsFile = ../../../../../../../secrets/sas/secrets.yaml; path = "${home}/.config/docker/config.json"; diff --git a/hosts/elara/users/nikara/configs/console/kubernetes/default.nix b/hosts/elara/users/nikara/configs/console/kubernetes/default.nix index eabf562..8cd3609 100644 --- a/hosts/elara/users/nikara/configs/console/kubernetes/default.nix +++ b/hosts/elara/users/nikara/configs/console/kubernetes/default.nix @@ -14,30 +14,8 @@ }) ]; - environment.persistence."/persist"."${home}/.kube" = { }; - - home-manager.users.${user} = { - home.packages = with pkgs; [ - telepresence - kubeval - kustomize - ]; - - sops.secrets = { - "kubeconfig/d90270" = { - sopsFile = ../../../../../../../secrets/sas/secrets.yaml; - path = "${home}/.kube/d90270"; - }; - - "kubeconfig/d90271" = { - sopsFile = ../../../../../../../secrets/sas/secrets.yaml; - path = "${home}/.kube/d90271"; - }; - - "kubeconfig/d90272" = { - sopsFile = ../../../../../../../secrets/sas/secrets.yaml; - path = "${home}/.kube/d90272"; - }; - }; - }; + home-manager.users.${user}.home.packages = with pkgs; [ + telepresence + kubeval + ]; } diff --git a/hosts/elara/users/nikara/default.nix b/hosts/elara/users/nikara/default.nix index 79ea709..37c9bdd 100644 --- a/hosts/elara/users/nikara/default.nix +++ b/hosts/elara/users/nikara/default.nix @@ -11,7 +11,10 @@ in (import ../../../common/configs/user/console/bashmount { inherit user home; }) (import ../../../common/configs/user/console/brightnessctl { inherit user home; }) (import ../../../common/configs/user/console/btop { inherit user home; }) - (import ../../../common/configs/user/console/docker { inherit user home; }) + (import ../../../common/configs/user/console/docker { + inherit user home; + rootless = false; + }) (import ../../../common/configs/user/console/fastfetch { inherit user home; }) (import ../../../common/configs/user/console/git { inherit user home; }) (import ../../../common/configs/user/console/gpg-agent { inherit user home; })