{ inputs, lib, ... }: let inherit (lib) filterAttrs mapAttrsToList concatStringsSep ; in { flake.overlays.rolling_datasets = final: prev: let writeShellScript = name: text: prev.writeTextFile { inherit name; executable = true; text = '' #!/bin/sh ${text} ''; checkPhase = '' ${prev.stdenv.shellDryRun} "$target" ''; }; in { rolling_datasets = final.runCommand "rolling_datasets" { } '' mkdir -p $out/bin mkdir -p $out/share/functions export runtimeShell=${prev.runtimeShell} \ runtimePath=${prev.lib.makeBinPath (with prev; [ utillinux zfs ])} ${concatStringsSep "\n" (mapAttrsToList (name: _: '' { binary=${writeShellScript name (builtins.readFile (./. + "/bin/${name}"))} output_binary="$out/bin/${name}" substituteAll "$binary" "$output_binary" chmod +x "$output_binary" } '') (filterAttrs (_: v: v == "regular") (builtins.readDir ./bin)))} for function in ${./functions}/* ; do substituteAll "$function" "$out/share/functions/$(basename "$function")" done ''; }; }