1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2024-12-14 11:47:31 +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:
"${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 {
options = {

View file

@ -9,13 +9,14 @@
let
system =
config._module.args.system or
config._module.args.pkgs.stdenv.hostPlatform.system or
(throw "moduleWithSystem: Could not determine the configuration's system parameter for this module system application.");
config._module.args.pkgs.stdenv.hostPlatform.system or (throw
"moduleWithSystem: Could not determine the `system` parameter for this module set evaluation."
);
allArgs = withSystem system (args: args);
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);
# Use reflection to make the call lazy in the argument.

View file

@ -13,11 +13,13 @@
#
{
config = {
perSystem = { inputs', lib, ... }: {
perSystem = { inputs', lib, options, ... }: {
config = {
_module.args.pkgs = lib.mkOptionDefault (
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
);
};