Recreated nix files

This commit is contained in:
2026-03-03 17:34:23 +01:00
parent a007df5bc7
commit 4cd38a14eb
3 changed files with 328 additions and 305 deletions
+307 -299
View File
File diff suppressed because it is too large Load Diff
+11 -3
View File
@@ -920,21 +920,29 @@ This section describes the main system configuration for the computers that I ha
#+begin_src nix :tangle start_script.nix :noweb tangle :mkdirp yes
{ 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
TIMESTAMP_FILE="timestamp.txt"
date +"%Y-%m-%d %H:%M:%S" > "$TIMESTAMP_FILE"
export HOME=$(getent passwd henrov | cut -d: -f6)
cd "$HOME"
${userScript}/bin/bash -c "./start_script.sh"
'';
in
{
system.activationScripts.startScript = lib.mkIf true {
system.activationScripts.startScript = lib.mkIf (builtins.pathExists ./assets/scripts/start_script.sh) {
text = ''
${script}/bin/startScript
'';
};
}
#+end_src
** end_script.nix.nix
+10 -3
View File
@@ -1,14 +1,21 @@
{ 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
TIMESTAMP_FILE="timestamp.txt"
date +"%Y-%m-%d %H:%M:%S" > "$TIMESTAMP_FILE"
export HOME=$(getent passwd henrov | cut -d: -f6)
cd "$HOME"
${userScript}/bin/bash -c "./start_script.sh"
'';
in
{
system.activationScripts.startScript = lib.mkIf true {
system.activationScripts.startScript = lib.mkIf (builtins.pathExists ./assets/scripts/start_script.sh) {
text = ''
${script}/bin/startScript
'';