From 68c72689ebe99b1546825ae4164a829ee73b4a4e Mon Sep 17 00:00:00 2001 From: Wittano Bonarotti Date: Thu, 22 Feb 2024 17:23:43 +0100 Subject: [PATCH] refactor: removed unused pkgs and dependencies --- modules/desktop/apps/dunst.nix | 6 +++--- modules/desktop/apps/gtk.nix | 1 + modules/desktop/apps/picom.nix | 3 ++- modules/desktop/apps/polybar.nix | 1 - modules/desktop/apps/postman.nix | 3 --- modules/desktop/apps/ranger.nix | 2 +- modules/desktop/apps/switchOff.nix | 1 + modules/desktop/apps/zeal.nix | 3 --- modules/dev/dotnet.nix | 2 +- modules/dev/python.nix | 4 ++-- modules/editors/emacs.nix | 4 +--- modules/hardware/bluetooth.nix | 4 ++-- modules/hardware/bootloader.nix | 4 ++-- modules/hardware/nvidia.nix | 1 + modules/hardware/sound.nix | 4 ++-- modules/hardware/wacom.nix | 1 + modules/hardware/wifi.nix | 2 +- modules/services/autoUpgrade.nix | 2 +- modules/services/backup.nix | 4 ++-- modules/services/boinc.nix | 1 + modules/services/filebot.nix | 4 ++-- modules/services/flatpak.nix | 14 ++++++++------ modules/services/kubernetes.nix | 2 +- modules/services/polkit.nix | 2 +- modules/services/prometheus.nix | 5 ++--- modules/services/redshift.nix | 7 +++++-- modules/services/ssh.nix | 4 ++-- modules/services/syncthing.nix | 1 + modules/themes/dracula.nix | 8 ++++---- modules/themes/gruvbox.nix | 4 ++-- modules/utils.nix | 8 +++----- 31 files changed, 56 insertions(+), 56 deletions(-) delete mode 100644 modules/desktop/apps/postman.nix delete mode 100644 modules/desktop/apps/zeal.nix diff --git a/modules/desktop/apps/dunst.nix b/modules/desktop/apps/dunst.nix index 492c530c..c0753fe0 100644 --- a/modules/desktop/apps/dunst.nix +++ b/modules/desktop/apps/dunst.nix @@ -1,15 +1,15 @@ { pkgs, home-manager, lib, dotfiles, cfg, ... }: with lib; with lib.my; -with lib.my.mapper; let - catppuccinDunstConfig = mapDirToAttrs (pkgs.fetchFromGitHub { + catppuccinDunstConfig = mapper.mapDirToAttrs (pkgs.fetchFromGitHub { owner = "catppuccin"; repo = "dunst"; rev = "b0b838d38f134136322ad3df2b6dc57c4ca118cf"; sha256 = "sha256-ruFcHh1dkd4Zy9qNlAA8qAksTzNjXPd2hSSmhdGgflU="; }); -in { +in +{ home-manager.users.wittano.services.dunst = { enable = true; configFile = catppuccinDunstConfig.src."macchiato.conf".source; diff --git a/modules/desktop/apps/gtk.nix b/modules/desktop/apps/gtk.nix index 08cff501..38685d82 100644 --- a/modules/desktop/apps/gtk.nix +++ b/modules/desktop/apps/gtk.nix @@ -19,6 +19,7 @@ in link.createMutableLinkActivation cfg "gtk-3.0/settings.ini"; }; + # TODO create mapper attrs to TOML file xdg.configFile = mkIf (cfg.enableDevMode == false) { "gtk-3.0/bookmarks".text = '' file:///tmp Temporary diff --git a/modules/desktop/apps/picom.nix b/modules/desktop/apps/picom.nix index 6c219cf1..1f2dbb15 100644 --- a/modules/desktop/apps/picom.nix +++ b/modules/desktop/apps/picom.nix @@ -1,6 +1,7 @@ { pkgs, lib, cfg, ... }: with lib; -with lib.my; { +with lib.my; +{ services.picom = { enable = true; package = pkgs.picom-allusive; diff --git a/modules/desktop/apps/polybar.nix b/modules/desktop/apps/polybar.nix index 1ddabe23..1fb5b88b 100644 --- a/modules/desktop/apps/polybar.nix +++ b/modules/desktop/apps/polybar.nix @@ -1,7 +1,6 @@ { pkgs, lib, home-manager, dotfiles, cfg, ... }: with lib; with lib.my; -with builtins; { fonts.packages = with pkgs; [ font-awesome font-awesome_5 siji ]; diff --git a/modules/desktop/apps/postman.nix b/modules/desktop/apps/postman.nix deleted file mode 100644 index beeedaf8..00000000 --- a/modules/desktop/apps/postman.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ pkgs, home-manager, ... }: { - home-manager.users.wittano.home.packages = with pkgs; [ postman ]; -} diff --git a/modules/desktop/apps/ranger.nix b/modules/desktop/apps/ranger.nix index f2a43918..2f9bac38 100644 --- a/modules/desktop/apps/ranger.nix +++ b/modules/desktop/apps/ranger.nix @@ -6,7 +6,7 @@ with lib.my; { packages = with pkgs; [ ranger ]; # It's required cause ranger doesn't allow non-writeable config (27.12.2023) - activation.copyRangerConfig = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + activation.copyRangerConfig = hm.dag.entryAfter [ "writeBoundary" ] '' ${pkgs.coreutils}/bin/cp -r ${dotfiles.ranger.source} /home/wittano/.config ${pkgs.coreutils}/bin/chmod -R 755 /home/wittano/.config/ranger diff --git a/modules/desktop/apps/switchOff.nix b/modules/desktop/apps/switchOff.nix index 92bba07d..fe45856e 100644 --- a/modules/desktop/apps/switchOff.nix +++ b/modules/desktop/apps/switchOff.nix @@ -1,4 +1,5 @@ { pkgs, lib, config, ... }: +# TODO Migarte to pkgs directory let kill = "${pkgs.toybox}/bin/kill"; pgrep = "${pkgs.toybox}/bin/pgrep"; diff --git a/modules/desktop/apps/zeal.nix b/modules/desktop/apps/zeal.nix deleted file mode 100644 index 1127d2f2..00000000 --- a/modules/desktop/apps/zeal.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ pkgs, home-manager, ... }: { - home-manager.users.wittano.home.packages = with pkgs; [ zeal ]; -} diff --git a/modules/dev/dotnet.nix b/modules/dev/dotnet.nix index 728e7664..5a329745 100644 --- a/modules/dev/dotnet.nix +++ b/modules/dev/dotnet.nix @@ -19,7 +19,7 @@ in { environment.variables.DOTNET_CLI_TELEMETRY_OPTOUT = "0"; - home-manager.users.wittano.home.packages = with pkgs; [ dotnet-sdk mono jetbrains.rider ]; + home-manager.users.wittano.home.packages = with pkgs; [ jetbrains.rider ]; } ]); } diff --git a/modules/dev/python.nix b/modules/dev/python.nix index 5bcdfe18..3b76e04a 100644 --- a/modules/dev/python.nix +++ b/modules/dev/python.nix @@ -18,9 +18,9 @@ in ppythonCommand { home-manager.users.wittano = { - home.packages = with pkgs; [ python3 pipenv poetry jetbrains.pycharm-professional ]; + home.packages = with pkgs; [ jetbrains.pycharm-professional ]; - programs.fish.shellAliases.tpy = + programs.fish.shellAliases.tpython = "${pkgs.nixFlakes}/bin/nix flake init --template github:nix-community/poetry2nix"; }; } diff --git a/modules/editors/emacs.nix b/modules/editors/emacs.nix index 1ab2904c..4fb87759 100644 --- a/modules/editors/emacs.nix +++ b/modules/editors/emacs.nix @@ -2,8 +2,6 @@ with lib; with lib.my; let - inherit (lib) mkEnableOption mkOption mkIf types; - cfg = config.modules.editors.emacs; downloadDoomEmacsScript = '' if [ ! -e $HOME/.emacs.d/bin/doom ]; then @@ -43,7 +41,7 @@ in linkMutableDoomEmacsConfiguration = mkIf (cfg.version == "doom") (link.createMutableLinkActivation cfg ".doom.d"); downloadDoomEmacs = mkIf (cfg.version == "doom") - (lib.hm.dag.entryAfter [ "writeBoundery" ] downloadDoomEmacsScript); + (hm.dag.entryAfter [ "writeBoundery" ] downloadDoomEmacsScript); }; file.".doom.d" = diff --git a/modules/hardware/bluetooth.nix b/modules/hardware/bluetooth.nix index 0f776fca..b5b15a31 100644 --- a/modules/hardware/bluetooth.nix +++ b/modules/hardware/bluetooth.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, ... }: +with lib; +with lib.my; let - inherit (lib) mkIf mkEnableOption; - cfg = config.modules.hardware.bluetooth; in { options = { diff --git a/modules/hardware/bootloader.nix b/modules/hardware/bootloader.nix index bd29c1b4..f915652a 100644 --- a/modules/hardware/bootloader.nix +++ b/modules/hardware/bootloader.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, ... }: +with lib; +with lib.my; let - inherit (lib) mkIf mkEnableOption; - cfg = config.modules.hardware.grub; in { options = { diff --git a/modules/hardware/nvidia.nix b/modules/hardware/nvidia.nix index 97ea5493..6b8b4f60 100644 --- a/modules/hardware/nvidia.nix +++ b/modules/hardware/nvidia.nix @@ -1,5 +1,6 @@ { config, pkgs, lib, home-manager, ... }: with lib; +with lib.my; let cfg = config.modules.hardware.nvidia; in diff --git a/modules/hardware/sound.nix b/modules/hardware/sound.nix index 5931ff84..09cbff94 100644 --- a/modules/hardware/sound.nix +++ b/modules/hardware/sound.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, ... }: +with lib; +with lib.my; let - inherit (lib) mkIf mkEnableOption mkDefault mkOption types; - cfg = config.modules.hardware.sound; in { options = { diff --git a/modules/hardware/wacom.nix b/modules/hardware/wacom.nix index 55a74ffe..11b4a341 100644 --- a/modules/hardware/wacom.nix +++ b/modules/hardware/wacom.nix @@ -1,5 +1,6 @@ { config, pkgs, lib, home-manager, ... }: with lib; +with lib.my; let cfg = config.modules.hardware.wacom; dependecies = strings.makeBinPath (with pkgs;[ xf86_input_wacom gawk ]); diff --git a/modules/hardware/wifi.nix b/modules/hardware/wifi.nix index 3652e1c9..aa72ece8 100644 --- a/modules/hardware/wifi.nix +++ b/modules/hardware/wifi.nix @@ -1,6 +1,6 @@ { config, pkgs, lib, ... }: with lib; -with builtins; +with lib.my; let cfg = config.modules.hardware.wifi; kernel = config.boot.kernelPackages.kernel; diff --git a/modules/services/autoUpgrade.nix b/modules/services/autoUpgrade.nix index e0104ffd..cae9c1dd 100644 --- a/modules/services/autoUpgrade.nix +++ b/modules/services/autoUpgrade.nix @@ -1,6 +1,6 @@ { pkgs, lib, config, home-manager, hostname, ... }: with lib; -with builtins; +with lib.my; let cfg = config.modules.services.autoUpgrade; workingDirectory = config.environment.variables.NIX_DOTFILES; diff --git a/modules/services/backup.nix b/modules/services/backup.nix index 0e5e4338..6a83e82d 100644 --- a/modules/services/backup.nix +++ b/modules/services/backup.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, ... }: +with lib; +with lib.my; let - inherit (lib) mkEnableOption types mkIf mkOption; - cfg = config.modules.services.backup; excludedList = builtins.toFile "exclude.txt" '' diff --git a/modules/services/boinc.nix b/modules/services/boinc.nix index 85fa8822..0b925dca 100644 --- a/modules/services/boinc.nix +++ b/modules/services/boinc.nix @@ -1,5 +1,6 @@ { config, pkgs, lib, ... }: with lib; +with lib.my; let cfg = config.modules.services.boinc; nvidiaDriverPackage = lists.optionals diff --git a/modules/services/filebot.nix b/modules/services/filebot.nix index 23b3b134..77ac2586 100644 --- a/modules/services/filebot.nix +++ b/modules/services/filebot.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, ... }: +with lib; +with lib.my; let - inherit (lib) mkEnableOption mkIf; - cfg = config.modules.services.filebot; in { diff --git a/modules/services/flatpak.nix b/modules/services/flatpak.nix index 19331569..f359a35d 100644 --- a/modules/services/flatpak.nix +++ b/modules/services/flatpak.nix @@ -1,19 +1,21 @@ { config, pkgs, lib, ... }: +with lib; +with lib.my; let - inherit (lib) mkEnableOption mkIf; - cfg = config.modules.services.flatpak; -in { +in +{ options = { - modules.services.flatpak = { enable = mkEnableOption "Enable flatpak"; }; + modules.services.flatpak = { + enable = mkEnableOption "Enable flatpak"; + }; }; config = mkIf cfg.enable { services.flatpak.enable = true; xdg.portal = { enable = true; - extraPortals = - lib.mkIf (config.services.xserver.desktopManager.gnome.enable == false) + extraPortals = mkIf (config.services.xserver.desktopManager.gnome.enable == false) [ pkgs.xdg-desktop-portal-gtk ]; config.common.default = "*"; }; diff --git a/modules/services/kubernetes.nix b/modules/services/kubernetes.nix index 97d248be..fef20dfe 100644 --- a/modules/services/kubernetes.nix +++ b/modules/services/kubernetes.nix @@ -1,6 +1,6 @@ { pkgs, lib, config, home-manager, ... }: with lib; -with builtins; +with lib.my; let cfg = config.modules.services.kubernetes; ipAddress = (head config.networking.interfaces.eno1.ipv4.addresses).address; diff --git a/modules/services/polkit.nix b/modules/services/polkit.nix index 7ec03a8b..1e194b25 100644 --- a/modules/services/polkit.nix +++ b/modules/services/polkit.nix @@ -1,6 +1,6 @@ { pkgs, lib, config, ... }: with lib; -with builtins; +with lib.my; let cfg = config.modules.services.polkit; in diff --git a/modules/services/prometheus.nix b/modules/services/prometheus.nix index cafdb13a..e3016ec6 100644 --- a/modules/services/prometheus.nix +++ b/modules/services/prometheus.nix @@ -1,8 +1,7 @@ { config, lib, pkgs, ... }: - +with lib; +with lib.my; let - inherit (lib) mkEnableOption mkIf; - cfg = config.modules.services.prometheus; in { diff --git a/modules/services/redshift.nix b/modules/services/redshift.nix index 945a8482..fcd3ba61 100644 --- a/modules/services/redshift.nix +++ b/modules/services/redshift.nix @@ -1,7 +1,10 @@ { config, pkgs, lib, ... }: with lib; -let cfg = config.modules.services.redshift; -in { +with lib.my; +let + cfg = config.modules.services.redshift; +in +{ options = { modules.services.redshift = { enable = mkEnableOption '' diff --git a/modules/services/ssh.nix b/modules/services/ssh.nix index a11dd05b..fcde3899 100644 --- a/modules/services/ssh.nix +++ b/modules/services/ssh.nix @@ -1,7 +1,7 @@ { config, pkgs, lib, ... }: +with lib; +with lib.my; let - inherit (lib) mkEnableOption mkIf; - cfg = config.modules.services.ssh; in { options = { diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix index b14dc02c..903b4627 100644 --- a/modules/services/syncthing.nix +++ b/modules/services/syncthing.nix @@ -1,5 +1,6 @@ { config, pkgs, lib, home-manager, ... }: with lib; +with lib.my; let homeDir = "/home/wittano"; cfg = config.modules.services.syncthing; diff --git a/modules/themes/dracula.nix b/modules/themes/dracula.nix index e1b51468..b697335e 100644 --- a/modules/themes/dracula.nix +++ b/modules/themes/dracula.nix @@ -1,15 +1,15 @@ -{ config, pkgs, ... }: -with pkgs; +{ config, lib, pkgs, ... }: with lib; +with lib.my; let cfg = config.modules.themes.dracula; - draculaOpenbox = fetchFromGitHub { + draculaOpenbox = pkgs.fetchFromGitHub { owner = "dracula"; repo = "openbox"; rev = "b3222509bb291dc62d201a66a1547a7aac0040b3"; sha256 = "sha256-GZ6/ThHBP3TZshDPHdsNjQEpqowt4eqva0MI/mzELRg="; }; - draculaIcon = fetchzip { + draculaIcon = pkgs.fetchzip { url = "https://github.com/dracula/gtk/files/5214870/Dracula.zip"; sha256 = "sha256-rcSKlgI3bxdh4INdebijKElqbmAfTwO+oEt6M2D1ls0="; }; diff --git a/modules/themes/gruvbox.nix b/modules/themes/gruvbox.nix index 5c3f7b4b..5c836c83 100644 --- a/modules/themes/gruvbox.nix +++ b/modules/themes/gruvbox.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: -with pkgs; +{ config, lib, pkgs, ... }: with lib; +with lib.my; let cfg = config.modules.themes.gruvbox; in { options = { diff --git a/modules/utils.nix b/modules/utils.nix index a4e588f8..44d91d86 100644 --- a/modules/utils.nix +++ b/modules/utils.nix @@ -1,5 +1,6 @@ -{ config, pkgs, lib, home-manager, privateRepo, ... }: +{ config, lib, privateRepo, ... }: with lib; +with lib.my; let cfg = config.modules.utils; in { options = { @@ -14,9 +15,6 @@ in { }; config = mkIf cfg.enable { - home-manager.users.wittano.home.packages = mkIf (cfg.enable) ([ ]); - - environment.systemPackages = - mkIf (cfg.enableGlobalUtils) ([ privateRepo.patcherDir ]); + environment.systemPackages = mkIf (cfg.enableGlobalUtils) ([ privateRepo.patcherDir ]); }; }