diff --git a/henrovnix_ok/README.html b/henrovnix_ok/README.html index c27adb51e..fd8dd66d4 100644 --- a/henrovnix_ok/README.html +++ b/henrovnix_ok/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + @@ -201,153 +201,153 @@

Table of Contents

-
-

1. Introduction

+
+

1. Introduction

Screenshot

@@ -399,8 +399,8 @@ Customization is designed to occur primarily through modular .conf files, allowi Before proceeding with installation, it is strongly recommended to read this documentation carefully. Understanding the structure and design philosophy will help ensure a smooth setup and provide the necessary context for extending the system effectively.

-
-

1.1. What do you get?

+
+

1.1. What do you get?

This repository delivers a reproducible foundation built on NixOS, Home-Manager, and Flakes. It assumes a clean NixOS installation as a starting point, preferably minimal or headless, onto which the configuration is applied. @@ -409,8 +409,8 @@ Core packages are installed as part of the base configuration. Additional softwa

-
-

1.2. What you do not get

+
+

1.2. What you do not get

This repository does not provide a fully polished, bug-free desktop system with every default preconfigured and validated across all hardware combinations. It is a structured foundation, not a turnkey end-user distribution. @@ -422,8 +422,8 @@ In short, this repository provides a coherent and extensible base, not a finishe

-
-

2. What Is a Literate System in the Context of NixOS?

+
+

2. What Is a Literate System in the Context of NixOS?

A literate system combines documentation and implementation into a single, coherent source. @@ -457,8 +457,8 @@ The README is not describing the system. The README is the system.

-
-

2.1. Two Types of Code Blocks

+
+

2.1. Two Types of Code Blocks

This literate system uses two different kinds of source blocks. @@ -470,7 +470,7 @@ These blocks exist purely for documentation purposes. They generate visible code blocks in the exported documentation, but they do not create files. Example:

-
+
 #+begin_src bash :tangle no
 <tekst>
 #+end_src
@@ -486,7 +486,7 @@ They are never tangled into the filesystem.
 These blocks generate real .nix files and insert the same code into the documentation.
 Example:
 

-
+
 ** packages.nix
 <tekst>
 #+begin_src nix :tangle configuration/apps/packages.nix :noweb tangle :mkdirp yes
@@ -514,8 +514,8 @@ This means:
 
 
-
-

2.2. The Two Core Commands

+
+

2.2. The Two Core Commands

There are exactly two commands that matter. @@ -563,8 +563,8 @@ Both come from the same source.

-
-

2.3. Editing Generated Files

+
+

2.3. Editing Generated Files

The directories: @@ -590,8 +590,8 @@ Generated directories are output, not source.

-
-

2.4. Recommended Workflow

+
+

2.4. Recommended Workflow

This workflow allows safe experimentation while preserving literate structure. @@ -632,15 +632,15 @@ If you are confident about your changes, you may skip steps 1–3 and edit READM

-
-

2.5. Folder Structure Explained

+
+

2.5. Folder Structure Explained

The repository separates generated system code from non-generated supporting files.

-
-

2.5.1. ./assets

+
+

2.5.1. ./assets

Contains non-generated assisting files such as: @@ -655,8 +655,8 @@ These files are safe to edit directly.

-
-

2.5.2. ./assets/conf

+
+

2.5.2. ./assets/conf

Contains non-generated assisting configuration files that influence several aspects of builds. @@ -664,8 +664,8 @@ Users are expected to modify these when needed.

-
-

2.5.3. ./configuration

+
+

2.5.3. ./configuration

Fully (re)generated by README.org. @@ -684,8 +684,8 @@ This directory is output.

-
-

2.5.4. ./hardware

+
+

2.5.4. ./hardware

Contains non-generated hardware.nix files detailing hardware-specific details. @@ -693,8 +693,8 @@ This directory will likely be deprecated in the future.

-
-

2.5.5. ./home

+
+

2.5.5. ./home

Fully (re)generated by README.org. @@ -710,8 +710,8 @@ Contains:

-
-

2.5.6. ./machines

+
+

2.5.6. ./machines

Contains one folder per machine you want to configure. @@ -729,8 +729,8 @@ These determine how shared modules apply to each system.

-
-

2.6. Final Principle

+
+

2.6. Final Principle

A literate NixOS system guarantees: @@ -749,8 +749,8 @@ You are maintaining a structured narrative that builds an operating system.

-
-

2.7. Base packages

+
+

2.7. Base packages

The baseline package set is defined explicitly within the repository to ensure reproducibility: @@ -824,8 +824,8 @@ The baseline package set is defined explicitly within the repository to ensure r

-
-

2.8. Additional packages

+
+

2.8. Additional packages

Additional software can be installed by extending the dedicated configuration files that define system and Flatpak packages: @@ -866,12 +866,12 @@ This separation maintains clarity between system-level packages and user-facing

-
-

3. Setting up your system manually

+
+

3. Setting up your system manually

-
-

3.1. Pre-requisites to build this setup

+
+

3.1. Pre-requisites to build this setup

- a NIXOS system installed with a user with sudo rights.
@@ -881,8 +881,8 @@ This separation maintains clarity between system-level packages and user-facing
 
-
-

3.2. Setup when Emacs not (yet) available

+
+

3.2. Setup when Emacs not (yet) available

  1. Copy the folder henrovnixok to your machine
  2. @@ -951,8 +951,8 @@ Run the build command to set up the system for the first time
-
-

4. Testing and generating builds

+
+

4. Testing and generating builds

At this stage, you should have a functional and reproducible system that can be edited, rebuilt, and extended according to your needs. The foundational structure is now in place, and further customization can occur incrementally through the modular configuration files. @@ -1015,46 +1015,46 @@ Other important files:

-
-

5. flake.lock for pinning input versions.

+
+

5. flake.lock for pinning input versions.

-
-

6. assets/* for non-Nix-managed artifacts such as images and wallpapers.

+
+

6. assets/* for non-Nix-managed artifacts such as images and wallpapers.

Generated outputs should not be edited directly. A CI workflow can tangle and commit generated outputs when they differ.

-
-

6.1. Emacs + Org + Tangle

+
+

6.1. Emacs + Org + Tangle

-
-

7. [Emacs](https://www.gnu.org/software/emacs/][Emacs) is used as the editor and execution environment for this literate configuration.

+
+

7. [Emacs](https://www.gnu.org/software/emacs/][Emacs) is used as the editor and execution environment for this literate configuration.

-
-

8. [Org](https://orgmode.org/][Org) mode provides the document structure and the source block execution model used here.

+
+

8. [Org](https://orgmode.org/][Org) mode provides the document structure and the source block execution model used here.

-
-

9. Tangling exports source blocks from this Org document into the corresponding configuration files.

+
+

9. Tangling exports source blocks from this Org document into the corresponding configuration files.

  • References of the form <<code-id>> are noweb placeholders that are expanded from other blocks during tangling.
-
-

9.1. Nix & NixOS

+
+

9.1. Nix & NixOS

-
-

10. [Nix](https://nix.dev/][Nix) is used to define packages, environments, and configuration as pure expressions.

+
+

10. [Nix](https://nix.dev/][Nix) is used to define packages, environments, and configuration as pure expressions.

-
-

11. [NixOS](https://nixos.org/][NixOS) evaluates Nix expressions into a complete system configuration that can be applied by rebuild operations.

+
+

11. [NixOS](https://nixos.org/][NixOS) evaluates Nix expressions into a complete system configuration that can be applied by rebuild operations.

-
-

11.1. Repository layout and folder conventions

+
+

11.1. Repository layout and folder conventions

<p> @@ -1067,8 +1067,8 @@ Generated outputs should not be edited directly. A CI workflow can tangle and co

-
-

11.2. Shared domain folders

+
+

11.2. Shared domain folders

<ul> @@ -1082,8 +1082,8 @@ Generated outputs should not be edited directly. A CI workflow can tangle and co

-
-

11.3. Full tree (including unchanged parts)

+
+

11.3. Full tree (including unchanged parts)

The tree below shows the full repository layout, with the standardized internal structure applied only inside @@ -1212,8 +1212,8 @@ The tree below shows the full repository layout, with the standardized internal

-
-

11.4. Notes

+
+

11.4. Notes

<ul> @@ -1246,8 +1246,8 @@ This prevents unwanted and surprise updates when rebuilding without changing the

-
-

12. TLDR App List

+
+

12. TLDR App List

@@ -1321,8 +1321,8 @@ This prevents unwanted and surprise updates when rebuilding without changing the
-
-

13. Configuration Variables

+
+

13. Configuration Variables

I have a bunch of constant strings that I would rather put in a file. Thats what user.nix is. @@ -1339,8 +1339,8 @@ The values are imported at the beginning and are available to almost all the fun

-
-

14. Flake Inputs

+
+

14. Flake Inputs

The inputs for my system's configuration are very simple @@ -1382,8 +1382,8 @@ Sometimes pinned to a specific commit because unstable broke something and the f

-
-

15. Flake Output

+
+

15. Flake Output

Now that the inputs are ready, the outputs define what the system will actually look like. I also define the machines that this configuration specifies early on. Finally, I iterate over the machines list and pull files from /.machines/${name} subdirectory. This allows me to have configuration that has machine specific configuration limited to those files while also keeping a modular reusable base. @@ -1391,7 +1391,7 @@ We also add a devshell that makes editing this repository easier in emacs.

-
outputs = inputs@{
+
outputs = inputs@{
 nixpkgs,
 home-manager,
 emacs-overlay,
@@ -1460,7 +1460,7 @@ Overlays are a special nix way to override existing packages within a repository
 

-
({ lib, ... }: {
+
({ lib, ... }: {
 nixpkgs.overlays = [ emacs-overlay.overlays.default ];
 })
 
@@ -1470,7 +1470,7 @@ nixpkgs.overlays = [ emacs-overlay.overlays.default ]; Then the machine specific configuration, in this case, just "traveldroid".

-
./machines/${machine}/configuration.nix
+
./machines/${machine}/configuration.nix
 
@@ -1480,7 +1480,7 @@ This can be initialized and managed on its own but I'd rather use the nixo

-
home-manager.nixosModules.home-manager
+
home-manager.nixosModules.home-manager
 {
 home-manager.useGlobalPkgs = true;
 home-manager.useUserPackages = true;
@@ -1523,8 +1523,8 @@ imports =  [
 
-
-

15.1. Envrc + Direnv

+
+

15.1. Envrc + Direnv

Editing this file will be much nicer if we have the dev environment configured. @@ -1545,14 +1545,14 @@ fi

-
-

16. Machines

+
+

16. Machines

The individual machines subdirectory is configured as follows :-

-
+--machine
+
+--machine
 |  +--configuration.nix
 |  +--home.nix
 |  +--hardware-configuration.nix
@@ -1573,12 +1573,12 @@ This imported object (or function result) is just trivially merged into a common
 We can take a look at that the common hardware options I have for all my machines.
 

-
-

16.0.1. Other Utils

+
+

16.0.1. Other Utils

    -
  1. Updates
    +
  2. Updates

    To update the computer, I just need to update the flake.lock file to have references to the latest repository. This is done with :- @@ -1592,8 +1592,8 @@ To update the computer, I just need to update the flake.lock file t

-
-

17. Hardware

+
+

17. Hardware

I'll let the code comments explain the file here. @@ -1627,8 +1627,8 @@ hardware.enableAllFirmware = true; # enable all firmware regardless of license

-
-

18. Configuration

+
+

18. Configuration

This section describes the main system configuration for the computers that I have. Nix will look for a default.nix file if you give it a path to a folder to import. And default.nix looks as follows :- @@ -1672,8 +1672,8 @@ This section describes the main system configuration for the computers that I ha

-
-

18.1. Apps section

+
+

18.1. Apps section

This section describes a way of installing packages, either through nixpkgs or flatpak. @@ -1681,8 +1681,8 @@ What extra apps to install is decided in the files ./assets/conf/apps/packages.c

-
-

18.2. packages.nix

+
+

18.2. packages.nix

{ config, lib, pkgs, flakeRoot, inputs, ... }:
@@ -1732,8 +1732,8 @@ in
 
-
-

18.3. flatpaks.nix

+
+

18.3. flatpaks.nix

{ config, pkgs, lib, flakeRoot, ... }:
@@ -1841,8 +1841,8 @@ in
 
-
-

18.4. Nix Settings

+
+

18.4. Nix Settings

These are global nix settings that configure the settings for the actual tool. @@ -1889,8 +1889,8 @@ These are global nix settings that configure the settings for the actual tool.

-
-

18.5. Boot

+
+

18.5. Boot

This file has most of the settings the control how the computer boots up. @@ -1929,15 +1929,15 @@ This file has most of the settings the control how the computer boots up.

-
-

19. Login

+
+

19. Login

Here we control what the login screen would look like. In configuration/default.nix you can choose whether to use tuigreet (very minimalistic) or LightDM (nicer, themeable)

-
-

19.1. Tuigreet

+
+

19.1. Tuigreet

Doesn't match the rest of the aesthetic of the system (with hyprland), but I like its simplicity. @@ -1962,8 +1962,8 @@ settings = {

-
-

19.2. LightDM

+
+

19.2. LightDM

{ config, pkgs, lib, ... }:
@@ -2107,8 +2107,8 @@ in
 
-
-

19.3. Terminal (default system)

+
+

19.3. Terminal (default system)

This is the initial system level configuration for the terminal that I use on this machine. Its just zsh. @@ -2127,8 +2127,8 @@ This is the initial system level configuration for the terminal that I use on th

-
-

19.4. Files

+
+

19.4. Files

I use Thunar as the file explorer. Also setup a few plugins for Thunar in this config. @@ -2169,8 +2169,8 @@ Along with that, a few other utilities like zip and enabling services to automou

-
-

19.5. Locale

+
+

19.5. Locale

I live in Netherlands and would like all my locale and timezone settings to match. Except my default locale. @@ -2204,8 +2204,8 @@ LC_TIME = defaultLocale;

-
-

19.6. Networking

+
+

19.6. Networking

Not much to see here. I want networking to be enabled. I want firewall as well. @@ -2236,8 +2236,8 @@ Not much to see here. I want networking to be enabled. I want firewall as well.

-
-

19.7. Hyprland

+
+

19.7. Hyprland

This is a big one because the DE needs so much configuration. This section mostly installs Hyprland. @@ -2302,32 +2302,37 @@ The configuration is done in the home manager section.

-
-

19.8. Setting the config

+
+

19.8. Setting the config

-
systemd.user.services.endScript = lib.mkIf scriptExists {
-  description = "Run end script after Home Manager";
-  wantedBy = [ ]; # Not needed for user services
-  after = [
-    "home-manager-activate.service"
-    "graphical-session.target" # If using a graphical session
-  ];
-  wantedBy = [ "default.target" ]; # This is redundant for user services
-  serviceConfig = {
-    Type = "oneshot";
-    RemainAfterExit = yes;
-    ExecStart = "${scriptPath}";
-  };
-};
+
{ lib, ... }:
 
+let
+  scriptPath = "/path/to/your/script";
+  scriptExists = lib.fileExists scriptPath;
+in
+{
+  systemd.user.services.endScript = lib.mkIf scriptExists {
+    description = "Run end script after Home Manager";
+    after = [
+      "home-manager-activate.service"
+      "graphical-session.target"
+    ];
+    serviceConfig = {
+      Type = "oneshot";
+      RemainAfterExit = yes;
+      ExecStart = "${scriptPath}";
+    };
+  };
+}
 
 
-
-

19.9. Services

+
+

19.9. Services

These are some of the services that I enable at the system level. Explanation in the comments. @@ -2360,8 +2365,8 @@ users.users.${user.username}.extraGroups = [ "docker" ]; # add self to docker us

-
-

19.10. Audio

+
+

19.10. Audio

{ config, pkgs, lib, ... }:
@@ -2438,14 +2443,14 @@ users.users.${user.username}.extraGroups = [ "docker" ]; # add self to docker us
 
-
-

19.11. Fonts

+
+

19.11. Fonts

Nothing much to see here. I love Aporetic, and I use it everywhere.

-
fonts.packages = with pkgs; [
+
fonts.packages = with pkgs; [
 aporetic
 nerd-fonts.iosevka
 ];
@@ -2453,14 +2458,14 @@ nerd-fonts.iosevka
 
-
-

19.12. User Config

+
+

19.12. User Config

This creates the user profile that I login with. Initially created during install.

-
users.users.${user.username} = {
+
users.users.${user.username} = {
 isNormalUser = true;
 description = "henrov";
 extraGroups = [
@@ -2475,8 +2480,8 @@ extraGroups = [
 
-
-

20. Home

+
+

20. Home

I use home-manager to manage my user level dotfiles and configurations. @@ -2484,8 +2489,8 @@ Most of the "theme" of the system is decided here. I also use it to install programs that are okay with being installed at the user level instead of the system.

-
-

20.1. default.nix

+
+

20.1. default.nix

This module will import all necessities. @@ -2523,8 +2528,8 @@ This module will import all necessities.

-
-

20.2. Ollama

+
+

20.2. Ollama

This Home Manager Nix module (ai.nix) installs the Ollama package and configures it by reading a simple key-value configuration file (ollama.conf) for settings like the server host and default model. It sets environment variables (OLLAMAHOST and OLAMADEFAULTMODEL) for easy access in your shell or applications, with fallback defaults if the config file is missing or empty. Optionally, it also defines a user-level systemd service to automatically start the Ollama server on NixOS or systems with Home Manager’s systemd support enabled. @@ -2542,8 +2547,8 @@ This Home Manager Nix module (ai.nix) installs the Ollama package and configures

-
-

20.3. Animated Wallpaper

+
+

20.3. Animated Wallpaper

Sets animated wallpaper ~/nixosconf/wallpaperstuff/videos/myWallpaper.mp4 @@ -2584,8 +2589,8 @@ in

-
-

20.4. Rotating Wallpaper

+
+

20.4. Rotating Wallpaper

rotatingwallpaper.nix installs wpaperd and deploys your wallpaper files from the repo (./assets/conf/desktop/wallpaper/pictures/) into ~/conf/desktop/wallpaper/pictures. It also deploys the default wallpaper configuration from assets/conf/desktop/wallpaper/wallpaper.conf into ~/conf/desktop/wallpaper/wallpaper.conf, which is the file you can edit as a user override. @@ -2618,8 +2623,8 @@ in

-
-

20.5. Waybar

+
+

20.5. Waybar

Mostly styling and enabling modules in the top bar. @@ -2633,8 +2638,8 @@ Mostly styling and enabling modules in the -

20.6. Lock Screen

+
+

20.6. Lock Screen

The lock screen configured using hyprlock. @@ -2650,8 +2655,8 @@ They are configured below.

-
-

20.7. Idle Screen

+
+

20.7. Idle Screen

{ config, lib, pkgs, flakeRoot, ... }:
@@ -2662,8 +2667,8 @@ They are configured below.
 
-
-

20.8. Hyprshell

+
+

20.8. Hyprshell

For nice task-starting and -switching @@ -2695,8 +2700,8 @@ For nice task-starting and -switching

-
-

20.9. Hyprland

+
+

20.9. Hyprland

This configures the desktop environment along with the peripherals. The comments should explain whats happening. @@ -2726,8 +2731,8 @@ This configures the desktop environment along with the peripherals. The comments

-
-

20.10. Walker

+
+

20.10. Walker

This is how I launch applications. It is bound to Win+Space in the ./asstes/conf/desktop/hypr/bindings.conf. @@ -2755,8 +2760,8 @@ in

-
-

20.11. Theme

+
+

20.11. Theme

I use the Catppuccin almost everywhere. The nix module integrates almost automatically everywhere (except gtk). @@ -2789,8 +2794,8 @@ catppuccin.cursors.enable = true;

-
-

20.12. Alacritty

+
+

20.12. Alacritty

Alacritty gets installed and configured @@ -2806,8 +2811,8 @@ Alacritty gets installed and configured

-
-

20.13. Dev Tools

+
+

20.13. Dev Tools

All the miscellaneous dev tools on this computer. @@ -2859,8 +2864,8 @@ All the miscellaneous dev tools on this computer.

-
-

20.14. Kitty

+
+

20.14. Kitty

Kitty gets installed and configured @@ -2884,8 +2889,8 @@ Kitty gets installed and configured

-
-

20.15. Shells

+
+

20.15. Shells

The aliases mentioned in ./assets/conf/dev/terminal/aliases.conf will be added to enabled shells @@ -3098,8 +3103,8 @@ EOF

-
-

20.16. Zsh

+
+

20.16. Zsh

Zsh gets installed and configured @@ -3134,8 +3139,8 @@ Zsh gets installed and configured

-
-

20.17. Starship

+
+

20.17. Starship

A nice way to make your prompt usefull @@ -3155,18 +3160,18 @@ A nice way to make your prompt usefull

-
-

20.18. Other Settings

+
+

20.18. Other Settings

Some repeated info from the configuration.

-
-

20.18.1. Home User

+
+

20.18.1. Home User

-
home.username = "${user.username}";
+
home.username = "${user.username}";
 home.homeDirectory = pkgs.lib.mkDefault "/home/${user.username}";
 home.stateVersion = user.stateVersion;
 
@@ -3175,8 +3180,8 @@ home.stateVersion = user.stateVersion;
-
-

21. Emacs

+
+

21. Emacs

I practically live inside emacs. The configuration for it is a mix between init.el and the nix configuration. @@ -3255,8 +3260,8 @@ enable = true;

-
-

21.1. Early EMACS Initialization

+
+

21.1. Early EMACS Initialization

There are some emacs settings that can be configured before the gui shows up. @@ -3361,8 +3366,8 @@ package-archive-priorities '(("gnu" . 99)

-
-

21.2. EMACS Initialization

+
+

21.2. EMACS Initialization

Now starts the main emacs configuration. @@ -3773,22 +3778,22 @@ the top of the file."

-
-

22. Machines

+
+

22. Machines

Only a few more things left. Specifically the machine level extra settings.

-
-

22.1. Traveldroid

+
+

22.1. Traveldroid

The configuration for the laptop does not change much. Most changes are because the hardware is different.

-
-

22.1.1. System Level

+
+

22.1.1. System Level

Anything specific for the laptop. @@ -3805,8 +3810,8 @@ Anything specific for the laptop.

-
-

22.1.2. Hardware

+
+

22.1.2. Hardware

This is the most different. Mostly taken from hardware-configuration.nix setup at first install. @@ -3856,8 +3861,8 @@ hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistr

-
-

22.1.3. Home

+
+

22.1.3. Home

This is mostly about configuring the monitor. And laptop specific utilities. @@ -3884,18 +3889,18 @@ This is mostly about configuring the monitor. And laptop specific utilities.

-
-

23. README Utils

+
+

23. README Utils

-
-

23.0.1. Headers

+
+

23.0.1. Headers

This script adds a DO NOT MODIFY header to all the generated nix files.

-
(progn
+
(progn
 (defun add-tangle-headers ()
 (message "running in %s" (buffer-file-name))
 (when (string= (file-name-extension (buffer-file-name)) "nix")
@@ -3912,7 +3917,7 @@ This script adds a DO NOT MODIFY header to all the generated nix fi
 

Author: henrov

-

Created: 2026-03-04 wo 21:55

+

Created: 2026-03-04 wo 21:56

Validate

diff --git a/henrovnix_ok/README.org b/henrovnix_ok/README.org index 13cd72a38..b1c99cf7f 100755 --- a/henrovnix_ok/README.org +++ b/henrovnix_ok/README.org @@ -1457,21 +1457,26 @@ The configuration is done in the home manager section. ** Setting the config #+begin_src nix :tangle configuration/end_script.nix :noweb tangle :mkdirp yes -systemd.user.services.endScript = lib.mkIf scriptExists { - description = "Run end script after Home Manager"; - wantedBy = [ ]; # Not needed for user services - after = [ - "home-manager-activate.service" - "graphical-session.target" # If using a graphical session - ]; - wantedBy = [ "default.target" ]; # This is redundant for user services - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = yes; - ExecStart = "${scriptPath}"; - }; -}; +{ lib, ... }: +let + scriptPath = "/path/to/your/script"; + scriptExists = lib.fileExists scriptPath; +in +{ + systemd.user.services.endScript = lib.mkIf scriptExists { + description = "Run end script after Home Manager"; + after = [ + "home-manager-activate.service" + "graphical-session.target" + ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = yes; + ExecStart = "${scriptPath}"; + }; + }; +} #+end_src diff --git a/henrovnix_ok/configuration/end_script.nix b/henrovnix_ok/configuration/end_script.nix index 2e51ead24..deff7f415 100644 --- a/henrovnix_ok/configuration/end_script.nix +++ b/henrovnix_ok/configuration/end_script.nix @@ -1,14 +1,20 @@ -systemd.user.services.endScript = lib.mkIf scriptExists { - description = "Run end script after Home Manager"; - wantedBy = [ ]; # Not needed for user services - after = [ - "home-manager-activate.service" - "graphical-session.target" # If using a graphical session - ]; - wantedBy = [ "default.target" ]; # This is redundant for user services - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = yes; - ExecStart = "${scriptPath}"; +{ lib, ... }: + +let + scriptPath = "/path/to/your/script"; + scriptExists = lib.fileExists scriptPath; +in +{ + systemd.user.services.endScript = lib.mkIf scriptExists { + description = "Run end script after Home Manager"; + after = [ + "home-manager-activate.service" + "graphical-session.target" + ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = yes; + ExecStart = "${scriptPath}"; + }; }; -}; +}