Recreated nix files
This commit is contained in:
+298
-339
File diff suppressed because it is too large
Load Diff
@@ -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, ... }:
|
||||
|
||||
@@ -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, ... }: {
|
||||
|
||||
@@ -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
|
||||
'';
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user