Recreated nix files

This commit is contained in:
2026-03-03 17:37:01 +01:00
parent 4cd38a14eb
commit 0576ac0c14
3 changed files with 320 additions and 309 deletions
+304 -301
View File
File diff suppressed because it is too large Load Diff
+8 -5
View File
@@ -929,9 +929,14 @@ let
script = pkgs.writeShellScriptBin "startScript" '' script = pkgs.writeShellScriptBin "startScript" ''
#!${pkgs.bash}/bin/bash #!${pkgs.bash}/bin/bash
set -euo pipefail set -euo pipefail
export HOME=$(getent passwd henrov | cut -d: -f6) # Get the home directory of the user who ran 'nixos-rebuild switch' (usually root, so use SUDO_USER)
cd "$HOME" USER_HOME=$(getent passwd "$SUDO_USER" | cut -d: -f6)
${userScript}/bin/bash -c "./start_script.sh" if [ -z "$USER_HOME" ]; then
# Fallback: use the first user in /home
USER_HOME=$(ls -d /home/* | head -n 1)
fi
cd "$USER_HOME"
${userScript}
''; '';
in in
{ {
@@ -941,8 +946,6 @@ in
''; '';
}; };
} }
#+end_src #+end_src
** end_script.nix.nix ** end_script.nix.nix
+8 -3
View File
@@ -9,9 +9,14 @@ let
script = pkgs.writeShellScriptBin "startScript" '' script = pkgs.writeShellScriptBin "startScript" ''
#!${pkgs.bash}/bin/bash #!${pkgs.bash}/bin/bash
set -euo pipefail set -euo pipefail
export HOME=$(getent passwd henrov | cut -d: -f6) # Get the home directory of the user who ran 'nixos-rebuild switch' (usually root, so use SUDO_USER)
cd "$HOME" USER_HOME=$(getent passwd "$SUDO_USER" | cut -d: -f6)
${userScript}/bin/bash -c "./start_script.sh" if [ -z "$USER_HOME" ]; then
# Fallback: use the first user in /home
USER_HOME=$(ls -d /home/* | head -n 1)
fi
cd "$USER_HOME"
${userScript}
''; '';
in in
{ {