1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 11:10:03 +00:00

treewide: use a consistent meta.priority default

This commit is contained in:
Philip Taron 2024-08-29 09:04:57 -07:00
parent 24a9af7a38
commit ae92f312bf
No known key found for this signature in database
19 changed files with 31 additions and 31 deletions

View file

@ -133,12 +133,17 @@ rec {
mapDerivationAttrset = f: set: lib.mapAttrs (name: pkg: if lib.isDerivation pkg then (f pkg) else pkg) set; mapDerivationAttrset = f: set: lib.mapAttrs (name: pkg: if lib.isDerivation pkg then (f pkg) else pkg) set;
/** /**
Set the nix-env priority of the package. The default priority of packages in Nix. See `defaultPriority` in [`src/nix/profile.cc`](https://github.com/NixOS/nix/blob/master/src/nix/profile.cc#L47).
*/
defaultPriority = 5;
/**
Set the nix-env priority of the package. Note that higher values are lower priority, and vice versa.
# Inputs # Inputs
`priority` `priority`
: 1\. Function argument : 1\. The priority to set.
`drv` `drv`
: 2\. Function argument : 2\. Function argument
@ -159,8 +164,7 @@ rec {
lowPrio = setPrio 10; lowPrio = setPrio 10;
/** /**
Apply lowPrio to an attrset with derivations Apply lowPrio to an attrset with derivations.
# Inputs # Inputs
@ -184,8 +188,7 @@ rec {
hiPrio = setPrio (-10); hiPrio = setPrio (-10);
/** /**
Apply hiPrio to an attrset with derivations Apply hiPrio to an attrset with derivations.
# Inputs # Inputs

View file

@ -7,7 +7,7 @@ with lib;
let let
requiredPackages = map (pkg: setPrio ((pkg.meta.priority or 5) + 3) pkg) requiredPackages = map (pkg: setPrio ((pkg.meta.priority or lib.meta.defaultPriority) + 3) pkg)
[ pkgs.acl [ pkgs.acl
pkgs.attr pkgs.attr
pkgs.bashInteractive # bash with ncurses support pkgs.bashInteractive # bash with ncurses support
@ -48,7 +48,7 @@ let
]; ];
defaultPackages = defaultPackages =
map map
(n: let pkg = pkgs.${n}; in setPrio ((pkg.meta.priority or 5) + 3) pkg) (n: let pkg = pkgs.${n}; in setPrio ((pkg.meta.priority or lib.meta.defaultPriority) + 3) pkg)
defaultPackageNames; defaultPackageNames;
defaultPackagesText = "[ ${concatMapStringsSep " " (n: "pkgs.${n}") defaultPackageNames } ]"; defaultPackagesText = "[ ${concatMapStringsSep " " (n: "pkgs.${n}") defaultPackageNames } ]";

View file

@ -1,4 +1,4 @@
{ symlinkJoin, makeWrapper, kakoune, plugins ? [], configure ? {} }: { lib, symlinkJoin, makeWrapper, kakoune, plugins ? [], configure ? {} }:
let let
# "plugins" is the preferred way, but some configurations may be # "plugins" is the preferred way, but some configurations may be
@ -34,5 +34,5 @@ in
rm -Rf "$out/DELETE_ME" rm -Rf "$out/DELETE_ME"
''; '';
meta = kakoune.meta // { priority = (kakoune.meta.priority or 0) - 1; }; meta = kakoune.meta // { priority = (kakoune.meta.priority or lib.meta.defaultPriority) - 1; };
} }

View file

@ -214,7 +214,7 @@ let
# To prevent builds on hydra # To prevent builds on hydra
hydraPlatforms = []; hydraPlatforms = [];
# prefer wrapper over the package # prefer wrapper over the package
priority = (neovim-unwrapped.meta.priority or 0) - 1; priority = (neovim-unwrapped.meta.priority or lib.meta.defaultPriority) - 1;
}; };
}); });
in in

View file

@ -37,6 +37,6 @@ symlinkJoin {
''; '';
meta = rofi-unwrapped.meta // { meta = rofi-unwrapped.meta // {
priority = (rofi-unwrapped.meta.priority or 0) - 1; priority = (rofi-unwrapped.meta.priority or lib.meta.defaultPriority) - 1;
}; };
} }

View file

@ -421,7 +421,7 @@ let
inherit (browser.meta) description; inherit (browser.meta) description;
mainProgram = launcherName; mainProgram = launcherName;
hydraPlatforms = []; hydraPlatforms = [];
priority = (browser.meta.priority or 0) - 1; # prefer wrapper over the package priority = (browser.meta.priority or lib.meta.defaultPriority) - 1; # prefer wrapper over the package
}; };
}; };
in lib.makeOverridable wrapper in lib.makeOverridable wrapper

View file

@ -40,7 +40,7 @@ in
# To prevent builds on hydra # To prevent builds on hydra
hydraPlatforms = []; hydraPlatforms = [];
# prefer wrapper over the package # prefer wrapper over the package
priority = (helm.meta.priority or 0) - 1; priority = (helm.meta.priority or lib.meta.defaultPriority) - 1;
}; };
}; };
in in

View file

@ -27,6 +27,6 @@ symlinkJoin {
# To prevent builds on hydra # To prevent builds on hydra
hydraPlatforms = []; hydraPlatforms = [];
# prefer wrapper over the package # prefer wrapper over the package
priority = (wayfire.meta.priority or 0) - 1; priority = (wayfire.meta.priority or lib.meta.defaultPriority) - 1;
}; };
} }

View file

@ -68,7 +68,7 @@ runCommand name
# Add any extra outputs specified by the caller of `buildEnv`. # Add any extra outputs specified by the caller of `buildEnv`.
++ lib.filter (p: p!=null) ++ lib.filter (p: p!=null)
(builtins.map (outName: drv.${outName} or null) extraOutputsToInstall); (builtins.map (outName: drv.${outName} or null) extraOutputsToInstall);
priority = drv.meta.priority or 5; priority = drv.meta.priority or lib.meta.defaultPriority;
}) paths); }) paths);
preferLocalBuild = true; preferLocalBuild = true;
allowSubstitutes = false; allowSubstitutes = false;

View file

@ -5,7 +5,7 @@ let
in runCommand "powerline-symbols-${version}" { in runCommand "powerline-symbols-${version}" {
meta = { meta = {
inherit (powerline.meta) license; inherit (powerline.meta) license;
priority = (powerline.meta.priority or 0) + 1; priority = (powerline.meta.priority or lib.meta.defaultPriority) + 1;
maintainers = with lib.maintainers; [ midchildan ]; maintainers = with lib.maintainers; [ midchildan ];
}; };
} '' } ''

View file

@ -65,6 +65,6 @@ stdenvNoCC.mkDerivation (finalAttrs: {
meta = lomiri-system-settings-unwrapped.meta // { meta = lomiri-system-settings-unwrapped.meta // {
description = "System Settings application for Lomiri (wrapped)"; description = "System Settings application for Lomiri (wrapped)";
priority = (lomiri-system-settings-unwrapped.meta.priority or 0) - 1; priority = (lomiri-system-settings-unwrapped.meta.priority or lib.meta.defaultPriority) - 1;
}; };
}) })

View file

@ -51,6 +51,6 @@ stdenv.mkDerivation {
}; };
meta = dnf4-unwrapped.meta // { meta = dnf4-unwrapped.meta // {
priority = (dnf4-unwrapped.meta.priority or 0) - 1; priority = (dnf4-unwrapped.meta.priority or lib.meta.defaultPriority) - 1;
}; };
} }

View file

@ -22,7 +22,7 @@ runCommand (radian.name + "-wrapper") {
# To prevent builds on hydra # To prevent builds on hydra
hydraPlatforms = [ ]; hydraPlatforms = [ ];
# prefer wrapper over the package # prefer wrapper over the package
priority = (radian.meta.priority or 0) - 1; priority = (radian.meta.priority or lib.meta.defaultPriority) - 1;
}; };
} ('' } (''
makeWrapper "${radian}/bin/radian" "$out/bin/radian" \ makeWrapper "${radian}/bin/radian" "$out/bin/radian" \

View file

@ -1,4 +1,4 @@
{ symlinkJoin, R, makeWrapper, recommendedPackages, packages }: { lib, symlinkJoin, R, makeWrapper, recommendedPackages, packages }:
symlinkJoin { symlinkJoin {
name = R.name + "-wrapper"; name = R.name + "-wrapper";
preferLocalBuild = true; preferLocalBuild = true;
@ -26,6 +26,6 @@ symlinkJoin {
# To prevent builds on hydra # To prevent builds on hydra
hydraPlatforms = []; hydraPlatforms = [];
# prefer wrapper over the package # prefer wrapper over the package
priority = (R.meta.priority or 0) - 1; priority = (R.meta.priority or lib.meta.defaultPriority) - 1;
}; };
} }

View file

@ -39,6 +39,6 @@ symlinkJoin {
meta = unwrapped.meta // { meta = unwrapped.meta // {
# prefer wrapped over unwrapped # prefer wrapped over unwrapped
priority = (unwrapped.meta.priority or 0) - 1; priority = (unwrapped.meta.priority or lib.meta.defaultPriority) - 1;
}; };
} }

View file

@ -217,7 +217,7 @@ rec {
meta = gradle.meta // { meta = gradle.meta // {
# prefer normal gradle/mitm-cache over this wrapper, this wrapper only provides the setup hook # prefer normal gradle/mitm-cache over this wrapper, this wrapper only provides the setup hook
# and passthru # and passthru
priority = (gradle.meta.priority or 0) + 1; priority = (gradle.meta.priority or lib.meta.defaultPriority) + 1;
}; };
}) { }; }) { };
} }

View file

@ -93,10 +93,7 @@ stdenv.mkDerivation rec {
The `logger` binary from `util-linux` is preferred over `inetutils`. The `logger` binary from `util-linux` is preferred over `inetutils`.
To instead prioritize this package, set a _lower_ `meta.priority`, or To instead prioritize this package, set a _lower_ `meta.priority`, or
use e.g. `lib.setPrio 5 inetutils`. use e.g. `lib.setPrio 5 inetutils`.
Note that the default `meta.priority` is defined in `buildEnv` and is
currently 5.
*/ */
priority = (util-linux.meta.priority or 5) + 1; priority = (util-linux.meta.priority or lib.meta.defaultPriority) + 1;
}; };
} }

View file

@ -64,7 +64,7 @@ let wrapper = { pythonPackages ? (_: [ ]), plugins ? (_: [ ]), baseConfig ? null
}; };
}; };
meta.priority = (unwrapped.meta.priority or 0) - 1; meta.priority = (unwrapped.meta.priority or lib.meta.defaultPriority) - 1;
}; };
in in
wrapper wrapper

View file

@ -1,9 +1,9 @@
{ runCommand, openssh }: { lib, runCommand, openssh }:
runCommand "ssh-copy-id-${openssh.version}" { runCommand "ssh-copy-id-${openssh.version}" {
meta = openssh.meta // { meta = openssh.meta // {
description = "Tool to copy SSH public keys to a remote machine"; description = "Tool to copy SSH public keys to a remote machine";
priority = (openssh.meta.priority or 0) - 1; priority = (openssh.meta.priority or lib.meta.defaultPriority) - 1;
}; };
} '' } ''
install -Dm 755 {${openssh},$out}/bin/ssh-copy-id install -Dm 755 {${openssh},$out}/bin/ssh-copy-id