From ba20d4d53478460470d7ee4ce85006de59f06b1b Mon Sep 17 00:00:00 2001 From: "info@data-pro.nu" Date: Tue, 14 Apr 2026 19:25:31 +0200 Subject: [PATCH] Regenerated --- Droidnix/README.html | 791 ++++++++++-------- Droidnix/README.org | 89 +- .../modules/traveldroid/apps/zsh.nix | 81 +- .../modules/traveldroid/system/aliases.nix | 51 ++ 4 files changed, 612 insertions(+), 400 deletions(-) create mode 100644 Droidnix/generated/parked/modules/traveldroid/system/aliases.nix diff --git a/Droidnix/README.html b/Droidnix/README.html index c71b85e55..26b68f967 100644 --- a/Droidnix/README.html +++ b/Droidnix/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Droidnix: A Dendritic NixOS + Home Manager Configuration NixOS Configuration Structure @@ -204,133 +204,133 @@

Table of Contents

-
-

Shortcuts

-
+
+

Shortcuts

+

Introduction The Assets Folder @@ -346,25 +346,25 @@

Introduction   intro

-
-

What is Droidnix

-
+
+

What is Droidnix

+

Droidnix is a modular, declarative NixOS + Home Manager configuration system. with configurations managed via Emacs Org and Nix Flakes. The project is designed for reproducibility, maintainability, and cross-machine compatibility.

-
-

Installed components:

-
+
+

Installed components:

+
    -
  • Core
  • -
  • Hyprland
  • +
  • Core
  • +
  • Hyprland
-
-

Goals, project Structure, import hierarchy

-
+
+

Goals, project Structure, import hierarchy

+

This project uses a modular NixOS configuration with Hyprland support, designed for literate programming and cross-device reusability. The Droidnix repository is organized into two main parts: @@ -377,9 +377,9 @@ The Droidnix repository is organized into two main parts:

-
-

Root Level

-
+
+

Root Level

+
  • flake.nix is the entry point and imports:
      @@ -390,16 +390,16 @@ The Droidnix repository is organized into two main parts:
-
-

Generated Structure

-
+
+

Generated Structure

+

The generated/ directory contains all generated configurations, divided into three main groups: system, hyprland, and mangowc.

-
-

First Setup

-
+
+

First Setup

+
  1. Clone this repository.
  2. Run the setup script: ./setup_droid.
  3. @@ -420,9 +420,9 @@ The generated/ directory contains all generated configurations, div The .assets/ folder contains all static files, such as configs, scripts, and themes. These files are not generated and can be edited directly.

-
-

generated/assets/2_b_installed.conf

-
+
+

generated/assets/2_b_installed.conf

+

This is a list of additional apps to install

@@ -496,9 +496,9 @@ com.todoist.Todoist
-
-

generated/assets/aliases.conf

-
+
+

generated/assets/aliases.conf

+

This is a list of additional apps to install

@@ -554,9 +554,9 @@ keys=hyprctl binds This section contains the Org blocks for tangling Nix code into the generated folders.

-
-

generated/flake.nix

-
+
+

generated/flake.nix

+

The Nix flake definition for Droidnix.

@@ -630,9 +630,9 @@ The Nix flake definition for Droidnix.
-
-

generated/modules/traveldroid/system/colors.nix

-
+
+

generated/modules/traveldroid/system/colors.nix

+

Setting the colors for Droidnix.

@@ -716,9 +716,9 @@ in
-
-

generated/hosts/traveldroid/boot.nix

-
+
+

generated/hosts/traveldroid/boot.nix

+
{ config, pkgs, lib, flakeRoot, ... }:
 
@@ -764,9 +764,9 @@ in
 
-
-

generated/hosts/traveldroid/hardware-configuration.nix

-
+
+

generated/hosts/traveldroid/hardware-configuration.nix

+
  1. Boot into NixOS Live ISO or your installed system.
  2. Open a terminal.
  3. @@ -824,9 +824,9 @@ in
-
-

generated/hosts/traveldroid/host.nix

-
+
+

generated/hosts/traveldroid/host.nix

+
{ lib, config, pkgs, flakeRoot, import-tree, home-manager, ... }:
 
@@ -885,13 +885,13 @@ in
 
-
-

generated/traveldroid/modules/apps

-
+
+

generated/traveldroid/modules/apps

+
-
-

generated/modules/traveldroid/apps/2_b_installed.nix

-
+
+

generated/modules/traveldroid/apps/2_b_installed.nix

+

This installs a list of apps

@@ -999,9 +999,9 @@ in {
-
-

generated/modules/traveldroid/apps/emacs/emacs.nix

-
+
+

generated/modules/traveldroid/apps/emacs/emacs.nix

+

This installs emacs

@@ -1097,9 +1097,9 @@ in
-
-

generated/modules/traveldroid/apps/flameshot.nix

-
+
+

generated/modules/traveldroid/apps/flameshot.nix

+

This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

@@ -1138,9 +1138,9 @@ in
-
-

generated/modules/traveldroid/apps/kitty.nix

-
+
+

generated/modules/traveldroid/apps/kitty.nix

+

This file sets up Kitty terminal

@@ -1198,9 +1198,9 @@ in
-
-

generated/modules/traveldroid/apps/starship.nix

-
+
+

generated/modules/traveldroid/apps/starship.nix

+

This file sets up starship prompt

@@ -1239,9 +1239,9 @@ in
-
-

generated/modules/traveldroid/apps/thunar.nix

-
+
+

generated/modules/traveldroid/apps/thunar.nix

+

This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

@@ -1282,9 +1282,9 @@ in
-
-

generated/modules/traveldroid/apps/wofi.nix

-
+
+

generated/modules/traveldroid/apps/wofi.nix

+

This is the install for Wofi, the launcher

@@ -1317,9 +1317,9 @@ in
-
-

generated/modules/traveldroid/apps/zenbrowser.nix

-
+
+

generated/modules/traveldroid/apps/zenbrowser.nix

+

This installs zen browser

@@ -1339,22 +1339,61 @@ in
-
-

generated/modules/traveldroid/apps/zsh.nix

-
+
+

generated/modules/traveldroid/apps/zsh.nix

+

This sets up the zsh in the terminal

-
# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
-{ lib, config, pkgs, flakeRoot, ... }:
+
{ lib, config, pkgs, flakeRoot, ... }:
+
 let
+  #################################
+  # User config
+  #################################
   username = config.defaultUser or "henrov";
   generatedZsh = "${flakeRoot}/generated/.config/zsh/.zshrc";
+
+  #################################
+  # Alias parsing
+  #################################
+  aliasFile = "${flakeRoot}/generated/assets/aliases.conf";
+  content = builtins.readFile aliasFile;
+
+  lines =
+    lib.filter (l: l != "")
+      (map (l:
+        let
+          noComment = builtins.head (lib.splitString "#" l);
+        in lib.trim noComment
+      ) (lib.splitString "\n" content));
+
+  parseLine = line:
+    let
+      parts = lib.splitString "=" line;
+    in
+      if lib.length parts < 2 then null else {
+        name = lib.trim (lib.head parts);
+        value = lib.trim (lib.concatStringsSep "=" (lib.tail parts));
+      };
+
+  parsed =
+    lib.filter (x: x != null)
+      (map parseLine lines);
+
+  functions =
+    lib.concatStringsSep "\n"
+      (map (x: ''
+        ${x.name}() {
+          ${x.value} "$@"
+        }
+      '') parsed);
+
 in
 {
   #################################
-  # Install Zsh, Oh My Zsh, Starship and syntax highlighting system-wide
+  # Packages
   #################################
   environment.systemPackages = with pkgs; [
     zsh
@@ -1364,39 +1403,51 @@ in
   ];
 
   #################################
-  # Set Zsh to use ~/.config/zsh as its config directory
+  # Zsh config location
   #################################
   environment.etc."zshenv".text = ''
     export ZDOTDIR=$HOME/.config/zsh
   '';
 
   #################################
-  # Deploy global zshrc for all users
+  # Generated alias functions (system-wide)
+  #################################
+  environment.etc."profile.d/99-alias-functions.sh".text = ''
+    # system-wide functions generated from aliases.conf
+    ${functions}
+  '';
+
+  #################################
+  # Global zshrc
   #################################
   environment.etc."zshrc".text = ''
     export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh
     ZSH_THEME=""
     plugins=(git sudo extract colored-man-pages command-not-found history docker kubectl)
+
     source $ZSH/oh-my-zsh.sh
 
-    # Load optional per-user generated zshrc if it exists
-    [ -f "${generatedZsh}" ] && source "${generatedZsh}"
-
-    # Initialize Starship prompt
+    # Init starship FIRST (prompt)
     eval "$(starship init zsh)"
 
-    # Syntax highlighting — must be sourced last
+    # Load alias functions
+    if [ -f /etc/profile.d/99-alias-functions.sh ]; then
+      source /etc/profile.d/99-alias-functions.sh
+    fi
+
+    # Load optional generated user config
+    [ -f "${generatedZsh}" ] && source "${generatedZsh}"
+
+    # Syntax highlighting MUST be last
     source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
   '';
 
   #################################
-  # Set Zsh as default login shell for the user via Home Manager
+  # Home Manager integration
   #################################
-  home-manager.users = {
-    ${username} = {
-      programs.zsh.enable = true;
-      home.file.".config/zsh/.zshrc".source = generatedZsh;
-    };
+  home-manager.users.${username} = {
+    programs.zsh.enable = true;
+    home.file.".config/zsh/.zshrc".source = generatedZsh;
   };
 }
 
@@ -1404,13 +1455,13 @@ in
-
-

generated/modules/traveldroid/desktop

-
+
+

generated/modules/traveldroid/desktop

+
-
-

generated/modules/traveldroid/desktop/fonts.nix

-
+
+

generated/modules/traveldroid/desktop/fonts.nix

+

This file installs and configures fonts

@@ -1428,9 +1479,9 @@ This file installs and configures fonts
-
-

generated/modules/traveldroid/desktop/gtk.nix

-
+
+

generated/modules/traveldroid/desktop/gtk.nix

+

Setting up GTK

@@ -1456,9 +1507,9 @@ in
-
-

generated/modules/traveldroid/desktop/hyprland.nix

-
+
+

generated/modules/traveldroid/desktop/hyprland.nix

+

Setting up Hyprland

@@ -1504,9 +1555,9 @@ in
-
-

generated/modules/traveldroid/desktop/stylix.nix

-
+
+

generated/modules/traveldroid/desktop/stylix.nix

+
{ lib, config, pkgs, flakeRoot, stylix, ... }:
 
@@ -1593,9 +1644,9 @@ in
 
-
-

generated/modules/traveldroid/desktop/wallpaper.nix

-
+
+

generated/modules/traveldroid/desktop/wallpaper.nix

+

Setting up wallpaper engine + wallpaper gui

@@ -1694,9 +1745,9 @@ in
-
-

generated/modules/traveldroid/desktop/waybar.nix

-
+
+

generated/modules/traveldroid/desktop/waybar.nix

+

This file installs and configures waybar

@@ -1763,9 +1814,9 @@ in
-
-

generated/modules/traveldroid/desktop/wayland.nix

-
+
+

generated/modules/traveldroid/desktop/wayland.nix

+
{ lib, config, pkgs, ... }:
 
@@ -1795,9 +1846,9 @@ in
 
-
-

generated/modules/traveldroid/desktop/xdg.nix

-
+
+

generated/modules/traveldroid/desktop/xdg.nix

+

This sets the XDG implementation

@@ -1851,13 +1902,13 @@ in
-
-

generated/modules/traveldroid/system

-
+
+

generated/modules/traveldroid/system

+
-
-

generated/modules/traveldroid/system/aliases.nix

-
+
+

generated/parked/modules/traveldroid/system/aliases.nix

+

This file makes aliases in ./generated/assets/aliases.conf system-wide available

@@ -1907,14 +1958,18 @@ in environment.shellInit = '' source /etc/profile ''; + + interactiveShellInit = '' + source /etc/profile.d/99-alias-functions.sh + ''; }
-
-

generated/modules/traveldroid/system/audio.nix

-
+
+

generated/modules/traveldroid/system/audio.nix

+
{ lib, config, pkgs, ... }:
 
@@ -1933,9 +1988,9 @@ in
 
-
-

generated/modules/traveldroid/system/avahi.nix

-
+
+

generated/modules/traveldroid/system/avahi.nix

+

Avahi helps discovering services

@@ -1955,9 +2010,9 @@ Avahi helps discovering services
-
-

generated/modules/traveldroid/system/bluetooth.nix

-
+
+

generated/modules/traveldroid/system/bluetooth.nix

+

Installing Bluetooth services and supporting aps

@@ -1981,9 +2036,9 @@ in
-
-

generated/modules/traveldroid/system/copy_scripts.nix

-
+
+

generated/modules/traveldroid/system/copy_scripts.nix

+

This copies any scripts from generated.config/scripts to ~/.config/scripts and makes any .sh files executable.

@@ -2024,9 +2079,9 @@ in
-
-

generated/modules/traveldroid/system/dbus.nix

-
+
+

generated/modules/traveldroid/system/dbus.nix

+

This sets the dbus implementation

@@ -2053,9 +2108,9 @@ This sets the dbus implementation
-
-

generated/modules/traveldroid/system/firewall.nix

-
+
+

generated/modules/traveldroid/system/firewall.nix

+

This sets the firewall.

@@ -2130,9 +2185,9 @@ This sets the firewall.
-
-

generated/modules/traveldroid/system/gnome-keyring.nix

-
+
+

generated/modules/traveldroid/system/gnome-keyring.nix

+

This sets the dbus implementation

@@ -2180,9 +2235,9 @@ This sets the dbus implementation
-
-

generated/modules/traveldroid/system/login-tuigreet.nix

-
+
+

generated/modules/traveldroid/system/login-tuigreet.nix

+

This sets up tuigreeter which is not fancy but imo fits the aesthetic I am aiming for

@@ -2236,9 +2291,9 @@ in
-
-

generated/modules/traveldroid/system/networking.nix

-
+
+

generated/modules/traveldroid/system/networking.nix

+

This sets the networking.

@@ -2287,9 +2342,9 @@ This sets the networking.
-
-

generated/modules/traveldroid/system/nix.nix

-
+
+

generated/modules/traveldroid/system/nix.nix

+
{ lib, config, ... }:
 
@@ -2305,9 +2360,9 @@ This sets the networking.
 
-
-

generated/modules/traveldroid/system/printing.nix

-
+
+

generated/modules/traveldroid/system/printing.nix

+

This sets the dbus implementation

@@ -2331,9 +2386,9 @@ This sets the dbus implementation
-
-

generated/modules/traveldroid/system/quickshell.nix

-
+
+

generated/modules/traveldroid/system/quickshell.nix

+

This sets the dbus implementation

@@ -2386,13 +2441,13 @@ in
-
-

generated/users

-
+
+

generated/users

+
-
-

generated/users/

-
+
+

generated/users/

+

This is the default user, just search and replace henrov another name if you want to change

@@ -2454,9 +2509,9 @@ in

These are all the prepared config files

-
-

generated/.config/emacs/early-init.el

-
+
+

generated/.config/emacs/early-init.el

+

This contaions emacs

@@ -2557,9 +2612,9 @@ package-archive-priorities '(("gnu" . 99)
-
-

generated/.config/emacs/init.el

-
+
+

generated/.config/emacs/init.el

+

This contaions emacs

@@ -2969,9 +3024,9 @@ the top of the file."
-
-

generated/.config/hypr/animations.conf

-
+
+

generated/.config/hypr/animations.conf

+

These are config files for .config/hypr

@@ -2992,9 +3047,9 @@ animations {
-
-

generated/.config/hypr/behaviour.conf

-
+
+

generated/.config/hypr/behaviour.conf

+

These are config files for .config/hypr

@@ -3016,9 +3071,9 @@ input {
-
-

generated/.config/hypr/bindings.conf

-
+
+

generated/.config/hypr/bindings.conf

+

These are config files for .config/hypr

@@ -3184,9 +3239,9 @@ bind = $mainMod, U, exec, kitty -e bash -lc "$HOME/.config/scripts/update.sh"
-
-

generated/.config/hypr/exec-once.conf

-
+
+

generated/.config/hypr/exec-once.conf

+

These are config files for .config/hypr

@@ -3206,9 +3261,9 @@ exec-once = ~/.config/scripts/hypr-autocolwidth.sh
-
-

generated/.config/hypr/hypridle.conf

-
+
+

generated/.config/hypr/hypridle.conf

+

These are config files for .config/hypr

@@ -3233,9 +3288,9 @@ listener {
-
-

generated/.config/hypr/hyprland.conf

-
+
+

generated/.config/hypr/hyprland.conf

+

These are config files for .config/hypr

@@ -3254,9 +3309,9 @@ source = ./workspace-rules.conf
-
-

generated/.config/hypr/layer-rules.conf

-
+
+

generated/.config/hypr/layer-rules.conf

+

These are config files for .config/hypr

@@ -3271,9 +3326,9 @@ layerrule = blur on, ignore_alpha 1, match:namespace swaync-notification-window
-
-

generated/.config/hypr/layout.conf

-
+
+

generated/.config/hypr/layout.conf

+

These are config files for .config/hypr

@@ -3288,9 +3343,9 @@ scrolling {
-
-

generated/.config/hypr/monitor-rules.conf

-
+
+

generated/.config/hypr/monitor-rules.conf

+

These are config files for .config/hypr

@@ -3301,9 +3356,9 @@ monitor = eDP-1, preferred, auto-left, 1.5
-
-

generated/.config/hypr/theming.conf

-
+
+

generated/.config/hypr/theming.conf

+

These are config files for .config/hypr

@@ -3370,9 +3425,9 @@ misc {
-
-

generated/.config/hypr/window-rules.conf

-
+
+

generated/.config/hypr/window-rules.conf

+

These are config files for .config/hypr

@@ -3436,9 +3491,9 @@ windowrule {
-
-

generated/.config/hypr/workspace-rules.conf

-
+
+

generated/.config/hypr/workspace-rules.conf

+

These are config files for .config/hypr

@@ -3462,9 +3517,9 @@ workspace = 10
-
-

generated/.config/quickshell/media/shell.qml

-
+
+

generated/.config/quickshell/media/shell.qml

+

offers a adio widget

@@ -3858,9 +3913,9 @@ ShellRoot {
-
-

generated/.config/quickshell/powermenu/shell.qml

-
+
+

generated/.config/quickshell/powermenu/shell.qml

+

Provides a powermenu

@@ -4008,9 +4063,9 @@ ShellRoot {
-
-

generated/.config/scripts/media.sh

-
+
+

generated/.config/scripts/media.sh

+

Providing an media

@@ -4113,9 +4168,9 @@ jq -c -n \
-
-

generated/.config/scripts/layout-selector.sh

-
+
+

generated/.config/scripts/layout-selector.sh

+

Choose your layout

@@ -4157,9 +4212,9 @@ hyprctl dispatch oSD "Layout: $LAYOUT_NAME" 2000
-
-

generated/.config/scripts/hypr-autocolwidth.sh

-
+
+

generated/.config/scripts/hypr-autocolwidth.sh

+

These are config files for .config/scripts

@@ -4213,9 +4268,9 @@ done
-
-

generated/.config/scripts/power.sh

-
+
+

generated/.config/scripts/power.sh

+

Enables a terminal power menu

@@ -4270,9 +4325,9 @@ main
-
-

generated/.config/scripts/update.sh

-
+
+

generated/.config/scripts/update.sh

+

A file containing color variables

@@ -4291,9 +4346,9 @@ flatpak update -y
-
-

generated/.config/scripts/wofi-launcher.sh

-
+
+

generated/.config/scripts/wofi-launcher.sh

+

Providing an media

@@ -4308,9 +4363,9 @@ Providing an media
-
-

generated/.config/shared/Colors.css

-
+
+

generated/.config/shared/Colors.css

+

A file containing color variables

@@ -4350,9 +4405,9 @@ A file containing color variables
-
-

generated/.config/starship.toml

-
+
+

generated/.config/starship.toml

+

These are config files for Starship

@@ -4640,9 +4695,9 @@ crust = "#181926"
-
-

generated/.config/stylix/stylix.conf

-
+
+

generated/.config/stylix/stylix.conf

+

These are config files for .config/stylix

@@ -4679,9 +4734,9 @@ icons = {
-
-

generated/.config/stylix/palette.json

-
+
+

generated/.config/stylix/palette.json

+

These are config files for .config/stylix

@@ -4711,9 +4766,9 @@ These are config files for .config/stylix
-
-

generated/.config/stylix/palette.html

-
+
+

generated/.config/stylix/palette.html

+

These are config files for .config/stylix

@@ -4791,9 +4846,9 @@ These are config files for .config/stylix
-
-

generated/.config/waybar/config

-
+
+

generated/.config/waybar/config

+

These are config files for waybar

@@ -5033,9 +5088,9 @@ These are config files for waybar
-
-

generated/.config/waybar/style-dark.css

-
+
+

generated/.config/waybar/style-dark.css

+

This file contains all css for waybar

@@ -5264,9 +5319,9 @@ label#custom-windows:not(.active) {
-
-

generated/.config/scripts/bluetooth-status.sh

-
+
+

generated/.config/scripts/bluetooth-status.sh

+

These are config files for waybar

@@ -5291,9 +5346,9 @@ printf '{"text": "%s", "tooltip": "%s"}\n' "$icon" "$tooltip"
-
-

generated/.config/scripts/hypr-workspaces.sh

-
+
+

generated/.config/scripts/hypr-workspaces.sh

+

These are config files for waybar

@@ -5335,9 +5390,9 @@ jq -c -n \
-
-

generated/.config/scripts/hypr-workspacesmenu.sh

-
+
+

generated/.config/scripts/hypr-workspacesmenu.sh

+

These are config files for waybar

@@ -5359,9 +5414,9 @@ hyprctl dispatch focuswindow address:"$addr"
-
-

generated/.config/waypaper/config.ini

-
+
+

generated/.config/waypaper/config.ini

+

These are config files for waypaper

@@ -5398,9 +5453,9 @@ keybindings = ~/.config/waypaper/keybindings.ini
-
-

generated/.config/waypaper/config.ini

-
+
+

generated/.config/waypaper/config.ini

+

These are config files for .config/waypaper

@@ -5436,9 +5491,9 @@ keybindings = ~/.config/waypaper/keybindings.ini
-
-

generated/.config/wofi/config

-
+
+

generated/.config/wofi/config

+

These are config files for .config/wofi

@@ -5465,9 +5520,9 @@ prompt = > ...
-
-

generated/.config/wofi/style.css

-
+
+

generated/.config/wofi/style.css

+

This is the default layout for wofi

@@ -5563,9 +5618,9 @@ This is the default layout for wofi
-
-

generated/.config/zed/settings.json

-
+
+

generated/.config/zed/settings.json

+

These are config files for Zed editor

@@ -5601,9 +5656,9 @@ These are config files for Zed editor
-
-

generated/.config/zsh/.zshrc

-
+
+

generated/.config/zsh/.zshrc

+

This sets up the zsh in the terminal

@@ -5628,7 +5683,7 @@ fi

Author: Henro Veijer

-

Created: 2026-04-14 di 19:19

+

Created: 2026-04-14 di 19:25

Validate

diff --git a/Droidnix/README.org b/Droidnix/README.org index 215c6124f..b09cd6c0a 100644 --- a/Droidnix/README.org +++ b/Droidnix/README.org @@ -901,15 +901,54 @@ in ** =generated/modules/traveldroid/apps/zsh.nix= This sets up the zsh in the terminal #+BEGIN_SRC nix :tangle generated/modules/traveldroid/apps/zsh.nix :noweb yes :mkdirp yes :eval never -# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. --- { lib, config, pkgs, flakeRoot, ... }: + let + ################################# + # User config + ################################# username = config.defaultUser or "henrov"; generatedZsh = "${flakeRoot}/generated/.config/zsh/.zshrc"; + + ################################# + # Alias parsing + ################################# + aliasFile = "${flakeRoot}/generated/assets/aliases.conf"; + content = builtins.readFile aliasFile; + + lines = + lib.filter (l: l != "") + (map (l: + let + noComment = builtins.head (lib.splitString "#" l); + in lib.trim noComment + ) (lib.splitString "\n" content)); + + parseLine = line: + let + parts = lib.splitString "=" line; + in + if lib.length parts < 2 then null else { + name = lib.trim (lib.head parts); + value = lib.trim (lib.concatStringsSep "=" (lib.tail parts)); + }; + + parsed = + lib.filter (x: x != null) + (map parseLine lines); + + functions = + lib.concatStringsSep "\n" + (map (x: '' + ${x.name}() { + ${x.value} "$@" + } + '') parsed); + in { ################################# - # Install Zsh, Oh My Zsh, Starship and syntax highlighting system-wide + # Packages ################################# environment.systemPackages = with pkgs; [ zsh @@ -919,39 +958,51 @@ in ]; ################################# - # Set Zsh to use ~/.config/zsh as its config directory + # Zsh config location ################################# environment.etc."zshenv".text = '' export ZDOTDIR=$HOME/.config/zsh ''; ################################# - # Deploy global zshrc for all users + # Generated alias functions (system-wide) + ################################# + environment.etc."profile.d/99-alias-functions.sh".text = '' + # system-wide functions generated from aliases.conf + ${functions} + ''; + + ################################# + # Global zshrc ################################# environment.etc."zshrc".text = '' export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh ZSH_THEME="" plugins=(git sudo extract colored-man-pages command-not-found history docker kubectl) + source $ZSH/oh-my-zsh.sh - # Load optional per-user generated zshrc if it exists - [ -f "${generatedZsh}" ] && source "${generatedZsh}" - - # Initialize Starship prompt + # Init starship FIRST (prompt) eval "$(starship init zsh)" - # Syntax highlighting — must be sourced last + # Load alias functions + if [ -f /etc/profile.d/99-alias-functions.sh ]; then + source /etc/profile.d/99-alias-functions.sh + fi + + # Load optional generated user config + [ -f "${generatedZsh}" ] && source "${generatedZsh}" + + # Syntax highlighting MUST be last source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ''; ################################# - # Set Zsh as default login shell for the user via Home Manager + # Home Manager integration ################################# - home-manager.users = { - ${username} = { - programs.zsh.enable = true; - home.file.".config/zsh/.zshrc".source = generatedZsh; - }; + home-manager.users.${username} = { + programs.zsh.enable = true; + home.file.".config/zsh/.zshrc".source = generatedZsh; }; } #+END_SRC @@ -1360,9 +1411,9 @@ in * generated/modules/traveldroid/system -** =generated/modules/traveldroid/system/aliases.nix= +** =generated/parked/modules/traveldroid/system/aliases.nix= This file makes aliases in ./generated/assets/aliases.conf system-wide available -#+BEGIN_SRC nix :tangle generated/modules/traveldroid/system/aliases.nix :noweb yes :mkdirp yes :eval never +#+BEGIN_SRC nix :tangle generated/parked/modules/traveldroid/system/aliases.nix :noweb yes :mkdirp yes :eval never { lib, pkgs, flakeRoot,... }: let @@ -1408,6 +1459,10 @@ in environment.shellInit = '' source /etc/profile ''; + + interactiveShellInit = '' + source /etc/profile.d/99-alias-functions.sh + ''; } #+END_SRC diff --git a/Droidnix/generated/modules/traveldroid/apps/zsh.nix b/Droidnix/generated/modules/traveldroid/apps/zsh.nix index 25e575b69..d4ca4c2bb 100644 --- a/Droidnix/generated/modules/traveldroid/apps/zsh.nix +++ b/Droidnix/generated/modules/traveldroid/apps/zsh.nix @@ -1,13 +1,52 @@ # --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. --- -# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. --- { lib, config, pkgs, flakeRoot, ... }: + let + ################################# + # User config + ################################# username = config.defaultUser or "henrov"; generatedZsh = "${flakeRoot}/generated/.config/zsh/.zshrc"; + + ################################# + # Alias parsing + ################################# + aliasFile = "${flakeRoot}/generated/assets/aliases.conf"; + content = builtins.readFile aliasFile; + + lines = + lib.filter (l: l != "") + (map (l: + let + noComment = builtins.head (lib.splitString "#" l); + in lib.trim noComment + ) (lib.splitString "\n" content)); + + parseLine = line: + let + parts = lib.splitString "=" line; + in + if lib.length parts < 2 then null else { + name = lib.trim (lib.head parts); + value = lib.trim (lib.concatStringsSep "=" (lib.tail parts)); + }; + + parsed = + lib.filter (x: x != null) + (map parseLine lines); + + functions = + lib.concatStringsSep "\n" + (map (x: '' + ${x.name}() { + ${x.value} "$@" + } + '') parsed); + in { ################################# - # Install Zsh, Oh My Zsh, Starship and syntax highlighting system-wide + # Packages ################################# environment.systemPackages = with pkgs; [ zsh @@ -17,38 +56,50 @@ in ]; ################################# - # Set Zsh to use ~/.config/zsh as its config directory + # Zsh config location ################################# environment.etc."zshenv".text = '' export ZDOTDIR=$HOME/.config/zsh ''; ################################# - # Deploy global zshrc for all users + # Generated alias functions (system-wide) + ################################# + environment.etc."profile.d/99-alias-functions.sh".text = '' + # system-wide functions generated from aliases.conf + ${functions} + ''; + + ################################# + # Global zshrc ################################# environment.etc."zshrc".text = '' export ZSH=${pkgs.oh-my-zsh}/share/oh-my-zsh ZSH_THEME="" plugins=(git sudo extract colored-man-pages command-not-found history docker kubectl) + source $ZSH/oh-my-zsh.sh - # Load optional per-user generated zshrc if it exists - [ -f "${generatedZsh}" ] && source "${generatedZsh}" - - # Initialize Starship prompt + # Init starship FIRST (prompt) eval "$(starship init zsh)" - # Syntax highlighting — must be sourced last + # Load alias functions + if [ -f /etc/profile.d/99-alias-functions.sh ]; then + source /etc/profile.d/99-alias-functions.sh + fi + + # Load optional generated user config + [ -f "${generatedZsh}" ] && source "${generatedZsh}" + + # Syntax highlighting MUST be last source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ''; ################################# - # Set Zsh as default login shell for the user via Home Manager + # Home Manager integration ################################# - home-manager.users = { - ${username} = { - programs.zsh.enable = true; - home.file.".config/zsh/.zshrc".source = generatedZsh; - }; + home-manager.users.${username} = { + programs.zsh.enable = true; + home.file.".config/zsh/.zshrc".source = generatedZsh; }; } diff --git a/Droidnix/generated/parked/modules/traveldroid/system/aliases.nix b/Droidnix/generated/parked/modules/traveldroid/system/aliases.nix new file mode 100644 index 000000000..a2ef2c1ec --- /dev/null +++ b/Droidnix/generated/parked/modules/traveldroid/system/aliases.nix @@ -0,0 +1,51 @@ +# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. --- +{ lib, pkgs, flakeRoot,... }: + +let + aliasFile = "${flakeRoot}/generated/assets/aliases.conf"; + + content = builtins.readFile aliasFile; + + lines = + lib.filter (l: l != "") + (map (l: + let + noComment = builtins.head (lib.splitString "#" l); + in lib.trim noComment + ) (lib.splitString "\n" content)); + + parseLine = line: + let + parts = lib.splitString "=" line; + in + if lib.length parts < 2 then null else { + name = lib.head parts; + value = lib.concatStringsSep "=" (lib.tail parts); + }; + + parsed = + lib.filter (x: x != null) + (map parseLine lines); + + functions = + lib.concatStringsSep "\n" + (map (x: '' + ${x.name}() { + ${x.value} "$@" + } + '') parsed); + +in +{ + environment.etc."profile.d/99-alias-functions.sh".text = '' + # system-wide functions generated from aliases.conf + ${functions} + ''; + environment.shellInit = '' + source /etc/profile + ''; + + interactiveShellInit = '' + source /etc/profile.d/99-alias-functions.sh + ''; +}