1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2025-03-16 21:38:24 +00:00

treewide: Normalize warning & error messages

This commit is contained in:
Dusk Banks 2023-04-19 01:31:39 +00:00
parent 3bbcca6b6f
commit bf47eae50e
3 changed files with 11 additions and 6 deletions

View file

@ -15,7 +15,9 @@ let
}; };
getExe = x: getExe = x:
"${lib.getBin x}/bin/${x.meta.mainProgram or (throw ''Package ${x.name or ""} does not have meta.mainProgram set, so I don't know how to find the main executable. You can set meta.mainProgram, or pass the full path to executable, e.g. program = "''${pkg}/bin/foo"'')}"; "${lib.getBin x}/bin/${x.meta.mainProgram or (throw
''Package ${x.name or ""} does not have meta.mainProgram set, so I don't know how to find the main executable. You can set `meta.mainProgram`, or pass the full path to executable, e.g. program = "''${pkg}/bin/foo"''
)}";
appType = lib.types.submodule { appType = lib.types.submodule {
options = { options = {

View file

@ -9,13 +9,14 @@
let let
system = system =
config._module.args.system or config._module.args.system or
config._module.args.pkgs.stdenv.hostPlatform.system or config._module.args.pkgs.stdenv.hostPlatform.system or (throw
(throw "moduleWithSystem: Could not determine the configuration's system parameter for this module system application."); "moduleWithSystem: Could not determine the `system` parameter for this module set evaluation."
);
allArgs = withSystem system (args: args); allArgs = withSystem system (args: args);
lazyArgsPerParameter = f: builtins.mapAttrs lazyArgsPerParameter = f: builtins.mapAttrs
(k: v: allArgs.${k} or (throw "moduleWithSystem: module argument `${k}` does not exist.")) (k: v: allArgs.${k} or (throw "moduleWithSystem: per-system argument `${k}` does not exist."))
(builtins.functionArgs f); (builtins.functionArgs f);
# Use reflection to make the call lazy in the argument. # Use reflection to make the call lazy in the argument.

View file

@ -13,11 +13,13 @@
# #
{ {
config = { config = {
perSystem = { inputs', lib, ... }: { perSystem = { inputs', lib, options, ... }: {
config = { config = {
_module.args.pkgs = lib.mkOptionDefault ( _module.args.pkgs = lib.mkOptionDefault (
builtins.seq builtins.seq
(inputs'.nixpkgs or (throw "flake-parts: The flake does not have a `nixpkgs` input. Please add it, or set `perSystem._module.args.pkgs` yourself.")) inputs'.nixpkgs or (throw
"flake-parts: The flake does not have a `nixpkgs` input. Please add it, or set `${options._module.args}.pkgs` yourself."
)
inputs'.nixpkgs.legacyPackages inputs'.nixpkgs.legacyPackages
); );
}; };