24 lines
665 B
Nix
24 lines
665 B
Nix
{ lib, config, pkgs, ... }:
|
|
let
|
|
# Copy your script to the Nix store
|
|
userScript = pkgs.runCommand "start_script.sh" {} ''
|
|
cp ${./assets/scripts/start_script.sh} $out
|
|
chmod +x $out
|
|
'';
|
|
# Create a wrapper script that runs in the user's home directory
|
|
script = pkgs.writeShellScriptBin "startScript" ''
|
|
#!${pkgs.bash}/bin/bash
|
|
set -euo pipefail
|
|
export HOME=$(getent passwd henrov | cut -d: -f6)
|
|
cd "$HOME"
|
|
${userScript}/bin/bash -c "./start_script.sh"
|
|
'';
|
|
in
|
|
{
|
|
system.activationScripts.startScript = lib.mkIf (builtins.pathExists ./assets/scripts/start_script.sh) {
|
|
text = ''
|
|
${script}/bin/startScript
|
|
'';
|
|
};
|
|
}
|