diff --git a/Droidnix/README.html b/Droidnix/README.html index 24303c544..c87e52635 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,137 +204,137 @@

Table of Contents

-
-

Shortcuts

-
+
+

Shortcuts

+

Introduction The Assets Folder @@ -350,25 +350,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: @@ -381,9 +381,9 @@ The Droidnix repository is organized into two main parts:

-
-

Root Level

-
+
+

Root Level

+
  • flake.nix is the entry point and imports:
      @@ -394,16 +394,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. @@ -424,9 +424,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

@@ -500,44 +500,52 @@ com.todoist.Todoist
-
-

generated/assets/aliases.conf

-
+
+

generated/assets/aliases.conf

+

This is a list of additional apps to install

-
alias ll='ls -lah'
-alias gs='git status'
-alias ga='git add'
-alias gc='git commit'
-alias gp='git push'
-alias gcp='git add . && git commit && git push'
+
#File & navigation
+ll=ls -lah
+cd=z
+blog=cd ~/Repos/blog && ls -lah
 
-alias cd='z'
+# Git shortcuts
+gs=git status
+ga=git add
+gc=git commit
+gp=git push
+gcp=git add . && git commit && git push
+cd=z
 
-alias nps='xdg-open https://search.nixos.org'
-alias hvnx='cd ~/Repos/nixos/henrovnix_ok'
-alias emt='hvnx && emacs README.org --batch -f org-babel-tangle && emacs -Q --batch README.org -f org-html-export-to-html'
-alias nxs='hvnx && sudo nixos-rebuild switch --flake .#traveldroid'
-alias nxt='hvnx && sudo nixos-rebuild test --flake .#traveldroid'
-alias nxv='hvnx && sudo nixos-rebuild build-vm --flake .#traveldroid && "$(ls -1 ./result/bin/run-*-vm | head -n 1)"'
+#Nix commands
+nps=xdg-open https://search.nixos.org
+hvnx=cd ~/Repos/nixos/henrovnix_ok
+emt=cd ~/Repos/nixos/henrovnix_ok && emacs README.org --batch -f org-babel-tangle && emacs -Q --batch README.org -f org-html-export-to-html
+nxs=cd ~/Repos/nixos/henrovnix_ok && sudo nixos-rebuild switch --flake .#traveldroid
+nxt=cd ~/Repos/nixos/henrovnix_ok && sudo nixos-rebuild test --flake .#traveldroid
+nxv=cd ~/Repos/nixos/henrovnix_ok && sudo nixos-rebuild build-vm --flake .#traveldroid && $(ls -1 ./result/bin/run-*-vm | head -n 1)
 
-alias please='sudo'
-alias pls='sudo'
-alias rb='sudo reboot'
-alias po='sudo poweroff'
+#system commands
+please=sudo
+pls=sudo
+rb=sudo reboot
+po=sudo poweroff
 
-alias fpl='flatpak list'
-alias fps='flatpak search'
-alias fpi='flatpak install'
-alias fpr='flatpak run'
+#flatpak commands
+fpl=flatpak list
+fps=flatpak search
+fpi=flatpak install
+fpr=flatpak run
 
-alias nxc='ssh henrov@nextcloud.data-pro.nu'
+#ssh commands
+nxc=ssh henrov@nextcloud.data-pro.nu
 
-alias vs='code'
-alias blog='cd ~/Repos/blog && ll'
-alias keys='hyprctl binds'
+#app shortcuts
+vs=code
+keys=hyprctl binds
 
@@ -550,9 +558,9 @@ alias 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.

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

generated/modules/traveldroid/system/colors.nix

-
+
+

generated/modules/traveldroid/system/colors.nix

+

Setting the colors for Droidnix.

@@ -712,9 +720,9 @@ in
-
-

generated/hosts/traveldroid/boot.nix

-
+
+

generated/hosts/traveldroid/boot.nix

+
{ config, pkgs, lib, flakeRoot, ... }:
 
@@ -760,9 +768,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. @@ -820,9 +828,9 @@ in
-
-

generated/hosts/traveldroid/host.nix

-
+
+

generated/hosts/traveldroid/host.nix

+
{ lib, config, pkgs, flakeRoot, import-tree, home-manager, ... }:
 
@@ -881,13 +889,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

@@ -995,9 +1003,9 @@ in {
-
-

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

-
+
+

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

+

This installs emacs

@@ -1093,9 +1101,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

@@ -1134,9 +1142,9 @@ in
-
-

generated/modules/traveldroid/apps/kitty.nix

-
+
+

generated/modules/traveldroid/apps/kitty.nix

+

This file sets up Kitty terminal

@@ -1194,9 +1202,9 @@ in
-
-

generated/modules/traveldroid/apps/starship.nix

-
+
+

generated/modules/traveldroid/apps/starship.nix

+

This file sets up starship prompt

@@ -1235,9 +1243,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

@@ -1278,9 +1286,9 @@ in
-
-

generated/modules/traveldroid/apps/wofi.nix

-
+
+

generated/modules/traveldroid/apps/wofi.nix

+

This is the install for Wofi, the launcher

@@ -1313,9 +1321,9 @@ in
-
-

generated/modules/traveldroid/apps/zenbrowser.nix

-
+
+

generated/modules/traveldroid/apps/zenbrowser.nix

+

This installs zen browser

@@ -1335,9 +1343,9 @@ in
-
-

generated/modules/traveldroid/apps/zsh.nix

-
+
+

generated/modules/traveldroid/apps/zsh.nix

+

This sets up the zsh in the terminal

@@ -1400,13 +1408,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

@@ -1424,9 +1432,9 @@ This file installs and configures fonts
-
-

generated/modules/traveldroid/desktop/gtk.nix

-
+
+

generated/modules/traveldroid/desktop/gtk.nix

+

Setting up GTK

@@ -1452,9 +1460,9 @@ in
-
-

generated/modules/traveldroid/desktop/hyprland.nix

-
+
+

generated/modules/traveldroid/desktop/hyprland.nix

+

Setting up Hyprland

@@ -1500,9 +1508,9 @@ in
-
-

generated/modules/traveldroid/desktop/stylix.nix

-
+
+

generated/modules/traveldroid/desktop/stylix.nix

+
{ lib, config, pkgs, flakeRoot, stylix, ... }:
 
@@ -1589,9 +1597,9 @@ in
 
-
-

generated/modules/traveldroid/desktop/wallpaper.nix

-
+
+

generated/modules/traveldroid/desktop/wallpaper.nix

+

Setting up wallpaper engine + wallpaper gui

@@ -1690,9 +1698,9 @@ in
-
-

generated/modules/traveldroid/desktop/waybar.nix

-
+
+

generated/modules/traveldroid/desktop/waybar.nix

+

This file installs and configures waybar

@@ -1759,9 +1767,9 @@ in
-
-

generated/modules/traveldroid/desktop/wayland.nix

-
+
+

generated/modules/traveldroid/desktop/wayland.nix

+
{ lib, config, pkgs, ... }:
 
@@ -1791,9 +1799,9 @@ in
 
-
-

generated/modules/traveldroid/desktop/xdg.nix

-
+
+

generated/modules/traveldroid/desktop/xdg.nix

+

This sets the XDG implementation

@@ -1847,61 +1855,70 @@ in
-
-

generated/modules/traveldroid/system

-
+
+

generated/modules/traveldroid/system

+
-
-

generated/modules/traveldroid/system/aliases.nix

-
+
+

generated/modules/traveldroid/system/aliases.nix

+

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

-
{ lib, flakeRoot,... }:
+
{ lib, pkgs, flakeRoot,... }:
+
 let
   aliasFile = "${flakeRoot}/generated/assets/aliases.conf";
 
-  # Read file
   content = builtins.readFile aliasFile;
 
-  # Split into lines
-  lines = lib.splitString "\n" content;
+  lines =
+    lib.filter (l: l != "")
+      (map (l:
+        let
+          noComment = builtins.head (lib.splitString "#" l);
+        in lib.trim noComment
+      ) (lib.splitString "\n" content));
 
-  # Parse "alias name='value'"
-  parseAlias = line:
+  parseLine = line:
     let
-      match = builtins.match "alias ([^=]+)='(.*)'" line;
+      parts = lib.splitString "=" line;
     in
-      if match == null then null else {
-        name = builtins.elemAt match 0;
-        value = builtins.elemAt match 1;
+      if lib.length parts < 2 then null else {
+        name = lib.head parts;
+        value = lib.concatStringsSep "=" (lib.tail parts);
       };
 
-  # Convert to attrset
-  aliases =
-    builtins.listToAttrs (
-      lib.filter (x: x != null)
-        (map (line:
-          let parsed = parseAlias line;
-          in if parsed == null then null else {
-            name = parsed.name;
-            value = parsed.value;
-          }
-        ) lines)
-    );
+  parsed =
+    lib.filter (x: x != null)
+      (map parseLine lines);
+
+  functions =
+    lib.concatStringsSep "\n"
+      (map (x: ''
+        ${x.name}() {
+          ${x.value} "$@"
+        }
+      '') parsed);
 
 in
 {
-  environment.shellAliases = aliases;
+  environment.etc."profile.d/99-alias-functions.sh".text = ''
+    # system-wide functions generated from aliases.conf
+    ${functions}
+  '';
+  environment.shellInit = ''
+    source /etc/profile
+  '';
 }
 
-
-

generated/modules/traveldroid/system/audio.nix

-
+
+

generated/modules/traveldroid/system/audio.nix

+
{ lib, config, pkgs, ... }:
 
@@ -1920,9 +1937,9 @@ in
 
-
-

generated/modules/traveldroid/system/avahi.nix

-
+
+

generated/modules/traveldroid/system/avahi.nix

+

Avahi helps discovering services

@@ -1942,9 +1959,9 @@ Avahi helps discovering services
-
-

generated/modules/traveldroid/system/bluetooth.nix

-
+
+

generated/modules/traveldroid/system/bluetooth.nix

+

Installing Bluetooth services and supporting aps

@@ -1968,9 +1985,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.

@@ -2011,9 +2028,9 @@ in
-
-

generated/modules/traveldroid/system/dbus.nix

-
+
+

generated/modules/traveldroid/system/dbus.nix

+

This sets the dbus implementation

@@ -2040,9 +2057,9 @@ This sets the dbus implementation
-
-

generated/modules/traveldroid/system/firewall.nix

-
+
+

generated/modules/traveldroid/system/firewall.nix

+

This sets the firewall.

@@ -2117,9 +2134,9 @@ This sets the firewall.
-
-

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

-
+
+

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

+

This sets the dbus implementation

@@ -2167,9 +2184,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

@@ -2223,9 +2240,9 @@ in
-
-

generated/modules/traveldroid/system/networking.nix

-
+
+

generated/modules/traveldroid/system/networking.nix

+

This sets the networking.

@@ -2274,9 +2291,9 @@ This sets the networking.
-
-

generated/modules/traveldroid/system/nix.nix

-
+
+

generated/modules/traveldroid/system/nix.nix

+
{ lib, config, ... }:
 
@@ -2292,9 +2309,9 @@ This sets the networking.
 
-
-

generated/modules/traveldroid/system/printing.nix

-
+
+

generated/modules/traveldroid/system/printing.nix

+

This sets the dbus implementation

@@ -2318,9 +2335,9 @@ This sets the dbus implementation
-
-

generated/modules/traveldroid/system/quickshell.nix

-
+
+

generated/modules/traveldroid/system/quickshell.nix

+

This sets the dbus implementation

@@ -2373,13 +2390,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

@@ -2441,9 +2458,9 @@ in

These are all the prepared config files

-
-

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

-
+
+

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

+

This contaions emacs

@@ -2544,9 +2561,9 @@ package-archive-priorities '(("gnu" . 99)
-
-

generated/.config/emacs/init.el

-
+
+

generated/.config/emacs/init.el

+

This contaions emacs

@@ -2956,9 +2973,9 @@ the top of the file."
-
-

generated/.config/hypr/animations.conf

-
+
+

generated/.config/hypr/animations.conf

+

These are config files for .config/hypr

@@ -2979,9 +2996,9 @@ animations {
-
-

generated/.config/hypr/behaviour.conf

-
+
+

generated/.config/hypr/behaviour.conf

+

These are config files for .config/hypr

@@ -3003,9 +3020,9 @@ input {
-
-

generated/.config/hypr/bindings.conf

-
+
+

generated/.config/hypr/bindings.conf

+

These are config files for .config/hypr

@@ -3171,9 +3188,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

@@ -3193,9 +3210,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

@@ -3220,9 +3237,9 @@ listener {
-
-

generated/.config/hypr/hyprland.conf

-
+
+

generated/.config/hypr/hyprland.conf

+

These are config files for .config/hypr

@@ -3241,9 +3258,9 @@ source = ./workspace-rules.conf
-
-

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

-
+
+

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

+

These are config files for .config/hypr

@@ -3258,9 +3275,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

@@ -3275,9 +3292,9 @@ scrolling {
-
-

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

-
+
+

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

+

These are config files for .config/hypr

@@ -3288,9 +3305,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

@@ -3357,9 +3374,9 @@ misc {
-
-

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

-
+
+

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

+

These are config files for .config/hypr

@@ -3423,9 +3440,9 @@ windowrule {
-
-

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

-
+
+

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

+

These are config files for .config/hypr

@@ -3449,9 +3466,9 @@ workspace = 10
-
-

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

-
+
+

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

+

offers a adio widget

@@ -3845,9 +3862,9 @@ ShellRoot {
-
-

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

-
+
+

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

+

Provides a powermenu

@@ -3995,9 +4012,9 @@ ShellRoot {
-
-

generated/.config/scripts/media.sh

-
+
+

generated/.config/scripts/media.sh

+

Providing an media

@@ -4100,9 +4117,9 @@ jq -c -n \
-
-

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

-
+
+

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

+

Choose your layout

@@ -4144,9 +4161,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

@@ -4200,9 +4217,9 @@ done
-
-

generated/.config/scripts/power.sh

-
+
+

generated/.config/scripts/power.sh

+

Enables a terminal power menu

@@ -4257,9 +4274,9 @@ main
-
-

generated/.config/scripts/update.sh

-
+
+

generated/.config/scripts/update.sh

+

A file containing color variables

@@ -4278,9 +4295,9 @@ flatpak update -y
-
-

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

-
+
+

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

+

Providing an media

@@ -4295,9 +4312,9 @@ Providing an media
-
-

generated/.config/shared/Colors.css

-
+
+

generated/.config/shared/Colors.css

+

A file containing color variables

@@ -4337,9 +4354,9 @@ A file containing color variables
-
-

generated/.config/starship.toml

-
+
+

generated/.config/starship.toml

+

These are config files for Starship

@@ -4627,9 +4644,9 @@ crust = "#181926"
-
-

generated/.config/stylix/stylix.conf

-
+
+

generated/.config/stylix/stylix.conf

+

These are config files for .config/stylix

@@ -4666,9 +4683,9 @@ icons = {
-
-

generated/.config/stylix/palette.json

-
+
+

generated/.config/stylix/palette.json

+

These are config files for .config/stylix

@@ -4698,9 +4715,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

@@ -4778,9 +4795,9 @@ These are config files for .config/stylix
-
-

generated/.config/waybar/config

-
+
+

generated/.config/waybar/config

+

These are config files for waybar

@@ -5019,9 +5036,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 #+BEGINSRC css :tangle generated/.config/waybar/style-dark.css :noweb yes :mkdirp yes :eval never @@ -5220,9 +5237,9 @@ label#custom-media.inactive {

-
-

-— Pulseaudio —*/

-
+
+

-— Pulseaudio —*/

+

#pulseaudio-slider { padding: 0; @@ -5322,9 +5339,9 @@ label#custom-media.inactive { #+ENDSRC

-
-

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

-
+
+

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

+

These are config files for waybar

@@ -5349,9 +5366,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

@@ -5393,9 +5410,9 @@ jq -c -n \
-
-

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

-
+
+

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

+

These are config files for waybar

@@ -5417,9 +5434,9 @@ hyprctl dispatch focuswindow address:"$addr"
-
-

generated/.config/waypaper/config.ini

-
+
+

generated/.config/waypaper/config.ini

+

These are config files for waypaper

@@ -5456,9 +5473,9 @@ keybindings = ~/.config/waypaper/keybindings.ini
-
-

generated/.config/waypaper/config.ini

-
+
+

generated/.config/waypaper/config.ini

+

These are config files for .config/waypaper

@@ -5494,9 +5511,9 @@ keybindings = ~/.config/waypaper/keybindings.ini
-
-

generated/.config/wofi/config

-
+
+

generated/.config/wofi/config

+

These are config files for .config/wofi

@@ -5523,9 +5540,9 @@ prompt = > ...
-
-

generated/.config/wofi/style.css

-
+
+

generated/.config/wofi/style.css

+

This is the default layout for wofi

@@ -5621,9 +5638,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

@@ -5659,9 +5676,9 @@ These are config files for Zed editor
-
-

generated/.config/zsh/.zshrc

-
+
+

generated/.config/zsh/.zshrc

+

This sets up the zsh in the terminal

@@ -5686,7 +5703,7 @@ fi

Author: Henro Veijer

-

Created: 2026-04-14 di 15:39

+

Created: 2026-04-14 di 18:30

Validate

diff --git a/Droidnix/README.org b/Droidnix/README.org index 03f665ea2..a81a690ce 100644 --- a/Droidnix/README.org +++ b/Droidnix/README.org @@ -137,41 +137,48 @@ com.todoist.Todoist ** =generated/assets/aliases.conf= This is a list of additional apps to install -#+BEGIN_SRC toml :tangle generated/assets/aliases.conf :noweb yes :mkdirp yes :eval never -alias ll='ls -lah' -alias gs='git status' -alias ga='git add' -alias gc='git commit' -alias gp='git push' -alias gcp='git add . && git commit && git push' +#+BEGIN_SRC conf :tangle generated/assets/aliases.conf :noweb yes :mkdirp yes :eval never +#File & navigation +ll=ls -lah +cd=z +blog=cd ~/Repos/blog && ls -lah -alias cd='z' +# Git shortcuts +gs=git status +ga=git add +gc=git commit +gp=git push +gcp=git add . && git commit && git push +cd=z -alias nps='xdg-open https://search.nixos.org' -alias hvnx='cd ~/Repos/nixos/henrovnix_ok' -alias emt='hvnx && emacs README.org --batch -f org-babel-tangle && emacs -Q --batch README.org -f org-html-export-to-html' -alias nxs='hvnx && sudo nixos-rebuild switch --flake .#traveldroid' -alias nxt='hvnx && sudo nixos-rebuild test --flake .#traveldroid' -alias nxv='hvnx && sudo nixos-rebuild build-vm --flake .#traveldroid && "$(ls -1 ./result/bin/run-*-vm | head -n 1)"' +#Nix commands +nps=xdg-open https://search.nixos.org +hvnx=cd ~/Repos/nixos/henrovnix_ok +emt=cd ~/Repos/nixos/henrovnix_ok && emacs README.org --batch -f org-babel-tangle && emacs -Q --batch README.org -f org-html-export-to-html +nxs=cd ~/Repos/nixos/henrovnix_ok && sudo nixos-rebuild switch --flake .#traveldroid +nxt=cd ~/Repos/nixos/henrovnix_ok && sudo nixos-rebuild test --flake .#traveldroid +nxv=cd ~/Repos/nixos/henrovnix_ok && sudo nixos-rebuild build-vm --flake .#traveldroid && $(ls -1 ./result/bin/run-*-vm | head -n 1) -alias please='sudo' -alias pls='sudo' -alias rb='sudo reboot' -alias po='sudo poweroff' +#system commands +please=sudo +pls=sudo +rb=sudo reboot +po=sudo poweroff -alias fpl='flatpak list' -alias fps='flatpak search' -alias fpi='flatpak install' -alias fpr='flatpak run' +#flatpak commands +fpl=flatpak list +fps=flatpak search +fpi=flatpak install +fpr=flatpak run -alias nxc='ssh henrov@nextcloud.data-pro.nu' +#ssh commands +nxc=ssh henrov@nextcloud.data-pro.nu -alias vs='code' -alias blog='cd ~/Repos/blog && ll' -alias keys='hyprctl binds' +#app shortcuts +vs=code +keys=hyprctl binds #+END_SRC - * The Actual Code :code: :PROPERTIES: :CUSTOM_ID: the-actual-code @@ -1356,42 +1363,51 @@ in ** =generated/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 -{ lib, flakeRoot,... }: +{ lib, pkgs, flakeRoot,... }: + let aliasFile = "${flakeRoot}/generated/assets/aliases.conf"; - # Read file content = builtins.readFile aliasFile; - # Split into lines - lines = lib.splitString "\n" content; + lines = + lib.filter (l: l != "") + (map (l: + let + noComment = builtins.head (lib.splitString "#" l); + in lib.trim noComment + ) (lib.splitString "\n" content)); - # Parse "alias name='value'" - parseAlias = line: + parseLine = line: let - match = builtins.match "alias ([^=]+)='(.*)'" line; + parts = lib.splitString "=" line; in - if match == null then null else { - name = builtins.elemAt match 0; - value = builtins.elemAt match 1; + if lib.length parts < 2 then null else { + name = lib.head parts; + value = lib.concatStringsSep "=" (lib.tail parts); }; - # Convert to attrset - aliases = - builtins.listToAttrs ( - lib.filter (x: x != null) - (map (line: - let parsed = parseAlias line; - in if parsed == null then null else { - name = parsed.name; - value = parsed.value; - } - ) lines) - ); + parsed = + lib.filter (x: x != null) + (map parseLine lines); + + functions = + lib.concatStringsSep "\n" + (map (x: '' + ${x.name}() { + ${x.value} "$@" + } + '') parsed); in { - environment.shellAliases = aliases; + environment.etc."profile.d/99-alias-functions.sh".text = '' + # system-wide functions generated from aliases.conf + ${functions} + ''; + environment.shellInit = '' + source /etc/profile + ''; } #+END_SRC diff --git a/Droidnix/generated/assets/aliases.conf b/Droidnix/generated/assets/aliases.conf index ad682b8fd..a3b0d8e13 100644 --- a/Droidnix/generated/assets/aliases.conf +++ b/Droidnix/generated/assets/aliases.conf @@ -1,32 +1,40 @@ # --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. --- -alias ll='ls -lah' -alias gs='git status' -alias ga='git add' -alias gc='git commit' -alias gp='git push' -alias gcp='git add . && git commit && git push' +#File & navigation +ll=ls -lah +cd=z +blog=cd ~/Repos/blog && ls -lah -alias cd='z' +# Git shortcuts +gs=git status +ga=git add +gc=git commit +gp=git push +gcp=git add . && git commit && git push +cd=z -alias nps='xdg-open https://search.nixos.org' -alias hvnx='cd ~/Repos/nixos/henrovnix_ok' -alias emt='hvnx && emacs README.org --batch -f org-babel-tangle && emacs -Q --batch README.org -f org-html-export-to-html' -alias nxs='hvnx && sudo nixos-rebuild switch --flake .#traveldroid' -alias nxt='hvnx && sudo nixos-rebuild test --flake .#traveldroid' -alias nxv='hvnx && sudo nixos-rebuild build-vm --flake .#traveldroid && "$(ls -1 ./result/bin/run-*-vm | head -n 1)"' +#Nix commands +nps=xdg-open https://search.nixos.org +hvnx=cd ~/Repos/nixos/henrovnix_ok +emt=cd ~/Repos/nixos/henrovnix_ok && emacs README.org --batch -f org-babel-tangle && emacs -Q --batch README.org -f org-html-export-to-html +nxs=cd ~/Repos/nixos/henrovnix_ok && sudo nixos-rebuild switch --flake .#traveldroid +nxt=cd ~/Repos/nixos/henrovnix_ok && sudo nixos-rebuild test --flake .#traveldroid +nxv=cd ~/Repos/nixos/henrovnix_ok && sudo nixos-rebuild build-vm --flake .#traveldroid && $(ls -1 ./result/bin/run-*-vm | head -n 1) -alias please='sudo' -alias pls='sudo' -alias rb='sudo reboot' -alias po='sudo poweroff' +#system commands +please=sudo +pls=sudo +rb=sudo reboot +po=sudo poweroff -alias fpl='flatpak list' -alias fps='flatpak search' -alias fpi='flatpak install' -alias fpr='flatpak run' +#flatpak commands +fpl=flatpak list +fps=flatpak search +fpi=flatpak install +fpr=flatpak run -alias nxc='ssh henrov@nextcloud.data-pro.nu' +#ssh commands +nxc=ssh henrov@nextcloud.data-pro.nu -alias vs='code' -alias blog='cd ~/Repos/blog && ll' -alias keys='hyprctl binds' +#app shortcuts +vs=code +keys=hyprctl binds diff --git a/Droidnix/generated/modules/traveldroid/system/aliases.nix b/Droidnix/generated/modules/traveldroid/system/aliases.nix index 05991f046..91ba1f32e 100644 --- a/Droidnix/generated/modules/traveldroid/system/aliases.nix +++ b/Droidnix/generated/modules/traveldroid/system/aliases.nix @@ -1,38 +1,47 @@ # --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. --- -{ lib, flakeRoot,... }: +{ lib, pkgs, flakeRoot,... }: + let aliasFile = "${flakeRoot}/generated/assets/aliases.conf"; - # Read file content = builtins.readFile aliasFile; - # Split into lines - lines = lib.splitString "\n" content; + lines = + lib.filter (l: l != "") + (map (l: + let + noComment = builtins.head (lib.splitString "#" l); + in lib.trim noComment + ) (lib.splitString "\n" content)); - # Parse "alias name='value'" - parseAlias = line: + parseLine = line: let - match = builtins.match "alias ([^=]+)='(.*)'" line; + parts = lib.splitString "=" line; in - if match == null then null else { - name = builtins.elemAt match 0; - value = builtins.elemAt match 1; + if lib.length parts < 2 then null else { + name = lib.head parts; + value = lib.concatStringsSep "=" (lib.tail parts); }; - # Convert to attrset - aliases = - builtins.listToAttrs ( - lib.filter (x: x != null) - (map (line: - let parsed = parseAlias line; - in if parsed == null then null else { - name = parsed.name; - value = parsed.value; - } - ) lines) - ); + parsed = + lib.filter (x: x != null) + (map parseLine lines); + + functions = + lib.concatStringsSep "\n" + (map (x: '' + ${x.name}() { + ${x.value} "$@" + } + '') parsed); in { - environment.shellAliases = aliases; + environment.etc."profile.d/99-alias-functions.sh".text = '' + # system-wide functions generated from aliases.conf + ${functions} + ''; + environment.shellInit = '' + source /etc/profile + ''; }