Files
nixos/Droidnix/generated/modules/traveldroid/system/aliases.nix
T
2026-04-14 18:30:23 +02:00

48 lines
1.1 KiB
Nix

# --- 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
'';
}