dream2nix/v1/nix/modules/flake-parts/apps.update-caches.nix

35 lines
660 B
Nix
Raw Normal View History

{ self, lib, inputs, ... }: {
perSystem = { config, self', inputs', pkgs, system, ... }: let
l = lib // builtins;
allNewFileCommands = l.flatten
(l.mapAttrsToList
(name: pkg: pkg.config.eval-cache.refresh or [])
self'.packages);
update-caches = config.writers.writePureShellScript
(with pkgs; [
coreutils
git
nix
])
(
"set -x\n"
+ (l.concatStringsSep "\n" allNewFileCommands)
);
toApp = script: {
type = "app";
program = "${script}";
};
in {
apps = l.mapAttrs (_: toApp) {
inherit
update-caches
;
};
};
}