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";
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 {
inherit
accent

View file

@ -15,19 +15,22 @@
ls = path: map (f: "${path}/${f}") (builtins.attrNames (builtins.readDir path));
# Concat all files by `text` key.
# TODO: REMOVE
catText = files: args: builtins.foldl' (acc: mod: acc + (import mod args).text) "" files;
# Concat all file paths by `file` key.
# TODO: REMOVE
catFile =
files: args:
builtins.foldl' (acc: mod: acc + (builtins.readFile (import mod args).file) + "\n") "" files;
# Concat all files as a set.
# TODO: REMOVE
catSet =
files: args: builtins.foldl' (acc: mod: acc // mod) { } (map (file: import file args) files);
# 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.
mkStaticSystemdService =

View file

@ -10,7 +10,7 @@ let
notificationogg = <static/Notification.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 {
inherit
pipewire