Remove unnecessary lib fallbacks

literalExpression was added in Nixpkgs 21.11, getExe in 22.05.
The minimum supported lib version is 22.05, so these fallbacks are unnecessary.
This commit is contained in:
Robert Hensing 2026-01-05 09:43:04 +01:00
parent 65b36eb2cb
commit bd4b9dd600
2 changed files with 3 additions and 8 deletions

View file

@ -8,12 +8,7 @@ let
mkTransposedPerSystemModule
;
getExe = lib.getExe or (
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"'')}"
);
programType = lib.types.coercedTo derivationType getExe lib.types.str;
programType = lib.types.coercedTo derivationType lib.getExe lib.types.str;
derivationType = lib.types.package // {
check = lib.isDerivation;
@ -56,7 +51,7 @@ mkTransposedPerSystemModule {
description = ''
Programs runnable with nix run `<name>`.
'';
example = lib.literalExpression or lib.literalExample ''
example = lib.literalExpression ''
{
default.program = "''${config.packages.hello}/bin/hello";
}

View file

@ -14,7 +14,7 @@ in
# This eta expansion exists for the sole purpose of making nix flake check happy.
apply = lib.mapAttrs (_k: f: final: prev: f final prev);
default = { };
example = lib.literalExpression or lib.literalExample ''
example = lib.literalExpression ''
{
default = final: prev: {};
}