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-25-11,
# pkgs-25-11,
lib,
gamingSystem,
workSystem,
currentSystemDe,
@@ -13,9 +14,10 @@
nixpkgs.config.allowUnfree = true;
environment.systemPackages =
with pkgs;
[
environment.systemPackages = with pkgs;
let
hostSystem = pkgs.stdenv.hostPlatform.system;
basePackages = [
# CLI utils
appimage-run
bat
@@ -60,16 +62,11 @@
vim # The only and one great editor
inputs.nixvim.packages.${stdenv.hostPlatform.system}.default # The only and one great editor improved even further
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
bazaar
blackbox-terminal
@@ -86,13 +83,9 @@
seahorse
telegram-desktop
thunderbird
]
else
[ ]
)
++ (
if gamingSystem then
[
];
gamingPackages = lib.optionals gamingSystem [
cura-appimage
heroic
mangohud
@@ -100,65 +93,47 @@
prismlauncher
protonplus
satisfactorymodmanager
# Required for Discord RPC
arrpc
]
else
[ ]
)
++ (
if workSystem then
[
];
workPackages = lib.optionals workSystem [
android-studio
ansible
virt-manager
]
else
[ ]
)
++ (
if currentSystemDe == "plasma" then
[
];
plasmaPackages = lib.optionals (currentSystemDe == "plasma") [
kdePackages.wallpaper-engine-plugin
]
else
[ ]
)
++ (
if currentSystemDe == "hyprland" then
[
# Hyprland
];
hyprlandPackages = lib.optionals (currentSystemDe == "hyprland") [
brightnessctl
hyprpaper
pamixer
pavucontrol
kdePackages.dolphin
]
else
[ ]
)
++ (
if currentSystemDe == "gnome" then
[
];
gnomePackages = lib.optionals (currentSystemDe == "gnome") [
gnome-tweaks
gnomeExtensions.appindicator
gnomeExtensions.caffeine
gnomeExtensions.dash-to-dock
gnomeExtensions.wallpaper-slideshow
]
else
[ ]
)
++ (
if currentSystemDe == "niri" then
[
gnome-keyring
];
inputs.noctalia.packages.${pkgs.stdenv.hostPlatform.system}.default
]
else
[ ]
);
niriPackages = lib.optionals (currentSystemDe == "niri") [
gnome-keyring
inputs.noctalia.packages.${hostSystem}.default
];
in
basePackages
++ guiPackages
++ gamingPackages
++ workPackages
++ plasmaPackages
++ hyprlandPackages
++ gnomePackages
++ niriPackages;
}