Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos/{gnome,pantheon,cinnamon,budgie}: Standardize notExcluded #360817

Merged
merged 5 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions nixos/lib/utils.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; };
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/desktop-managers/budgie.nix
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ let
enableSshSocket = config.services.openssh.startWhenNeeded;
};

notExcluded = pkg: (!(lib.elem pkg config.environment.budgie.excludePackages));
notExcluded = pkg: utils.disablePackageByName pkg config.environment.budgie.excludePackages;
in {
meta.maintainers = lib.teams.budgie.members;

Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/desktop-managers/cinnamon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let
extraGSettingsOverrides = cfg.extraGSettingsOverrides;
};

notExcluded = pkg: (!(lib.elem (lib.getName pkg) (map lib.getName config.environment.cinnamon.excludePackages)));
notExcluded = pkg: utils.disablePackageByName pkg config.environment.cinnamon.excludePackages;
in

{
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/desktop-managers/gnome.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ let
enableGnomePanel = true;
} ++ cfg.flashback.customSessions;

notExcluded = pkg: mkDefault (!(lib.elem (lib.getName pkg) (map lib.getName config.environment.gnome.excludePackages)));
notExcluded = pkg: mkDefault (utils.disablePackageByName pkg config.environment.gnome.excludePackages);

in

Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/services/x11/desktop-managers/pantheon.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let
extraGSettingsOverrides = cfg.extraGSettingsOverrides;
};

notExcluded = pkg: (!(lib.elem pkg config.environment.pantheon.excludePackages));
notExcluded = pkg: utils.disablePackageByName pkg config.environment.pantheon.excludePackages;
in

{
Expand Down
Loading