Util: Rename catContent to readFiles.

This commit is contained in:
Dmitry Voronin 2024-12-18 11:13:33 +03:00
parent b05a3504a4
commit 487d56501d
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
3 changed files with 6 additions and 3 deletions

View file

@ -15,7 +15,7 @@ let
tgdata = secret.tg.dt "false"; tgdata = secret.tg.dt "false";
tgdatasilent = secret.tg.dt "true"; tgdatasilent = secret.tg.dt "true";
modulesRaw = pkgs.writeText "bash-user-modules-raw" (util.catContent (util.ls ./module)); modulesRaw = pkgs.writeText "bash-user-modules-raw" (util.readFiles (util.ls ./module));
modulesFile = pkgs.replaceVars modulesRaw { modulesFile = pkgs.replaceVars modulesRaw {
inherit inherit
accent accent

View file

@ -15,19 +15,22 @@
ls = path: map (f: "${path}/${f}") (builtins.attrNames (builtins.readDir path)); ls = path: map (f: "${path}/${f}") (builtins.attrNames (builtins.readDir path));
# Concat all files by `text` key. # Concat all files by `text` key.
# TODO: REMOVE
catText = files: args: builtins.foldl' (acc: mod: acc + (import mod args).text) "" files; catText = files: args: builtins.foldl' (acc: mod: acc + (import mod args).text) "" files;
# Concat all file paths by `file` key. # Concat all file paths by `file` key.
# TODO: REMOVE
catFile = catFile =
files: args: files: args:
builtins.foldl' (acc: mod: acc + (builtins.readFile (import mod args).file) + "\n") "" files; builtins.foldl' (acc: mod: acc + (builtins.readFile (import mod args).file) + "\n") "" files;
# Concat all files as a set. # Concat all files as a set.
# TODO: REMOVE
catSet = catSet =
files: args: builtins.foldl' (acc: mod: acc // mod) { } (map (file: import file args) files); files: args: builtins.foldl' (acc: mod: acc // mod) { } (map (file: import file args) files);
# Concat all file contents. # Concat all file contents.
catContent = files: builtins.foldl' (acc: mod: acc + (builtins.readFile mod) + "\n") "" files; readFiles = files: builtins.foldl' (acc: mod: acc + (builtins.readFile mod) + "\n") "" files;
# Systemd service that does not restart with system switch. # Systemd service that does not restart with system switch.
mkStaticSystemdService = mkStaticSystemdService =

View file

@ -10,7 +10,7 @@ let
notificationogg = <static/Notification.ogg>; notificationogg = <static/Notification.ogg>;
shortogg = <static/Short.ogg>; shortogg = <static/Short.ogg>;
raw = pkgs.writeText "swayscript-raw" (util.catContent (util.ls ./script)); raw = pkgs.writeText "swayscript-raw" (util.readFiles (util.ls ./script));
script = pkgs.replaceVars raw { script = pkgs.replaceVars raw {
inherit inherit
pipewire pipewire