refactor(packages): remove if-else hell

This commit is contained in:
2026-05-10 08:37:54 +02:00
parent 251f4d70e1
commit afa7a706de
+38 -63
View File
@@ -1,6 +1,7 @@
{ {
pkgs, pkgs,
pkgs-25-11, # pkgs-25-11,
lib,
gamingSystem, gamingSystem,
workSystem, workSystem,
currentSystemDe, currentSystemDe,
@@ -13,9 +14,10 @@
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
environment.systemPackages = environment.systemPackages = with pkgs;
with pkgs; let
[ hostSystem = pkgs.stdenv.hostPlatform.system;
basePackages = [
# CLI utils # CLI utils
appimage-run appimage-run
bat bat
@@ -60,16 +62,11 @@
vim # The only and one great editor vim # The only and one great editor
inputs.nixvim.packages.${stdenv.hostPlatform.system}.default # The only and one great editor improved even further inputs.nixvim.packages.${stdenv.hostPlatform.system}.default # The only and one great editor improved even further
inputs.spotiflac-cli.packages.${stdenv.hostPlatform.system}.default inputs.spotiflac-cli.packages.${stdenv.hostPlatform.system}.default
] ];
++ (
if currentSystemDe != "none" then
[
# Video card
vulkan-tools
# GUI applications guiPackages = lib.optionals (currentSystemDe != "none") [
vulkan-tools
baobab baobab
bazaar bazaar
blackbox-terminal blackbox-terminal
@@ -86,13 +83,9 @@
seahorse seahorse
telegram-desktop telegram-desktop
thunderbird thunderbird
] ];
else
[ ] gamingPackages = lib.optionals gamingSystem [
)
++ (
if gamingSystem then
[
cura-appimage cura-appimage
heroic heroic
mangohud mangohud
@@ -100,65 +93,47 @@
prismlauncher prismlauncher
protonplus protonplus
satisfactorymodmanager satisfactorymodmanager
# Required for Discord RPC
arrpc arrpc
] ];
else
[ ] workPackages = lib.optionals workSystem [
)
++ (
if workSystem then
[
android-studio android-studio
ansible ansible
virt-manager virt-manager
] ];
else
[ ] plasmaPackages = lib.optionals (currentSystemDe == "plasma") [
)
++ (
if currentSystemDe == "plasma" then
[
kdePackages.wallpaper-engine-plugin kdePackages.wallpaper-engine-plugin
] ];
else
[ ] hyprlandPackages = lib.optionals (currentSystemDe == "hyprland") [
)
++ (
if currentSystemDe == "hyprland" then
[
# Hyprland
brightnessctl brightnessctl
hyprpaper hyprpaper
pamixer pamixer
pavucontrol pavucontrol
kdePackages.dolphin kdePackages.dolphin
] ];
else
[ ] gnomePackages = lib.optionals (currentSystemDe == "gnome") [
)
++ (
if currentSystemDe == "gnome" then
[
gnome-tweaks gnome-tweaks
gnomeExtensions.appindicator gnomeExtensions.appindicator
gnomeExtensions.caffeine gnomeExtensions.caffeine
gnomeExtensions.dash-to-dock gnomeExtensions.dash-to-dock
gnomeExtensions.wallpaper-slideshow gnomeExtensions.wallpaper-slideshow
] ];
else
[ ]
)
++ (
if currentSystemDe == "niri" then
[
gnome-keyring
inputs.noctalia.packages.${pkgs.stdenv.hostPlatform.system}.default niriPackages = lib.optionals (currentSystemDe == "niri") [
] gnome-keyring
else inputs.noctalia.packages.${hostSystem}.default
[ ] ];
); in
basePackages
++ guiPackages
++ gamingPackages
++ workPackages
++ plasmaPackages
++ hyprlandPackages
++ gnomePackages
++ niriPackages;
} }