39 lines
927 B
Nix
39 lines
927 B
Nix
# --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
|
|
{ lib, flakeRoot,... }:
|
|
let
|
|
aliasFile = "${flakeRoot}/generated/assets/aliases.conf";
|
|
|
|
# Read file
|
|
content = builtins.readFile aliasFile;
|
|
|
|
# Split into lines
|
|
lines = lib.splitString "\n" content;
|
|
|
|
# Parse "alias name='value'"
|
|
parseAlias = line:
|
|
let
|
|
match = builtins.match "alias ([^=]+)='(.*)'" line;
|
|
in
|
|
if match == null then null else {
|
|
name = builtins.elemAt match 0;
|
|
value = builtins.elemAt match 1;
|
|
};
|
|
|
|
# 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)
|
|
);
|
|
|
|
in
|
|
{
|
|
environment.shellAliases = aliases;
|
|
}
|