Regenerated

This commit is contained in:
2026-04-14 18:30:23 +02:00
parent e32e25e58f
commit 3c86d1c7eb
4 changed files with 552 additions and 502 deletions
@@ -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
'';
}