From c683809a786fd01a3d1386736b8d3eead9edb949 Mon Sep 17 00:00:00 2001 From: Jan-Bulthuis Date: Mon, 9 Jun 2025 12:50:30 +0200 Subject: [PATCH] Added initial homeConfiguration for domain users --- modules/nixos/domain.nix | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/modules/nixos/domain.nix b/modules/nixos/domain.nix index e11d484..d91525d 100644 --- a/modules/nixos/domain.nix +++ b/modules/nixos/domain.nix @@ -127,9 +127,32 @@ in # Set up home directory security.pam.services.login.makeHomeDir = true; security.pam.services.sshd.makeHomeDir = true; - environment.loginShellInit = '' - echo "TEST" - groups - ''; + environment.loginShellInit = + let + homeConfiguration = inputs.home-manager.lib.homeManagerConfiguration { + inherit pkgs; + modules = [ + ( + { ... }: + { + home.stateVersion = "24.11"; + home.username = "$USER"; + home.homeDirectory = "/.$HOME"; + home.packages = with pkgs; [ + tree + cowsay + ]; + } + ) + ] ++ config.home-manager.sharedModules; + }; + in + '' + # Activate Home Manager configuration for domain users + if id | egrep -o 'groups=.*' | sed 's/,/\n/g' | cut -d'(' -f2 | sed 's/)//' | egrep -o "^domain users$"; then + echo "Setting up environment for domain user" + ${homeConfiguration.activationPackage}/activate + fi + ''; }; }