Recreated nix files

This commit is contained in:
2026-03-03 17:39:32 +01:00
parent 0576ac0c14
commit 4e79105d7b
4 changed files with 298 additions and 407 deletions
+298 -339
View File
File diff suppressed because it is too large Load Diff
-36
View File
@@ -700,10 +700,6 @@ We also add a devshell that makes editing this repository easier in emacs.
name = machine;
value = lib.nixosSystem {
modules = [
# Start_script.nix
({ lib, config, pkgs, ... }: {
imports = [ ./start_script.nix ];
})
# Hyprland configuratie
hyprland.nixosModules.default
({ config, pkgs, inputs, ... }: {
@@ -916,38 +912,6 @@ This section describes the main system configuration for the computers that I ha
}
#+end_src
** start_script.nix.nix
#+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
# Get the home directory of the user who ran 'nixos-rebuild switch' (usually root, so use SUDO_USER)
USER_HOME=$(getent passwd "$SUDO_USER" | cut -d: -f6)
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
{
system.activationScripts.startScript = lib.mkIf (builtins.pathExists ./assets/scripts/start_script.sh) {
text = ''
${script}/bin/startScript
'';
};
}
#+end_src
** end_script.nix.nix
#+begin_src nix :tangle end_script.nix :noweb tangle :mkdirp yes
{ lib, config, pkgs, ... }:
-4
View File
@@ -44,10 +44,6 @@
name = machine;
value = lib.nixosSystem {
modules = [
# Start_script.nix
({ lib, config, pkgs, ... }: {
imports = [ ./start_script.nix ];
})
# Hyprland configuratie
hyprland.nixosModules.default
({ config, pkgs, inputs, ... }: {
-28
View File
@@ -1,28 +0,0 @@
{ 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
# Get the home directory of the user who ran 'nixos-rebuild switch' (usually root, so use SUDO_USER)
USER_HOME=$(getent passwd "$SUDO_USER" | cut -d: -f6)
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
{
system.activationScripts.startScript = lib.mkIf (builtins.pathExists ./assets/scripts/start_script.sh) {
text = ''
${script}/bin/startScript
'';
};
}