mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-23 14:31:55 +03:00
87722db970
This is to improve package location finding at eval time and script execution time. Deprecates options lock.{repoRoot,lockFileRel} as well as option eval-cache.{repoRoot, cacheFileRel} Instead the user must now set: - paths.projectRoot: pointing to the repoRoot - paths.package: pointing to the package directory - paths.projectRootFile can be used to define a marker file to find the project root. The default is '.git' but it could be set to 'flake.nix' for example - lock files are by default put in the same directory as the package definition
54 lines
905 B
Nix
54 lines
905 B
Nix
# custom app to update the eval-cache of each exported package.
|
|
{
|
|
self,
|
|
lib,
|
|
inputs,
|
|
...
|
|
}: {
|
|
imports = [
|
|
./writers.nix
|
|
];
|
|
perSystem = {
|
|
config,
|
|
self',
|
|
inputs',
|
|
pkgs,
|
|
system,
|
|
...
|
|
}: let
|
|
l = lib // builtins;
|
|
|
|
packages = lib.filterAttrs (name: _: lib.hasPrefix "example-package-" name) self'.checks;
|
|
|
|
scripts =
|
|
l.flatten
|
|
(l.mapAttrsToList
|
|
(name: pkg: pkg.config.lock.refresh or [])
|
|
packages);
|
|
|
|
update-locks =
|
|
config.writers.writePureShellScript
|
|
(with pkgs; [
|
|
coreutils
|
|
git
|
|
nix
|
|
])
|
|
(
|
|
"set -x\n"
|
|
+ (l.concatStringsSep "/bin/refresh\n" scripts)
|
|
+ "/bin/refresh"
|
|
);
|
|
|
|
toApp = script: {
|
|
type = "app";
|
|
program = "${script}";
|
|
};
|
|
in {
|
|
apps = l.mapAttrs (_: toApp) {
|
|
inherit
|
|
update-locks
|
|
;
|
|
};
|
|
};
|
|
}
|