mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
nixos/lib: Add disablePackageByName
We do this in multiple DE modules and the behaviour was not consistent.
This commit is contained in:
parent
909473552e
commit
8fe87559a9
1 changed files with 19 additions and 0 deletions
|
@ -343,6 +343,25 @@ utils = rec {
|
|||
in
|
||||
filter (x: !(elem (getName x) namesToRemove)) packages;
|
||||
|
||||
/* Returns false if a package with the same name as the `package` is present in `packagesToDisable`.
|
||||
|
||||
Type:
|
||||
disablePackageByName :: package -> [package] -> bool
|
||||
|
||||
Example:
|
||||
disablePackageByName file-roller [ file-roller totem ]
|
||||
=> false
|
||||
|
||||
Example:
|
||||
disablePackageByName nautilus [ file-roller totem ]
|
||||
=> true
|
||||
*/
|
||||
disablePackageByName = package: packagesToDisable:
|
||||
let
|
||||
namesToDisable = map getName packagesToDisable;
|
||||
in
|
||||
!elem (getName package) namesToDisable;
|
||||
|
||||
systemdUtils = {
|
||||
lib = import ./systemd-lib.nix { inherit lib config pkgs utils; };
|
||||
unitOptions = import ./systemd-unit-options.nix { inherit lib systemdUtils; };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue